diff options
author | Zahary Karadjov <zahary@gmail.com> | 2015-08-02 23:23:13 +0300 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2015-08-02 23:58:22 +0300 |
commit | fe124ceadc887f0ae4aa09e9af4fe96b91df670a (patch) | |
tree | a2dd4469d0fb6ebe8f6ee8e5d4effe0a0da95124 /compiler/vm.nim | |
parent | 02f97489b795cd33d49966e254b46fcc3f8072ba (diff) | |
download | Nim-fe124ceadc887f0ae4aa09e9af4fe96b91df670a.tar.gz |
Disable the new generic params handling for immediate template and macros
Since immediate templates are not subjected to the standard sigmatching algorithm, they will have a number of deficiencies when it comes to generic params: Type dependencies between the parameters won't be honoured and the bound generic symbols won't be resolvable within their bodies. We could try to fix this, but it may be wiser to just deprecate immediate templates and macros now that we have working untyped parameters. Disabling the new features is admittedly not the greatest way to handle this situations as it introduces inconsistency in the language, but at least it makes the code backwards-compatible with the previous version of the compiler instead of triggering more serious problems.
Diffstat (limited to 'compiler/vm.nim')
-rw-r--r-- | compiler/vm.nim | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim index fc63da1d4..a51087aa6 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -1521,10 +1521,11 @@ proc evalMacroCall*(module: PSym, n, nOrig: PNode, sym: PSym): PNode = for i in 1.. <sym.typ.len: tos.slots[i] = setupMacroParam(n.sons[i], sym.typ.sons[i]) - let gp = sym.ast[genericParamsPos] - for i in 0 .. <gp.len: - let idx = sym.typ.len + i - tos.slots[idx] = setupMacroParam(n.sons[idx], gp[i].sym.typ) + if sfImmediate notin sym.flags: + let gp = sym.ast[genericParamsPos] + for i in 0 .. <gp.len: + let idx = sym.typ.len + i + tos.slots[idx] = setupMacroParam(n.sons[idx], gp[i].sym.typ) # temporary storage: #for i in L .. <maxSlots: tos.slots[i] = newNode(nkEmpty) |