diff options
author | Araq <rumpf_a@web.de> | 2012-09-18 00:36:48 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-09-18 00:36:48 +0200 |
commit | a71c5f98ea92c4c9f96ffe9265600f9cc2b7a8ee (patch) | |
tree | 90197cfed639d9f11b91ec0be2c70cad2c1831c6 /compiler | |
parent | 391fb89a3ea848c78f55b207c270060d3f1b467e (diff) | |
download | Nim-a71c5f98ea92c4c9f96ffe9265600f9cc2b7a8ee.tar.gz |
made tests green again
Diffstat (limited to 'compiler')
-rwxr-xr-x | compiler/semexprs.nim | 2 | ||||
-rwxr-xr-x | compiler/semgnrc.nim | 17 |
2 files changed, 13 insertions, 6 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index ae9cf26d6..3c630eeec 100755 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1427,7 +1427,7 @@ proc buildCall(n: PNode): PNode = elif n.kind in nkCallKinds and n.sons[0].kind == nkDotExpr: # x.y(a) -> y(x, a) let a = n.sons[0] - result = newNodeI(nkDotCall, n.info, n.len+1) + result = newNodeI(nkCall, n.info, n.len+1) result.sons[0] = a.sons[1] result.sons[1] = a.sons[0] for i in 1 .. <n.len: result.sons[i+1] = n.sons[i] diff --git a/compiler/semgnrc.nim b/compiler/semgnrc.nim index 861161acc..a330e17e7 100755 --- a/compiler/semgnrc.nim +++ b/compiler/semgnrc.nim @@ -19,7 +19,7 @@ type TSemGenericFlag = enum - withinBind, withinTypeDesc + withinBind, withinTypeDesc, withinMixin TSemGenericFlags = set[TSemGenericFlag] proc getIdentNode(n: PNode): PNode = @@ -80,13 +80,15 @@ proc semGenericStmt(c: PContext, n: PNode, of nkIdent, nkAccQuoted: var s = SymtabGet(c.Tab, n.ident) if s == nil: - localError(n.info, errUndeclaredIdentifier, n.ident.s) + if withinMixin notin flags: + localError(n.info, errUndeclaredIdentifier, n.ident.s) else: if withinBind in flags or s.id in toBind: result = symChoice(c, n, s, scClosed) else: result = semGenericStmtSymbol(c, n, s) of nkDotExpr: - var s = QualifiedLookUp(c, n, {checkUndeclared}) + let luf = if withinMixin notin flags: {checkUndeclared} else: {} + var s = QualifiedLookUp(c, n, luf) if s != nil: result = semGenericStmtSymbol(c, n, s) # XXX for example: ``result.add`` -- ``add`` needs to be looked up here... of nkEmpty, nkSym..nkNilLit: @@ -98,7 +100,8 @@ proc semGenericStmt(c: PContext, n: PNode, of nkCall, nkHiddenCallConv, nkInfix, nkPrefix, nkCommand, nkCallStrLit: # check if it is an expression macro: checkMinSonsLen(n, 1) - var s = qualifiedLookup(c, n.sons[0], {checkUndeclared}) + let luf = if withinMixin notin flags: {checkUndeclared} else: {} + var s = qualifiedLookup(c, n.sons[0], luf) var first = 0 var isDefinedMagic = false if s != nil: @@ -143,7 +146,8 @@ proc semGenericStmt(c: PContext, n: PNode, var a: PNode if isCallExpr(n.sons[0]): a = n.sons[0].sons[0] else: a = n.sons[0] - var s = qualifiedLookup(c, a, {checkUndeclared}) + let luf = if withinMixin notin flags: {checkUndeclared} else: {} + var s = qualifiedLookup(c, a, luf) if s != nil and macroToExpand(s): result = semMacroStmt(c, n, {}, false) for i in countup(0, sonsLen(result)-1): @@ -151,6 +155,9 @@ proc semGenericStmt(c: PContext, n: PNode, of nkIfStmt: for i in countup(0, sonsLen(n)-1): n.sons[i] = semGenericStmtScope(c, n.sons[i], flags, toBind) + of nkWhenStmt: + for i in countup(0, sonsLen(n)-1): + n.sons[i] = semGenericStmt(c, n.sons[i], flags+{withinMixin}, toBind) of nkWhileStmt: openScope(c.tab) for i in countup(0, sonsLen(n)-1): |