mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-21 16:31:39 +00:00
const table support
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#
|
||||
#
|
||||
# Nimrod's Runtime Library
|
||||
# (c) Copyright 2010 Andreas Rumpf
|
||||
# (c) Copyright 2011 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
# distribution, for details about the copyright.
|
||||
@@ -210,7 +210,7 @@ proc `$`*(t: PStringTable): string {.rtl, extern: "nstDollar".} =
|
||||
result.add("}")
|
||||
|
||||
when isMainModule:
|
||||
var x = {"k": "v", "11": "22", "565": "67"}.newStringTable
|
||||
const x = {"k": "v", "11": "22", "565": "67"}.newStringTable
|
||||
assert x["k"] == "v"
|
||||
assert x["11"] == "22"
|
||||
assert x["565"] == "67"
|
||||
|
||||
@@ -61,10 +61,10 @@ proc popCurrentException {.compilerRtl, inl.} =
|
||||
|
||||
# some platforms have native support for stack traces:
|
||||
const
|
||||
nativeStackTrace = (defined(macosx) or defined(linux)) and
|
||||
not nimrodStackTrace
|
||||
nativeStackTraceSupported = (defined(macosx) or defined(linux)) and
|
||||
not nimrodStackTrace
|
||||
|
||||
when nativeStacktrace:
|
||||
when nativeStacktrace and nativeStackTraceSupported:
|
||||
type
|
||||
TDl_info {.importc: "Dl_info", header: "<dlfcn.h>",
|
||||
final, pure.} = object
|
||||
@@ -165,7 +165,7 @@ proc rawWriteStackTrace(s: var string) =
|
||||
add(s, "Traceback (most recent call last)")
|
||||
add(s, stackTraceNewLine)
|
||||
auxWriteStackTrace(framePtr, s)
|
||||
elif nativeStackTrace:
|
||||
elif nativeStackTrace and nativeStackTraceSupported:
|
||||
add(s, "Traceback from system (most recent call last)")
|
||||
add(s, stackTraceNewLine)
|
||||
auxWriteStackTraceWithBacktrace(s)
|
||||
|
||||
Reference in New Issue
Block a user