diff options
author | metagn <metagngn@gmail.com> | 2024-08-12 16:33:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-12 15:33:26 +0200 |
commit | 0c890ff9a70258af8231967229b891df9731a5df (patch) | |
tree | f42d7dbf06e1f9441c704f3aebb288457f3ff0ea /compiler/ic/ic.nim | |
parent | 7a0069a134aae949f310b5936c6a31270dc79316 (diff) | |
download | Nim-0c890ff9a70258af8231967229b891df9731a5df.tar.gz |
opensym as node kind + fixed experimental switch (#23892)
refs https://github.com/nim-lang/Nim/pull/23873#discussion_r1687995060, fixes #23386, fixes #23385, supersedes #23572 Turns the `nfOpenSym` node flag implemented in #23091 and extended in #23102 and #23873, into a node kind `nkOpenSym` that forms a unary node containing either `nkSym` or `nkOpenSymChoice`. Since this affects macros working on generic proc AST, the node kind is now only generated when the experimental switch `genericsOpenSym` is enabled, and a new node flag `nfDisabledOpenSym` is set to the `nkSym` or `nkOpenSymChoice` when the switch is not enabled so that we can give a warning. Now that the experimental switch has more reasonable semantics, we define `nimHasGenericsOpenSym2`.
Diffstat (limited to 'compiler/ic/ic.nim')
-rw-r--r-- | compiler/ic/ic.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/ic/ic.nim b/compiler/ic/ic.nim index 7dcdb4f1e..8e81633ef 100644 --- a/compiler/ic/ic.nim +++ b/compiler/ic/ic.nim @@ -837,7 +837,7 @@ proc loadNodes*(c: var PackedDecoder; g: var PackedModuleGraph; thisModule: int; result.ident = getIdent(c.cache, g[thisModule].fromDisk.strings[n.litId]) of nkSym: result.sym = loadSym(c, g, thisModule, PackedItemId(module: LitId(0), item: tree[n].soperand)) - if result.typ == nil and nfOpenSym notin result.flags: + if result.typ == nil: result.typ = result.sym.typ of externIntLit: result.intVal = g[thisModule].fromDisk.numbers[n.litId] @@ -851,7 +851,7 @@ proc loadNodes*(c: var PackedDecoder; g: var PackedModuleGraph; thisModule: int; assert n2.kind == nkNone transitionNoneToSym(result) result.sym = loadSym(c, g, thisModule, PackedItemId(module: n1.litId, item: tree[n2].soperand)) - if result.typ == nil and nfOpenSym notin result.flags: + if result.typ == nil: result.typ = result.sym.typ else: for n0 in sonsReadonly(tree, n): |