diff options
Diffstat (limited to 'compiler/sem.nim')
-rw-r--r-- | compiler/sem.nim | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/compiler/sem.nim b/compiler/sem.nim index 0d336724c..924e53b66 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -16,13 +16,16 @@ import procfind, lookups, pragmas, passes, semdata, semtypinst, sigmatch, intsets, transf, vmdef, vm, idgen, aliases, cgmeth, lambdalifting, evaltempl, patterns, parampatterns, sempass2, linter, semmacrosanity, - semparallel, lowerings, pluginsupport, plugins/active, rod, lineinfos + lowerings, pluginsupport, plugins/active, rod, lineinfos -from modulegraphs import ModuleGraph, PPassContext +from modulegraphs import ModuleGraph, PPassContext, onUse, onDef, onDefResolveForward when defined(nimfix): import nimfix/prettybase +when not defined(leanCompiler): + import semparallel + # implementation proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode {.procvar.} @@ -201,7 +204,7 @@ proc newSymG*(kind: TSymKind, n: PNode, c: PContext): PSym = if n.kind == nkSym: # and sfGenSym in n.sym.flags: result = n.sym - if result.kind != kind: + if result.kind notin {kind, skTemp}: localError(c.config, n.info, "cannot use symbol of kind '" & $result.kind & "' as a '" & $kind & "'") if sfGenSym in result.flags and result.kind notin {skTemplate, skMacro, skParam}: @@ -447,7 +450,7 @@ proc semMacroExpr(c: PContext, n, nOrig: PNode, sym: PSym, pushInfoContext(c.config, nOrig.info, sym.detailedInfo) markUsed(c.config, n.info, sym, c.graph.usageSym) - styleCheckUse(n.info, sym) + onUse(n.info, sym) if sym == c.p.owner: globalError(c.config, n.info, "recursive dependency: '$1'" % sym.name.s) @@ -583,7 +586,7 @@ proc semStmtAndGenerateGenerics(c: PContext, n: PNode): PNode = result = buildEchoStmt(c, result) if c.config.cmd == cmdIdeTools: appendToModule(c.module, result) - result = transformStmt(c.graph, c.module, result) + trackTopLevelStmt(c.graph, c.module, result) proc recoverContext(c: PContext) = # clean up in case of a semantic error: We clean up the stacks, etc. This is |