VM regression fixes (#8146)
This commit is contained in:
parent
64c84a7d11
commit
ae69e571e1
2 changed files with 34 additions and 2 deletions
|
|
@ -209,7 +209,7 @@ proc writeField(n: var PNode, x: TFullReg) =
|
||||||
of rkNone: discard
|
of rkNone: discard
|
||||||
of rkInt: n.intVal = x.intVal
|
of rkInt: n.intVal = x.intVal
|
||||||
of rkFloat: n.floatVal = x.floatVal
|
of rkFloat: n.floatVal = x.floatVal
|
||||||
of rkNode: n = x.node
|
of rkNode: n = copyValue(x.node)
|
||||||
of rkRegisterAddr: writeField(n, x.regAddr[])
|
of rkRegisterAddr: writeField(n, x.regAddr[])
|
||||||
of rkNodeAddr: n = x.nodeAddr[]
|
of rkNodeAddr: n = x.nodeAddr[]
|
||||||
|
|
||||||
|
|
@ -912,6 +912,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
if a.kind == nkSym:
|
if a.kind == nkSym:
|
||||||
regs[ra].node = if a.sym.ast.isNil: newNode(nkNilLit)
|
regs[ra].node = if a.sym.ast.isNil: newNode(nkNilLit)
|
||||||
else: copyTree(a.sym.ast)
|
else: copyTree(a.sym.ast)
|
||||||
|
regs[ra].node.flags.incl nfIsRef
|
||||||
else:
|
else:
|
||||||
stackTrace(c, tos, pc, "node is not a symbol")
|
stackTrace(c, tos, pc, "node is not a symbol")
|
||||||
of opcEcho:
|
of opcEcho:
|
||||||
|
|
@ -1462,6 +1463,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
else:
|
else:
|
||||||
regs[ra].node = newNodeI(nkIdent, c.debug[pc])
|
regs[ra].node = newNodeI(nkIdent, c.debug[pc])
|
||||||
regs[ra].node.ident = getIdent(c.cache, regs[rb].node.strVal)
|
regs[ra].node.ident = getIdent(c.cache, regs[rb].node.strVal)
|
||||||
|
regs[ra].node.flags.incl nfIsRef
|
||||||
of opcSetType:
|
of opcSetType:
|
||||||
if regs[ra].kind != rkNode:
|
if regs[ra].kind != rkNode:
|
||||||
internalError(c.config, c.debug[pc], "cannot set type")
|
internalError(c.config, c.debug[pc], "cannot set type")
|
||||||
|
|
|
||||||
|
|
@ -90,3 +90,33 @@ block:
|
||||||
var some = newStringOfCap(size)
|
var some = newStringOfCap(size)
|
||||||
result = size
|
result = size
|
||||||
doAssert f(4) == 4
|
doAssert f(4) == 4
|
||||||
|
|
||||||
|
# #7871
|
||||||
|
static:
|
||||||
|
type Obj = object
|
||||||
|
field: int
|
||||||
|
var s = newSeq[Obj](1)
|
||||||
|
var o = Obj()
|
||||||
|
s[0] = o
|
||||||
|
o.field = 2
|
||||||
|
doAssert s[0].field == 0
|
||||||
|
|
||||||
|
# #8125
|
||||||
|
static:
|
||||||
|
let def_iter_var = ident("it")
|
||||||
|
|
||||||
|
# #8142
|
||||||
|
static:
|
||||||
|
type Obj = object
|
||||||
|
names: string
|
||||||
|
|
||||||
|
proc pushName(o: var Obj) =
|
||||||
|
var s = ""
|
||||||
|
s.add("FOOBAR")
|
||||||
|
o.names.add(s)
|
||||||
|
|
||||||
|
var o = Obj()
|
||||||
|
o.names = ""
|
||||||
|
o.pushName()
|
||||||
|
o.pushName()
|
||||||
|
doAssert o.names == "FOOBARFOOBAR"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue