diff options
author | Araq <rumpf_a@web.de> | 2018-08-05 14:17:24 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2018-08-05 14:17:24 +0200 |
commit | 7ac6462cbd30bcdb1c3805fbb06be13b3346ce2a (patch) | |
tree | 2e79c210ccd19a7065b36992e19ab74ff061f5df /compiler/semexprs.nim | |
parent | 282c4f3d0a72fbb4c49df51048e2e13fafcd8659 (diff) | |
parent | 74842ed4a981b6ff168d67d05ee92dce350549cb (diff) | |
download | Nim-7ac6462cbd30bcdb1c3805fbb06be13b3346ce2a.tar.gz |
make at least bootstrapping work
Diffstat (limited to 'compiler/semexprs.nim')
-rw-r--r-- | compiler/semexprs.nim | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 3a72d1f5a..c9f9eb33f 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -2031,9 +2031,10 @@ proc semMagic(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode = c.runnableExamples = newTree(nkStmtList, newTree(nkImportStmt, newStrNode(nkStrLit, expandFilename(inp)))) let imports = newTree(nkStmtList) - extractImports(n.lastSon, imports) + var saved_lastSon = copyTree n.lastSon + extractImports(saved_lastSon, imports) for imp in imports: c.runnableExamples.add imp - c.runnableExamples.add newTree(nkBlockStmt, c.graph.emptyNode, copyTree n.lastSon) + c.runnableExamples.add newTree(nkBlockStmt, c.graph.emptyNode, copyTree saved_lastSon) result = setMs(n, s) else: result = c.graph.emptyNode @@ -2126,7 +2127,7 @@ proc semSetConstr(c: PContext, n: PNode): PNode = n.sons[i] = semExprWithType(c, n.sons[i]) if typ == nil: typ = skipTypes(n.sons[i].typ, {tyGenericInst, tyVar, tyLent, tyOrdinal, tyAlias, tySink}) - if not isOrdinalType(typ): + if not isOrdinalType(typ, allowEnumWithHoles=true): localError(c.config, n.info, errOrdinalTypeExpected) typ = makeRangeType(c, 0, MaxSetElements-1, n.info) elif lengthOrd(c.config, typ) > MaxSetElements: |