IC: next steps (#16550)
* cleanups * ast.nim: cleanups * IC: no more sym.tab field, stored externally in the module graph * nimble compiles again * rodfiles: store bitwidth of integers and the endianness in the cookie because we serialize 'int' directly * rodfiles: added compilerproc and export sections * rodfiles: added all the missing sections * rodfiles: track the missing information * IC: architecture for lazy loading of proc bodies * make tests green again * completed the lazy loading of proc bodies * symbol lookup integration, part 1 * symbol lookup integration, part 2 * symbol lookup integration, part 3 * make tcompilerapi work again * rodfiles: fixed config change handling
This commit is contained in:
parent
0da4cb93d1
commit
796498525a
36 changed files with 653 additions and 400 deletions
|
|
@ -1014,7 +1014,7 @@ proc semDirectOp(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
|||
proc buildEchoStmt(c: PContext, n: PNode): PNode =
|
||||
# we MUST not check 'n' for semantics again here! But for now we give up:
|
||||
result = newNodeI(nkCall, n.info)
|
||||
var e = strTableGet(c.graph.systemModule.tab, getIdent(c.cache, "echo"))
|
||||
let e = systemModuleSym(c.graph, getIdent(c.cache, "echo"))
|
||||
if e != nil:
|
||||
result.add(newSymNode(e))
|
||||
else:
|
||||
|
|
@ -1897,7 +1897,7 @@ proc lookUpForDeclared(c: PContext, n: PNode, onlyCurrentScope: bool): PSym =
|
|||
if m == c.module:
|
||||
result = strTableGet(c.topLevelScope.symbols, ident)
|
||||
else:
|
||||
result = strTableGet(m.tab, ident)
|
||||
result = someSym(c.graph, m, ident)
|
||||
of nkSym:
|
||||
result = n.sym
|
||||
of nkOpenSymChoice, nkClosedSymChoice:
|
||||
|
|
@ -2504,7 +2504,7 @@ proc semBlock(c: PContext, n: PNode; flags: TExprFlags): PNode =
|
|||
elif labl.owner == nil:
|
||||
labl.owner = c.p.owner
|
||||
n[0] = newSymNode(labl, n[0].info)
|
||||
suggestSym(c.config, n[0].info, labl, c.graph.usageSym)
|
||||
suggestSym(c.graph, n[0].info, labl, c.graph.usageSym)
|
||||
styleCheckDef(c.config, labl)
|
||||
onDef(n[0].info, labl)
|
||||
n[1] = semExpr(c, n[1], flags)
|
||||
|
|
@ -2522,15 +2522,12 @@ proc semExportExcept(c: PContext, n: PNode): PNode =
|
|||
let exceptSet = readExceptSet(c, n)
|
||||
let exported = moduleName.sym
|
||||
result = newNodeI(nkExportStmt, n.info)
|
||||
strTableAdd(c.module.tab, exported)
|
||||
var i: TTabIter
|
||||
var s = initTabIter(i, exported.tab)
|
||||
while s != nil:
|
||||
reexportSym(c, exported)
|
||||
for s in allSyms(c.graph, exported):
|
||||
if s.kind in ExportableSymKinds+{skModule} and
|
||||
s.name.id notin exceptSet and sfError notin s.flags:
|
||||
strTableAdd(c.module.tab, s)
|
||||
reexportSym(c, s)
|
||||
result.add newSymNode(s, n.info)
|
||||
s = nextIter(i, exported.tab)
|
||||
markUsed(c, n.info, exported)
|
||||
|
||||
proc semExport(c: PContext, n: PNode): PNode =
|
||||
|
|
@ -2548,15 +2545,12 @@ proc semExport(c: PContext, n: PNode): PNode =
|
|||
localError(c.config, a.info, errGenerated, "cannot export: " & renderTree(a))
|
||||
elif s.kind == skModule:
|
||||
# forward everything from that module:
|
||||
strTableAdd(c.module.tab, s)
|
||||
var ti: TTabIter
|
||||
var it = initTabIter(ti, s.tab)
|
||||
while it != nil:
|
||||
reexportSym(c, s)
|
||||
for it in allSyms(c.graph, s):
|
||||
if it.kind in ExportableSymKinds+{skModule}:
|
||||
strTableAdd(c.module.tab, it)
|
||||
reexportSym(c, it)
|
||||
result.add newSymNode(it, a.info)
|
||||
specialSyms(c, it)
|
||||
it = nextIter(ti, s.tab)
|
||||
markUsed(c, n.info, s)
|
||||
else:
|
||||
while s != nil:
|
||||
|
|
@ -2565,7 +2559,7 @@ proc semExport(c: PContext, n: PNode): PNode =
|
|||
"; enum field cannot be exported individually")
|
||||
if s.kind in ExportableSymKinds+{skModule} and sfError notin s.flags:
|
||||
result.add(newSymNode(s, a.info))
|
||||
strTableAdd(c.module.tab, s)
|
||||
reexportSym(c, s)
|
||||
markUsed(c, n.info, s)
|
||||
specialSyms(c, s)
|
||||
if s.kind == skType and sfPure notin s.flags:
|
||||
|
|
@ -2575,7 +2569,7 @@ proc semExport(c: PContext, n: PNode): PNode =
|
|||
var e = etyp.n[j].sym
|
||||
if e.kind != skEnumField:
|
||||
internalError(c.config, s.info, "rawImportSymbol")
|
||||
strTableAdd(c.module.tab, e)
|
||||
reexportSym(c, e)
|
||||
|
||||
s = nextOverloadIter(o, c, a)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue