Fix defer not not-working at top level (#10191)
This commit is contained in:
parent
15773c455a
commit
e77dd683eb
4 changed files with 4 additions and 13 deletions
|
|
@ -556,8 +556,6 @@ proc isEmptyTree(n: PNode): bool =
|
|||
else: result = false
|
||||
|
||||
proc semStmtAndGenerateGenerics(c: PContext, n: PNode): PNode =
|
||||
if n.kind == nkDefer:
|
||||
localError(c.config, n.info, "defer statement not supported at top level")
|
||||
if c.topStmts == 0 and not isImportSystemStmt(c.graph, n):
|
||||
if sfSystemModule notin c.module.flags and not isEmptyTree(n):
|
||||
c.importTable.addSym c.graph.systemModule # import the "System" identifier
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue