more tests work

This commit is contained in:
Araq
2013-12-13 21:29:35 +01:00
parent 8c553fa8a2
commit f095e51275
3 changed files with 10 additions and 5 deletions

View File

@@ -802,9 +802,8 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): PNode =
decodeB(nkIntLit)
regs[ra].intVal = ord(regs[rb].skipMeta.kind == nkNilLit)
of opcNBindSym:
# trivial implementation:
decodeB(nkMetaNode)
setMeta(regs[ra], regs[rb].skipMeta.sons[1])
decodeBx(nkMetaNode)
setMeta(regs[ra], copyTree(c.constants.sons[rbx]))
of opcNChild:
decodeBC(nkMetaNode)
if regs[rb].kind != nkMetaNode:

View File

@@ -101,7 +101,6 @@ type
opcRaise,
opcNChild,
opcNSetChild,
opcNBindSym, # opcodes for the AST manipulation following
opcCallSite,
opcNewStr,
@@ -120,6 +119,7 @@ type
opcAsgnConst, # dest = copy(constants[Bx])
opcLdGlobal, # dest = globals[Bx]
opcLdImmInt, # dest = immediate value
opcNBindSym,
opcWrGlobal,
opcWrGlobalRef,
opcGlobalAlias, # load an alias to a global into a register

View File

@@ -781,7 +781,13 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest) =
of mNNewNimNode: genBinaryABC(c, n, dest, opcNNewNimNode)
of mNCopyNimNode: genUnaryABC(c, n, dest, opcNCopyNimNode)
of mNCopyNimTree: genUnaryABC(c, n, dest, opcNCopyNimTree)
of mNBindSym: genUnaryABC(c, n, dest, opcNBindSym)
of mNBindSym:
if n[1].kind in {nkClosedSymChoice, nkOpenSymChoice, nkSym}:
let idx = c.genLiteral(n[1])
if dest < 0: dest = c.getTemp(n.typ)
c.gABx(n, opcNBindSym, dest, idx)
else:
internalError(n.info, "invalid bindSym usage")
of mStrToIdent: genUnaryABC(c, n, dest, opcStrToIdent)
of mIdentToStr: genUnaryABC(c, n, dest, opcIdentToStr)
of mEqIdent: genBinaryABC(c, n, dest, opcEqIdent)