cleaned up the code and implemented proper error messages
This commit is contained in:
parent
02243410fd
commit
564c0acae2
4 changed files with 209 additions and 83 deletions
|
|
@ -45,7 +45,7 @@ proc tryExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode
|
|||
proc activate(c: PContext, n: PNode)
|
||||
proc semQuoteAst(c: PContext, n: PNode): PNode
|
||||
proc finishMethod(c: PContext, s: PSym)
|
||||
|
||||
proc evalAtCompileTime(c: PContext, n: PNode): PNode
|
||||
proc indexTypesMatch(c: PContext, f, a: PType, arg: PNode): PNode
|
||||
|
||||
proc isArrayConstr(n: PNode): bool {.inline.} =
|
||||
|
|
@ -328,6 +328,20 @@ proc semConstExpr(c: PContext, n: PNode): PNode =
|
|||
else:
|
||||
result = fixupTypeAfterEval(c, result, e)
|
||||
|
||||
proc semExprFlagDispatched(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||
if efNeedStatic in flags:
|
||||
if efPreferNilResult in flags:
|
||||
return tryConstExpr(c, n)
|
||||
else:
|
||||
return semConstExpr(c, n)
|
||||
else:
|
||||
result = semExprWithType(c, n, flags)
|
||||
if efPreferStatic in flags:
|
||||
var evaluated = getConstExpr(c.module, result)
|
||||
if evaluated != nil: return evaluated
|
||||
evaluated = evalAtCompileTime(c, result)
|
||||
if evaluated != nil: return evaluated
|
||||
|
||||
include hlo, seminst, semcall
|
||||
|
||||
when false:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue