From 355ae07b8f3362af4e90770477d344dcd2fef594 Mon Sep 17 00:00:00 2001 From: Araq Date: Thu, 6 Sep 2012 00:23:55 +0200 Subject: [PATCH] activated tests for tr macros --- compiler/parampatterns.nim | 7 ++++--- compiler/patterns.nim | 31 ++++++++++++++++++------------- compiler/semtempl.nim | 12 ++++++------ tests/patterns/tcse.nim | 13 +++++++++++++ tests/patterns/tnoalias.nim | 16 ++++++++++++++++ tests/patterns/tstmtlist.nim | 3 ++- tests/specials.nim | 4 +++- 7 files changed, 62 insertions(+), 24 deletions(-) create mode 100644 tests/patterns/tcse.nim create mode 100644 tests/patterns/tnoalias.nim diff --git a/compiler/parampatterns.nim b/compiler/parampatterns.nim index 3b5c8f6fa9..44e41f7a09 100644 --- a/compiler/parampatterns.nim +++ b/compiler/parampatterns.nim @@ -101,7 +101,7 @@ proc compileConstraints(p: PNode, result: var TPatternCode) = InternalAssert int(high(TNodeKind)) < 255 for i in low(TNodeKind)..high(TNodeKind): if cmpIgnoreStyle($i, spec) == 0: - result.add(ppSymKind) + result.add(ppNodeKind) result.add(chr(i.ord)) return patternError(p) @@ -199,7 +199,8 @@ proc matchNodeKinds*(p, n: PNode): bool = let kind = TNodeKind(code[pc+1]) push n.kind == kind inc pc - of ppSideEffect: push checkForSideEffects(n) != seNoSideEffect - of ppNoSideEffect: push checkForSideEffects(n) == seNoSideEffect + of ppSideEffect: push checkForSideEffects(n) == seSideEffect + of ppNoSideEffect: push checkForSideEffects(n) != seSideEffect inc pc result = stack[sp-1] + diff --git a/compiler/patterns.nim b/compiler/patterns.nim index 48ad550234..402283b769 100644 --- a/compiler/patterns.nim +++ b/compiler/patterns.nim @@ -53,13 +53,13 @@ proc sameTrees(a, b: PNode): bool = result = true proc inSymChoice(sc, x: PNode): bool = - if sc.kind == nkOpenSymChoice: - # same name suffices for open sym choices! - result = sc.sons[0].sym.name.id == x.sym.name.id - elif sc.kind == nkClosedSymChoice: + if sc.kind == nkClosedSymChoice: for i in 0..