'using' statement is obsolete

This commit is contained in:
Andreas Rumpf
2016-02-28 14:48:15 +01:00
parent 1afdefcbe9
commit 7ae45ea420
3 changed files with 1 additions and 21 deletions

View File

@@ -754,7 +754,6 @@ type
TScope* = object
depthLevel*: int
symbols*: TStrTable
usingSyms*: seq[PNode]
parent*: PScope
PScope* = ref TScope

View File

@@ -143,11 +143,6 @@ proc notFoundError*(c: PContext, n: PNode, errors: CandidateErrors) =
else:
localError(n.info, errGenerated, result)
proc gatherUsedSyms(c: PContext, usedSyms: var seq[PNode]) =
for scope in walkScopes(c.currentScope):
if scope.usingSyms != nil:
for s in scope.usingSyms: usedSyms.safeAdd(s)
proc resolveOverloads(c: PContext, n, orig: PNode,
filter: TSymKinds;
errors: var CandidateErrors): TCandidate =

View File

@@ -1558,21 +1558,7 @@ proc newAnonSym(kind: TSymKind, info: TLineInfo,
proc semUsing(c: PContext, n: PNode): PNode =
result = newNodeI(nkEmpty, n.info)
if not experimentalMode(c):
localError(n.info, "use the {.experimental.} pragma to enable 'using'")
for e in n.sons:
let usedSym = semExpr(c, e)
if usedSym.kind == nkSym:
case usedSym.sym.kind
of skLocalVars + {skConst}:
c.currentScope.usingSyms.safeAdd(usedSym)
continue
of skProcKinds:
addDeclAt(c.currentScope, usedSym.sym)
continue
else: discard
localError(e.info, errUsingNoSymbol, e.renderTree)
localError(n.info, "'using' statement is obsolete")
proc semExpandToAst(c: PContext, n: PNode): PNode =
var macroCall = n[1]