mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-16 08:04:20 +00:00
properly fold constants for dynlib pragma (#22575)
fixes #12929
(cherry picked from commit 6b955ac4af)
This commit is contained in:
@@ -330,7 +330,7 @@ proc expectDynlibNode(c: PContext, n: PNode): PNode =
|
||||
# {.dynlib: myGetProcAddr(...).}
|
||||
result = c.semExpr(c, n[1])
|
||||
if result.kind == nkSym and result.sym.kind == skConst:
|
||||
result = result.sym.astdef # look it up
|
||||
result = c.semConstExpr(c, result) # fold const
|
||||
if result.typ == nil or result.typ.kind notin {tyPointer, tyString, tyProc}:
|
||||
localError(c.config, n.info, errStringLiteralExpected)
|
||||
result = newEmptyStrNode(c, n)
|
||||
|
||||
Reference in New Issue
Block a user