Merge pull request #1436 from def-/fix-1427
Set kind of literal nodes as resExpr
This commit is contained in:
commit
29277f8acf
1 changed files with 4 additions and 0 deletions
|
|
@ -1532,6 +1532,7 @@ proc gen(p: PProc, n: PNode, r: var TCompRes) =
|
||||||
genSym(p, n, r)
|
genSym(p, n, r)
|
||||||
of nkCharLit..nkInt64Lit:
|
of nkCharLit..nkInt64Lit:
|
||||||
r.res = toRope(n.intVal)
|
r.res = toRope(n.intVal)
|
||||||
|
r.kind = resExpr
|
||||||
of nkNilLit:
|
of nkNilLit:
|
||||||
if isEmptyType(n.typ):
|
if isEmptyType(n.typ):
|
||||||
discard
|
discard
|
||||||
|
|
@ -1539,8 +1540,10 @@ proc gen(p: PProc, n: PNode, r: var TCompRes) =
|
||||||
r.typ = etyBaseIndex
|
r.typ = etyBaseIndex
|
||||||
r.address = toRope"null" | toRope"nil"
|
r.address = toRope"null" | toRope"nil"
|
||||||
r.res = toRope"0"
|
r.res = toRope"0"
|
||||||
|
r.kind = resExpr
|
||||||
else:
|
else:
|
||||||
r.res = toRope"null" | toRope"nil"
|
r.res = toRope"null" | toRope"nil"
|
||||||
|
r.kind = resExpr
|
||||||
of nkStrLit..nkTripleStrLit:
|
of nkStrLit..nkTripleStrLit:
|
||||||
if skipTypes(n.typ, abstractVarRange).kind == tyString:
|
if skipTypes(n.typ, abstractVarRange).kind == tyString:
|
||||||
useMagic(p, "cstrToNimstr")
|
useMagic(p, "cstrToNimstr")
|
||||||
|
|
@ -1556,6 +1559,7 @@ proc gen(p: PProc, n: PNode, r: var TCompRes) =
|
||||||
if f > 0.0: r.res = toRope"Infinity"
|
if f > 0.0: r.res = toRope"Infinity"
|
||||||
else: r.res = toRope"-Infinity"
|
else: r.res = toRope"-Infinity"
|
||||||
else: r.res = toRope(f.toStrMaxPrecision)
|
else: r.res = toRope(f.toStrMaxPrecision)
|
||||||
|
r.kind = resExpr
|
||||||
of nkCallKinds:
|
of nkCallKinds:
|
||||||
if (n.sons[0].kind == nkSym) and (n.sons[0].sym.magic != mNone):
|
if (n.sons[0].kind == nkSym) and (n.sons[0].sym.magic != mNone):
|
||||||
genMagic(p, n, r)
|
genMagic(p, n, r)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue