fixes #9868
This commit is contained in:
parent
03c4231951
commit
4ec40796e6
3 changed files with 10 additions and 2 deletions
|
|
@ -626,6 +626,14 @@ proc getConstExpr(m: PSym, n: PNode; g: ModuleGraph): PNode =
|
||||||
# It doesn't matter if the argument is const or not for mLengthArray.
|
# It doesn't matter if the argument is const or not for mLengthArray.
|
||||||
# This fixes bug #544.
|
# This fixes bug #544.
|
||||||
result = newIntNodeT(lengthOrd(g.config, n.sons[1].typ), n, g)
|
result = newIntNodeT(lengthOrd(g.config, n.sons[1].typ), n, g)
|
||||||
|
of mSizeOf:
|
||||||
|
let size = getSize(g.config, n[1].typ)
|
||||||
|
if size >= 0:
|
||||||
|
result = newIntNode(nkIntLit, size)
|
||||||
|
result.info = n.info
|
||||||
|
result.typ = getSysType(g, n.info, tyInt)
|
||||||
|
else:
|
||||||
|
result = nil
|
||||||
of mAstToStr:
|
of mAstToStr:
|
||||||
result = newStrNodeT(renderTree(n[1], {renderNoComments}), n, g)
|
result = newStrNodeT(renderTree(n[1], {renderNoComments}), n, g)
|
||||||
of mConStrStr:
|
of mConStrStr:
|
||||||
|
|
|
||||||
|
|
@ -321,8 +321,6 @@ proc semOf(c: PContext, n: PNode): PNode =
|
||||||
proc magicsAfterOverloadResolution(c: PContext, n: PNode,
|
proc magicsAfterOverloadResolution(c: PContext, n: PNode,
|
||||||
flags: TExprFlags): PNode =
|
flags: TExprFlags): PNode =
|
||||||
## This is the preferred code point to implement magics.
|
## This is the preferred code point to implement magics.
|
||||||
## This function basically works like a macro, with the difference
|
|
||||||
## that it is implemented in the compiler and not on the nimvm.
|
|
||||||
## ``c`` the current module, a symbol table to a very good approximation
|
## ``c`` the current module, a symbol table to a very good approximation
|
||||||
## ``n`` the ast like it would be passed to a real macro
|
## ``n`` the ast like it would be passed to a real macro
|
||||||
## ``flags`` Some flags for more contextual information on how the
|
## ``flags`` Some flags for more contextual information on how the
|
||||||
|
|
|
||||||
|
|
@ -13,3 +13,5 @@ echo i
|
||||||
# bug #9868
|
# bug #9868
|
||||||
proc foo(a: SomeInteger): array[sizeof(a), byte] =
|
proc foo(a: SomeInteger): array[sizeof(a), byte] =
|
||||||
discard
|
discard
|
||||||
|
|
||||||
|
discard foo(1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue