This commit is contained in:
Araq
2015-03-18 13:36:38 +01:00
parent 880e39d123
commit 16adfcdfa6
3 changed files with 8 additions and 2 deletions

View File

@@ -762,6 +762,7 @@ proc genRecordField(p: BProc, e: PNode, d: var TLoc) =
if field.loc.r == nil: internalError(e.info, "genRecordField 3")
appf(r, ".$1", [field.loc.r])
putIntoDest(p, d, field.typ, r)
#d.s = a.s
proc genInExprAux(p: BProc, e: PNode, a, b, d: var TLoc)

View File

@@ -1269,9 +1269,12 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) =
putWithSpace(g, tkColon, ":")
gcoms(g)
gstmts(g, n.sons[0], c)
of nkFinally:
of nkFinally, nkDefer:
optNL(g)
put(g, tkFinally, "finally")
if n.kind == nkFinally:
put(g, tkFinally, "finally")
else:
put(g, tkDefer, "defer")
putWithSpace(g, tkColon, ":")
gcoms(g)
gstmts(g, n.sons[0], c)

View File

@@ -2224,6 +2224,8 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
result = semPragmaBlock(c, n)
of nkStaticStmt:
result = semStaticStmt(c, n)
of nkDefer:
localError(n.info, errGenerated, "'defer' not allowed in this context")
else:
localError(n.info, errInvalidExpressionX,
renderTree(n, {renderNoComments}))