diff options
author | Araq <rumpf_a@web.de> | 2014-04-01 16:35:50 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-04-01 16:35:50 +0200 |
commit | befdce51b44408e7e29e5ca78441f7b223f67bf8 (patch) | |
tree | 067b4d80da8257d37dc0c6b257a70f6208d512bd /compiler/vmgen.nim | |
parent | dc2b21e9b2a15e301b40546ecd792b6bba4d75f4 (diff) | |
download | Nim-befdce51b44408e7e29e5ca78441f7b223f67bf8.tar.gz |
fixed another vm bug
Diffstat (limited to 'compiler/vmgen.nim')
-rw-r--r-- | compiler/vmgen.nim | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim index 3c0f8dbc9..85416f7bc 100644 --- a/compiler/vmgen.nim +++ b/compiler/vmgen.nim @@ -328,6 +328,7 @@ proc canonValue*(n: PNode): PNode = proc rawGenLiteral(c: PCtx; n: PNode): int = result = c.constants.len + assert(n.kind != nkCall) c.constants.add n.canonValue internalAssert result < 0x7fff @@ -1285,16 +1286,13 @@ proc genVarSection(c: PCtx; n: PNode) = if s.position == 0: if sfImportc in s.flags: c.importcSym(a.info, s) else: - let sa = if s.ast.isNil: getNullValue(s.typ, a.info) - else: canonValue(s.ast) + let sa = getNullValue(s.typ, a.info) + #if s.ast.isNil: getNullValue(s.typ, a.info) + #else: canonValue(s.ast) + assert sa.kind != nkCall c.globals.add(sa) s.position = c.globals.len - if a.sons[2].kind == nkEmpty: - when false: - withTemp(tmp, s.typ): - c.gABx(a, opcLdNull, tmp, c.genType(s.typ)) - c.gABx(a, whichAsgnOpc(a.sons[0], opcWrGlobal), tmp, s.position) - else: + if a.sons[2].kind != nkEmpty: let tmp = c.genx(a.sons[0], {gfAddrOf}) let val = c.genx(a.sons[2]) c.gABC(a, opcWrDeref, tmp, val) |