From b3103c4657a3700e13f90fa1b4be888f023eb604 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Sun, 12 May 2013 21:01:39 +0300 Subject: [PATCH] fixes #429 and tstmtexpr --- compiler/passes.nim | 6 ++++-- compiler/semexprs.nim | 8 +++++++- compiler/semtypes.nim | 29 ++++++++++++++++------------- compiler/sigmatch.nim | 7 ++++--- compiler/types.nim | 5 +++-- tests/reject/tstmtexp.nim | 2 +- 6 files changed, 35 insertions(+), 22 deletions(-) diff --git a/compiler/passes.nim b/compiler/passes.nim index f1277b839..8d228fe9a 100644 --- a/compiler/passes.nim +++ b/compiler/passes.nim @@ -177,7 +177,6 @@ proc processModule(module: PSym, stream: PLLStream, rd: PRodReader) = s = stream while true: openParsers(p, fileIdx, s) - var code = p.parseAll if sfSystemModule notin module.flags: # XXX what about caching? no processing then? what if I change the @@ -187,7 +186,10 @@ proc processModule(module: PSym, stream: PLLStream, rd: PRodReader) = processImplicits implicitImports, nkImportStmt, a processImplicits implicitIncludes, nkIncludeStmt, a - discard processTopLevelStmt(code, a) + while true: + var n = parseTopLevelStmt(p) + if n.kind == nkEmpty: break + if not processTopLevelStmt(n, a): break closeParsers(p) if s.kind != llsStdIn: break diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 1655da0fd..4f5c4fce5 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1671,11 +1671,17 @@ proc buildCall(n: PNode): PNode = else: result = n +proc doBlockIsStmtList(n: PNode): bool = + result = n.kind == nkDo and + n[paramsPos].sonsLen == 1 and + n[paramsPos][0].kind == nkEmpty + proc fixImmediateParams(n: PNode): PNode = # XXX: Temporary work-around until we carry out # the planned overload resolution reforms for i in 1 ..