more destructor based changes (#10885)
* mark user defined destructors with sfOverriden to simplify the logic * refactoring in preparation to merge liftings and generic instantiations for destructors * ast: introduce nkHiddenTryStmt for destructor generation in order to be able to optimize better the code later on * renamed 'patterns' switch to 'trmacros' as it was totally misleading before * destructors: introduce tfCheckedForDestructor flag in preparation of strict =destroy checking * test for invalid/too late destructor introductions * liftdestructors: make code robust for nimsuggest * --newruntime works for hello world again * newruntime: code generation for closures
This commit is contained in:
parent
25649616ea
commit
bf592c4e94
39 changed files with 443 additions and 242 deletions
|
|
@ -120,6 +120,16 @@ proc whichPragma*(n: PNode): TSpecialWord =
|
|||
let key = if n.kind in nkPragmaCallKinds and n.len > 0: n.sons[0] else: n
|
||||
if key.kind == nkIdent: result = whichKeyword(key.ident)
|
||||
|
||||
proc effectSpec*(n: PNode, effectType: TSpecialWord): PNode =
|
||||
for i in countup(0, sonsLen(n) - 1):
|
||||
var it = n.sons[i]
|
||||
if it.kind == nkExprColonExpr and whichPragma(it) == effectType:
|
||||
result = it.sons[1]
|
||||
if result.kind notin {nkCurly, nkBracket}:
|
||||
result = newNodeI(nkCurly, result.info)
|
||||
result.add(it.sons[1])
|
||||
return
|
||||
|
||||
proc unnestStmts(n, result: PNode) =
|
||||
if n.kind == nkStmtList:
|
||||
for x in items(n): unnestStmts(x, result)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue