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
|
|
@ -24,11 +24,8 @@ type
|
|||
iterator exportedSymbols*(i: Interpreter): PSym =
|
||||
assert i != nil
|
||||
assert i.mainModule != nil, "no main module selected"
|
||||
var it: TTabIter
|
||||
var s = initTabIter(it, i.mainModule.tab)
|
||||
while s != nil:
|
||||
for s in modulegraphs.allSyms(i.graph, i.mainModule):
|
||||
yield s
|
||||
s = nextIter(it, i.mainModule.tab)
|
||||
|
||||
proc selectUniqueSymbol*(i: Interpreter; name: string;
|
||||
symKinds: set[TSymKind] = {skLet, skVar}): PSym =
|
||||
|
|
@ -37,14 +34,14 @@ proc selectUniqueSymbol*(i: Interpreter; name: string;
|
|||
assert i != nil
|
||||
assert i.mainModule != nil, "no main module selected"
|
||||
let n = getIdent(i.graph.cache, name)
|
||||
var it: TIdentIter
|
||||
var s = initIdentIter(it, i.mainModule.tab, n)
|
||||
var it: ModuleIter
|
||||
var s = initModuleIter(it, i.graph, i.mainModule, n)
|
||||
result = nil
|
||||
while s != nil:
|
||||
if s.kind in symKinds:
|
||||
if result == nil: result = s
|
||||
else: return nil # ambiguous
|
||||
s = nextIdentIter(it, i.mainModule.tab)
|
||||
s = nextModuleIter(it, i.graph)
|
||||
|
||||
proc selectRoutine*(i: Interpreter; name: string): PSym =
|
||||
## Selects a declared routine (proc/func/etc) from the main module.
|
||||
|
|
@ -70,7 +67,7 @@ proc evalScript*(i: Interpreter; scriptStream: PLLStream = nil) =
|
|||
## This can also be used to *reload* the script.
|
||||
assert i != nil
|
||||
assert i.mainModule != nil, "no main module selected"
|
||||
initStrTable(i.mainModule.tab)
|
||||
initStrTable(i.mainModule.semtab(i.graph))
|
||||
i.mainModule.ast = nil
|
||||
|
||||
let s = if scriptStream != nil: scriptStream
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue