From 51de44be7954a1c3f3499c5a2a6adcaceec33e3f Mon Sep 17 00:00:00 2001 From: def Date: Mon, 18 May 2015 21:31:24 +0200 Subject: [PATCH 1/2] Make intVal work for uint literals in the VM --- compiler/vm.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/vm.nim b/compiler/vm.nim index 1c6c9a30b0..560c38d144 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -1121,7 +1121,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg = decodeB(rkInt) let a = regs[rb].node case a.kind - of nkCharLit..nkInt64Lit: regs[ra].intVal = a.intVal + of nkCharLit..nkUInt64Lit: regs[ra].intVal = a.intVal else: stackTrace(c, tos, pc, errFieldXNotFound, "intVal") of opcNFloatVal: decodeB(rkFloat) From 2076e14a09ea9eb03fd389e1124a7c1847b7d584 Mon Sep 17 00:00:00 2001 From: def Date: Mon, 18 May 2015 21:32:29 +0200 Subject: [PATCH 2/2] Update ast spec about uint literals --- compiler/vm.nim | 2 +- doc/astspec.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/vm.nim b/compiler/vm.nim index 560c38d144..e49bed522b 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -1276,7 +1276,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg = of opcNSetIntVal: decodeB(rkNode) var dest = regs[ra].node - if dest.kind in {nkCharLit..nkInt64Lit} and + if dest.kind in {nkCharLit..nkUInt64Lit} and regs[rb].kind in {rkInt}: dest.intVal = regs[rb].intVal else: diff --git a/doc/astspec.txt b/doc/astspec.txt index 4c27272e2b..68bb9f1cd6 100644 --- a/doc/astspec.txt +++ b/doc/astspec.txt @@ -23,7 +23,7 @@ contains: case kind: NimNodeKind ## the node's kind of nnkNone, nnkEmpty, nnkNilLit: discard ## node contains no additional fields - of nnkCharLit..nnkInt64Lit: + of nnkCharLit..nnkUInt64Lit: intVal: biggestInt ## the int literal of nnkFloatLit..nnkFloat64Lit: floatVal: biggestFloat ## the float literal