prepare Nim codebase for upcoming parser changes

This commit is contained in:
Andreas Rumpf
2016-07-15 12:56:03 +02:00
parent 3e72c98d49
commit 0834cd63d9
26 changed files with 46 additions and 46 deletions

View File

@@ -211,14 +211,14 @@ proc genericReset(dest: pointer, mt: PNimType) =
zeroMem(dest, mt.size) # set raw bits to zero
proc selectBranch(discVal, L: int,
a: ptr array [0..0x7fff, ptr TNimNode]): ptr TNimNode =
a: ptr array[0..0x7fff, ptr TNimNode]): ptr TNimNode =
result = a[L] # a[L] contains the ``else`` part (but may be nil)
if discVal <% L:
var x = a[discVal]
if x != nil: result = x
proc FieldDiscriminantCheck(oldDiscVal, newDiscVal: int,
a: ptr array [0..0x7fff, ptr TNimNode],
a: ptr array[0..0x7fff, ptr TNimNode],
L: int) {.compilerProc.} =
var oldBranch = selectBranch(oldDiscVal, L, a)
var newBranch = selectBranch(newDiscVal, L, a)

View File

@@ -159,7 +159,7 @@ type
{.deprecated: [THash: Hash, TWatchpoint: Watchpoint].}
var
watchpoints: array [0..99, Watchpoint]
watchpoints: array[0..99, Watchpoint]
watchpointsLen: int
proc `!&`(h: Hash, val: int): Hash {.inline.} =

View File

@@ -475,7 +475,7 @@ proc dbgWriteStackTrace(f: PFrame) =
it = f
i = 0
total = 0
tempFrames: array [0..127, PFrame]
tempFrames: array[0..127, PFrame]
# setup long head:
while it != nil and i <= high(tempFrames)-firstCalls:
tempFrames[i] = it

View File

@@ -90,13 +90,13 @@ when defined(nativeStacktrace) and nativeStackTraceSupported:
when not hasThreadSupport:
var
tempAddresses: array [0..127, pointer] # should not be alloc'd on stack
tempAddresses: array[0..127, pointer] # should not be alloc'd on stack
tempDlInfo: TDl_info
proc auxWriteStackTraceWithBacktrace(s: var string) =
when hasThreadSupport:
var
tempAddresses: array [0..127, pointer] # but better than a threadvar
tempAddresses: array[0..127, pointer] # but better than a threadvar
tempDlInfo: TDl_info
# This is allowed to be expensive since it only happens during crashes
# (but this way you don't need manual stack tracing)
@@ -124,12 +124,12 @@ when defined(nativeStacktrace) and nativeStackTraceSupported:
when not hasThreadSupport:
var
tempFrames: array [0..127, PFrame] # should not be alloc'd on stack
tempFrames: array[0..127, PFrame] # should not be alloc'd on stack
proc auxWriteStackTrace(f: PFrame, s: var string) =
when hasThreadSupport:
var
tempFrames: array [0..127, PFrame] # but better than a threadvar
tempFrames: array[0..127, PFrame] # but better than a threadvar
const
firstCalls = 32
var
@@ -250,7 +250,7 @@ proc raiseExceptionAux(e: ref Exception) =
inc L, slen
template add(buf, s: expr) =
xadd(buf, s, s.len)
var buf: array [0..2000, char]
var buf: array[0..2000, char]
var L = 0
add(buf, "Error: unhandled exception: ")
if not isNil(e.msg): add(buf, e.msg)

View File

@@ -239,7 +239,7 @@ else:
# We use a jmp_buf buffer that is in the C stack.
# Used to traverse the stack and registers assuming
# that 'setjmp' will save registers in the C stack.
type PStackSlice = ptr array [0..7, pointer]
type PStackSlice = ptr array[0..7, pointer]
var registers {.noinit.}: Registers
getRegisters(registers)
for i in registers.low .. registers.high:
@@ -277,7 +277,7 @@ else:
# We use a jmp_buf buffer that is in the C stack.
# Used to traverse the stack and registers assuming
# that 'setjmp' will save registers in the C stack.
type PStackSlice = ptr array [0..7, pointer]
type PStackSlice = ptr array[0..7, pointer]
var registers {.noinit.}: C_JmpBuf
if c_setjmp(registers) == 0'i32: # To fill the C stack with registers.
var max = cast[ByteAddress](gch.stackBottom)

View File

@@ -71,7 +71,7 @@ type
typ: ptr TNimType
name: cstring
len: int
sons: ptr array [0..0x7fff, ptr TNimNode]
sons: ptr array[0..0x7fff, ptr TNimNode]
TNimTypeFlag = enum
ntfNoRefs = 0, # type contains no tyRef, tySequence, tyString

View File

@@ -65,7 +65,7 @@ proc auxWriteStackTrace(f: PCallFrame): string =
it = f
i = 0
total = 0
tempFrames: array [0..63, TempFrame]
tempFrames: array[0..63, TempFrame]
while it != nil and i <= high(tempFrames):
tempFrames[i].procname = it.procname
tempFrames[i].line = it.line

View File

@@ -19,7 +19,7 @@ const
MaxTraceLen = 20 # tracking the last 20 calls is enough
type
StackTrace* = array [0..MaxTraceLen-1, cstring]
StackTrace* = array[0..MaxTraceLen-1, cstring]
ProfilerHook* = proc (st: StackTrace) {.nimcall.}
{.deprecated: [TStackTrace: StackTrace, TProfilerHook: ProfilerHook].}

View File

@@ -16,7 +16,7 @@ proc reprInt(x: int64): string {.compilerproc.} = return $x
proc reprFloat(x: float): string {.compilerproc.} = return $x
proc reprPointer(x: pointer): string {.compilerproc.} =
var buf: array [0..59, char]
var buf: array[0..59, char]
discard c_sprintf(buf, "%p", x)
return $buf
@@ -24,7 +24,7 @@ proc `$`(x: uint64): string =
if x == 0:
result = "0"
else:
var buf: array [60, char]
var buf: array[60, char]
var i = 0
var n = x
while n != 0:

View File

@@ -10,7 +10,7 @@
# set handling
type
NimSet = array [0..4*2048-1, uint8]
NimSet = array[0..4*2048-1, uint8]
{.deprecated: [TNimSet: NimSet].}
proc countBits32(n: int32): int {.compilerproc.} =

View File

@@ -271,7 +271,7 @@ else:
importc: "freopen", nodecl.}
const
FormatOpen: array [FileMode, string] = ["rb", "wb", "w+b", "r+b", "ab"]
FormatOpen: array[FileMode, string] = ["rb", "wb", "w+b", "r+b", "ab"]
#"rt", "wt", "w+t", "r+t", "at"
# we always use binary here as for Nim the OS line ending
# should not be translated.

View File

@@ -24,7 +24,7 @@
## import locks
##
## var
## thr: array [0..4, Thread[tuple[a,b: int]]]
## thr: array[0..4, Thread[tuple[a,b: int]]]
## L: Lock
##
## proc threadFunc(interval: tuple[a,b: int]) {.thread.} =
@@ -198,7 +198,7 @@ when emulatedThreadVars:
# allocations are needed. Currently less than 7K are used on a 64bit machine.
# We use ``float`` for proper alignment:
type
ThreadLocalStorage = array [0..1_000, float]
ThreadLocalStorage = array[0..1_000, float]
PGcThread = ptr GcThread
GcThread {.pure, inheritable.} = object