Skip to content

Commit

Permalink
ic support
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed May 5, 2021
1 parent ff5afbb commit 0e94075
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
12 changes: 10 additions & 2 deletions compiler/ic/ic.nim
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,15 @@ proc storeSym*(s: PSym; c: var PackedEncoder; m: var PackedModule): PackedItemId
storeNode(p, s, ast)
storeNode(p, s, constraint)

if s.kind in {skLet, skVar, skField, skForVar}:
case s.kind
of {skLet, skVar, skField, skForVar}:
c.addMissing s.guard
p.guard = s.guard.safeItemId(c, m)
p.bitsize = s.bitsize
p.alignment = s.alignment
of skModule:
p.realModule = s.realModule.safeItemId(c, m)
else: discard

p.externalName = toLitId(if s.loc.r.isNil: "" else: $s.loc.r, m)
p.locFlags = s.loc.flags
Expand Down Expand Up @@ -847,10 +851,14 @@ proc symBodyFromPacked(c: var PackedDecoder; g: var PackedModuleGraph;
when hasFFI:
result.cname = g[si].fromDisk.strings[s.cname]

if s.kind in {skLet, skVar, skField, skForVar}:
case s.kind
of {skLet, skVar, skField, skForVar}:
result.guard = loadSym(c, g, si, s.guard)
result.bitsize = s.bitsize
result.alignment = s.alignment
of skModule:
result.realModule = loadSym(c, g, si, s.realModule)
else: discard
result.owner = loadSym(c, g, si, s.owner)
let externalName = g[si].fromDisk.strings[s.externalName]
if externalName != "":
Expand Down
1 change: 1 addition & 0 deletions compiler/ic/packed_ast.nim
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type
when hasFFI:
cname*: LitId
constraint*: NodeId
realModule*: PackedItemId

PackedType* = object
kind*: TTypeKind
Expand Down
1 change: 1 addition & 0 deletions testament/categories.nim
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ proc icTests(r: var TResults; testsDir: string, cat: Category, options: string;

const tempExt = "_temp.nim"
for it in walkDirRec(testsDir):
# for it in ["tests/ic/timports.nim"]: # debugging: to try a specific test
if isTestFile(it) and not it.endsWith(tempExt):
let nimcache = nimcacheDir(it, options, getTestSpecTarget())
removeDir(nimcache)
Expand Down

0 comments on commit 0e94075

Please sign in to comment.