VM: repl supports global variables properly"
This commit is contained in:
parent
cd2fbb5f86
commit
cc934a1a1b
1 changed files with 3 additions and 3 deletions
|
|
@ -1183,7 +1183,7 @@ proc checkCanEval(c: PCtx; n: PNode) =
|
||||||
let s = n.sym
|
let s = n.sym
|
||||||
if {sfCompileTime, sfGlobal} <= s.flags: return
|
if {sfCompileTime, sfGlobal} <= s.flags: return
|
||||||
if s.kind in {skVar, skTemp, skLet, skParam, skResult} and
|
if s.kind in {skVar, skTemp, skLet, skParam, skResult} and
|
||||||
not s.isOwnedBy(c.prc.sym) and s.owner != c.module:
|
not s.isOwnedBy(c.prc.sym) and s.owner != c.module and c.mode != emRepl:
|
||||||
cannotEval(n)
|
cannotEval(n)
|
||||||
elif s.kind in {skProc, skConverter, skMethod,
|
elif s.kind in {skProc, skConverter, skMethod,
|
||||||
skIterator, skClosureIterator} and sfForward in s.flags:
|
skIterator, skClosureIterator} and sfForward in s.flags:
|
||||||
|
|
@ -1850,13 +1850,13 @@ proc genProc(c: PCtx; s: PSym): int =
|
||||||
c.prc = p
|
c.prc = p
|
||||||
# iterate over the parameters and allocate space for them:
|
# iterate over the parameters and allocate space for them:
|
||||||
genParams(c, s.typ.n)
|
genParams(c, s.typ.n)
|
||||||
|
|
||||||
# allocate additional space for any generically bound parameters
|
# allocate additional space for any generically bound parameters
|
||||||
if s.kind == skMacro and
|
if s.kind == skMacro and
|
||||||
sfImmediate notin s.flags and
|
sfImmediate notin s.flags and
|
||||||
s.ast[genericParamsPos].kind != nkEmpty:
|
s.ast[genericParamsPos].kind != nkEmpty:
|
||||||
genGenericParams(c, s.ast[genericParamsPos])
|
genGenericParams(c, s.ast[genericParamsPos])
|
||||||
|
|
||||||
if tfCapturesEnv in s.typ.flags:
|
if tfCapturesEnv in s.typ.flags:
|
||||||
#let env = s.ast.sons[paramsPos].lastSon.sym
|
#let env = s.ast.sons[paramsPos].lastSon.sym
|
||||||
#assert env.position == 2
|
#assert env.position == 2
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue