diff options
author | Parashurama <Rhagdamaziel@ymail.com> | 2017-09-15 13:35:57 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-09-15 13:35:57 +0200 |
commit | 88a5e9d88ccc0a48daa2710e88d2efb8a7ae6468 (patch) | |
tree | fc9a16fad9b80cf34257d286e90f003f22630ae9 /compiler/vmdef.nim | |
parent | 71b1377be918e10e9a279764747adbab73310688 (diff) | |
download | Nim-88a5e9d88ccc0a48daa2710e88d2efb8a7ae6468.tar.gz |
Fix operations on string as openarray in VM. (#6257)
* fix openarray.len for string as openArray in VM. * fix openarray[idx] for string as openArray in VM. * fix openarray[idx]=val for string as openArray in VM. * add tests for passing string as openArray in VM. * fix issue with NimNode.len NimNode.len was also returning len for string literals. also fix logic bug in if/elif chain.
Diffstat (limited to 'compiler/vmdef.nim')
-rw-r--r-- | compiler/vmdef.nim | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/vmdef.nim b/compiler/vmdef.nim index 7e1309e0a..5395d4bad 100644 --- a/compiler/vmdef.nim +++ b/compiler/vmdef.nim @@ -234,6 +234,9 @@ const slotSomeTemp* = slotTempUnknown relativeJumps* = {opcTJmp, opcFJmp, opcJmp, opcJmpBack} +# flag is used to signal opcSeqLen if node is NimNode. +const nimNodeFlag* = 16 + template opcode*(x: TInstr): TOpcode = TOpcode(x.uint32 and 0xff'u32) template regA*(x: TInstr): TRegister = TRegister(x.uint32 shr 8'u32 and 0xff'u32) template regB*(x: TInstr): TRegister = TRegister(x.uint32 shr 16'u32 and 0xff'u32) |