remove sfFakeConst
This commit is contained in:
parent
a8edf67a28
commit
7d62f031f6
5 changed files with 4 additions and 16 deletions
|
|
@ -271,7 +271,6 @@ type
|
||||||
TSymFlags* = set[TSymFlag]
|
TSymFlags* = set[TSymFlag]
|
||||||
|
|
||||||
const
|
const
|
||||||
sfFakeConst* = sfDeadCodeElim # const cannot be put into a data section
|
|
||||||
sfDispatcher* = sfDeadCodeElim # copied method symbol is the dispatcher
|
sfDispatcher* = sfDeadCodeElim # copied method symbol is the dispatcher
|
||||||
sfNoInit* = sfMainModule # don't generate code to init the variable
|
sfNoInit* = sfMainModule # don't generate code to init the variable
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2003,10 +2003,7 @@ proc expr(p: BProc, n: PNode, d: var TLoc) =
|
||||||
internalError(n.info, "expr: proc not init " & sym.name.s)
|
internalError(n.info, "expr: proc not init " & sym.name.s)
|
||||||
putLocIntoDest(p, d, sym.loc)
|
putLocIntoDest(p, d, sym.loc)
|
||||||
of skConst:
|
of skConst:
|
||||||
if sfFakeConst in sym.flags:
|
if isSimpleConst(sym.typ):
|
||||||
if sfGlobal in sym.flags: genVarPrototype(p.module, sym)
|
|
||||||
putLocIntoDest(p, d, sym.loc)
|
|
||||||
elif isSimpleConst(sym.typ):
|
|
||||||
putIntoDest(p, d, n.typ, genLiteral(p, sym.ast, sym.typ), OnStatic)
|
putIntoDest(p, d, n.typ, genLiteral(p, sym.ast, sym.typ), OnStatic)
|
||||||
else:
|
else:
|
||||||
genComplexConst(p, sym, d)
|
genComplexConst(p, sym, d)
|
||||||
|
|
|
||||||
|
|
@ -269,8 +269,6 @@ proc genConstStmt(p: BProc, t: PNode) =
|
||||||
if it.kind != nkConstDef: internalError(t.info, "genConstStmt")
|
if it.kind != nkConstDef: internalError(t.info, "genConstStmt")
|
||||||
var c = it.sons[0].sym
|
var c = it.sons[0].sym
|
||||||
if c.typ.containsCompileTimeOnly: continue
|
if c.typ.containsCompileTimeOnly: continue
|
||||||
if sfFakeConst in c.flags:
|
|
||||||
genSingleVar(p, it)
|
|
||||||
elif c.typ.kind in ConstantDataTypes and lfNoDecl notin c.loc.flags and
|
elif c.typ.kind in ConstantDataTypes and lfNoDecl notin c.loc.flags and
|
||||||
c.ast.len != 0:
|
c.ast.len != 0:
|
||||||
if not emitLazily(c): requestConstImpl(p, c)
|
if not emitLazily(c): requestConstImpl(p, c)
|
||||||
|
|
|
||||||
|
|
@ -648,7 +648,7 @@ proc getConstExpr(m: PSym, n: PNode): PNode =
|
||||||
if isDefined(s.name):
|
if isDefined(s.name):
|
||||||
result = newStrNodeT(lookupSymbol(s.name), n)
|
result = newStrNodeT(lookupSymbol(s.name), n)
|
||||||
else:
|
else:
|
||||||
if sfFakeConst notin s.flags: result = copyTree(s.ast)
|
result = copyTree(s.ast)
|
||||||
of {skProc, skMethod}:
|
of {skProc, skMethod}:
|
||||||
result = n
|
result = n
|
||||||
of skType:
|
of skType:
|
||||||
|
|
|
||||||
|
|
@ -204,14 +204,8 @@ proc transformConstSection(c: PTransf, v: PNode): PTransNode =
|
||||||
if it.kind != nkConstDef: internalError(it.info, "transformConstSection")
|
if it.kind != nkConstDef: internalError(it.info, "transformConstSection")
|
||||||
if it.sons[0].kind != nkSym:
|
if it.sons[0].kind != nkSym:
|
||||||
internalError(it.info, "transformConstSection")
|
internalError(it.info, "transformConstSection")
|
||||||
if sfFakeConst in it[0].sym.flags:
|
|
||||||
var b = newNodeI(nkConstDef, it.info)
|
result[i] = PTransNode(it)
|
||||||
addSon(b, it[0])
|
|
||||||
addSon(b, ast.emptyNode) # no type description
|
|
||||||
addSon(b, transform(c, it[2]).PNode)
|
|
||||||
result[i] = PTransNode(b)
|
|
||||||
else:
|
|
||||||
result[i] = PTransNode(it)
|
|
||||||
|
|
||||||
proc hasContinue(n: PNode): bool =
|
proc hasContinue(n: PNode): bool =
|
||||||
case n.kind
|
case n.kind
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue