Skip to content

Commit

Permalink
Update compiler/modules/importer.nim
Browse files Browse the repository at this point in the history
Co-authored-by: zerbina <100542850+zerbina@users.noreply.github.com>
  • Loading branch information
saem and zerbina authored Aug 24, 2024
1 parent b1bae64 commit 8fcb356
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions compiler/modules/importer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -378,25 +378,15 @@ proc evalImport*(c: PContext, n: PNode): PNode =

for it in n.sons:
if it.kind == nkPrefix and it.len == 2 and it[1].kind == nkBracket:
let
sep = it[0]
impTmpl =
block:
let t = newNodeI(nkPrefix, it.info, 2)
t[0] = sep
t
## `impTmpl` is copied/instanced in a loop below including setting
## the second child

for x in it[1]:
let imp = copyTree(impTmpl)

# transform `./[a as b] to `./a as b`
imp[1] =
for x in it[1].items:
let imp = newTreeI(nkPrefix, it.info,
it[0],
# transform `./[a as b] to `./a as b`
if x.kind == nkInfix and x[0].ident.s == "as":
x[1]
else:
x
)

hasError = impMod(c, imp, x.info, result).kind == nkError or hasError
elif it.kind == nkInfix and it.len == 3 and it[2].kind == nkBracket:
Expand Down

0 comments on commit 8fcb356

Please sign in to comment.