diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-02-29 12:19:54 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-02-29 12:19:54 +0100 |
commit | c9966a3e178bc5bc21684d3f4f65c8580227d2f4 (patch) | |
tree | 577e3591910d082265e623830f6a269c58340411 /compiler/semstmts.nim | |
parent | 554a3e9335fddac4656a9313ab283ae0e4d14a9e (diff) | |
download | Nim-c9966a3e178bc5bc21684d3f4f65c8580227d2f4.tar.gz |
use 'using' instead of 'sig' keyword; cleans up new features a bit
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r-- | compiler/semstmts.nim | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 20bca4c90..5d16f2fba 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -386,8 +386,11 @@ proc isDiscardUnderscore(v: PSym): bool = v.flags.incl(sfGenSym) result = true -proc semSigSection(c: PContext; n: PNode): PNode = +proc semUsing(c: PContext; n: PNode): PNode = result = ast.emptyNode + if not isTopLevel(c): localError(n.info, errXOnlyAtModuleScope, "using") + if not experimentalMode(c): + localError(n.info, "use the {.experimental.} pragma to enable 'using'") for i in countup(0, sonsLen(n)-1): var a = n.sons[i] if gCmd == cmdIdeTools: suggestStmt(c, a) @@ -402,10 +405,10 @@ proc semSigSection(c: PContext; n: PNode): PNode = v.typ = typ strTableIncl(c.signatures, v) else: - localError(a.info, "'sig' section must have a type") + localError(a.info, "'using' section must have a type") var def: PNode if a.sons[length-1].kind != nkEmpty: - localError(a.info, "'sig' sections cannot contain assignments") + localError(a.info, "'using' sections cannot contain assignments") proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode = var b: PNode |