diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-01-18 11:40:30 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-01-18 11:40:30 +0100 |
commit | 090d22c71518babf662e55e971f9382e0d993052 (patch) | |
tree | 1218468e312482cd6f9d1f00396b9806583a5238 /compiler | |
parent | 6a2b57b4aac7d1a411bb8782523c3094774c4b09 (diff) | |
parent | 27aab0be162de4cca6132b46c12d98ce9c83d60e (diff) | |
download | Nim-090d22c71518babf662e55e971f9382e0d993052.tar.gz |
Merge branch 'devel' of github.com:nim-lang/Nim into devel
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ast.nim | 1 | ||||
-rw-r--r-- | compiler/condsyms.nim | 1 | ||||
-rw-r--r-- | compiler/pragmas.nim | 1 | ||||
-rw-r--r-- | compiler/semstmts.nim | 10 |
4 files changed, 8 insertions, 5 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index 69f2eb1c7..5c70bda18 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -979,6 +979,7 @@ const nkIdentKinds* = {nkIdent, nkSym, nkAccQuoted, nkOpenSymChoice, nkClosedSymChoice} + nkPragmaCallKinds* = {nkExprColonExpr, nkCall, nkCallStrLit} nkLiterals* = {nkCharLit..nkTripleStrLit} nkLambdaKinds* = {nkLambda, nkDo} declarativeDefs* = {nkProcDef, nkFuncDef, nkMethodDef, nkIteratorDef, nkConverterDef} diff --git a/compiler/condsyms.nim b/compiler/condsyms.nim index a52214e73..0be2899be 100644 --- a/compiler/condsyms.nim +++ b/compiler/condsyms.nim @@ -112,3 +112,4 @@ proc initDefines*() = defineSymbol("nimNewRoof") defineSymbol("nimHasRunnableExamples") defineSymbol("nimNewDot") + defineSymbol("nimHasNilChecks") diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index b6229796f..810c4c416 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -17,7 +17,6 @@ import const FirstCallConv* = wNimcall LastCallConv* = wNoconv - nkPragmaCallKinds = {nkExprColonExpr, nkCall, nkCallStrLit} const procPragmas* = {FirstCallConv..LastCallConv, wImportc, wExportc, wNodecl, diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 339c02715..f46d314cc 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -1143,7 +1143,7 @@ proc semProcAnnotation(c: PContext, prc: PNode; if n == nil or n.kind == nkEmpty: return for i in countup(0, n.len-1): var it = n.sons[i] - var key = if it.kind == nkExprColonExpr: it.sons[0] else: it + var key = if it.kind in nkPragmaCallKinds and it.len >= 1: it.sons[0] else: it let m = lookupMacro(c, key) if m == nil: if key.kind == nkIdent and key.ident.id == ord(wDelegator): @@ -1164,10 +1164,12 @@ proc semProcAnnotation(c: PContext, prc: PNode; if prc[pragmasPos].kind != nkEmpty and prc[pragmasPos].len == 0: prc.sons[pragmasPos] = emptyNode - if it.kind == nkExprColonExpr: - # pass pragma argument to the macro too: - x.add(it.sons[1]) + if it.kind in nkPragmaCallKinds and it.len > 1: + # pass pragma arguments to the macro too: + for i in 1..<it.len: + x.add(it.sons[i]) x.add(prc) + # recursion assures that this works for multiple macro annotations too: result = semExpr(c, x) # since a proc annotation can set pragmas, we process these here again. |