From d5dceac54c9023c7e886c8199fa8e000b9b1e99b Mon Sep 17 00:00:00 2001 From: Burak Emir Date: Mon, 6 Aug 2007 15:10:12 +0000 Subject: replaced `_.tpe.symbol.tag' with getCaseTag(_) ... replaced `_.tpe.symbol.tag' with getCaseTag(_) calls --- .../scala/tools/nsc/matching/ParallelMatching.scala | 14 ++------------ .../scala/tools/nsc/matching/PatternMatchers.scala | 4 ++-- src/compiler/scala/tools/nsc/matching/PatternNodes.scala | 4 +++- 3 files changed, 7 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala index 53f3d667e9..57c389b25a 100644 --- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala +++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala @@ -224,7 +224,7 @@ trait ParallelMatching { if(isDefaultPattern(p)) insertDefault(i,strip1(xs.head)) else - insertTagIndexPair(p.tpe./*?type?*/symbol.tag, i) + insertTagIndexPair( getCaseTag(p.tpe), i) i += 1 xs = xs.tail } @@ -235,17 +235,7 @@ trait ParallelMatching { case Row(pats,s,g,b) => val nbindings = s ::: strip1(column(index)).toList.map { v => (v,scrutinee) } Row(column(tagIndexPairs.index)::pats, nbindings, g, b) - } - - /*{ - var trs = tagIndexPairs - while(trs ne null) { - Console.println((trs.tag,trs.index)) - trs = trs.next - } - }*/ - //System.exit(-1) - + } } diff --git a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala index 1a68d873dc..af294ce550 100644 --- a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala +++ b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala @@ -1062,7 +1062,7 @@ print() while (node ne null) node match { case ConstrPat(casted) => - cases = insertNode(node.tpe./*?type?*/symbol.tag, node, cases) + cases = insertNode(getCaseTag(node.tpe) , node, cases) node = node.or case DefaultPat() => @@ -1070,7 +1070,7 @@ print() node = node.or case VariablePat(tree) if node.tpe./*?type?*/symbol hasFlag Flags.CASE => - cases = insertNode(node.tpe./*?type?*/symbol.tag, node, cases) + cases = insertNode(getCaseTag(node.tpe), node, cases) node = node.or case _ => diff --git a/src/compiler/scala/tools/nsc/matching/PatternNodes.scala b/src/compiler/scala/tools/nsc/matching/PatternNodes.scala index 4fc3db664f..2321ce09d8 100644 --- a/src/compiler/scala/tools/nsc/matching/PatternNodes.scala +++ b/src/compiler/scala/tools/nsc/matching/PatternNodes.scala @@ -33,8 +33,10 @@ trait PatternNodes { self: transform.ExplicitOuter => case z => z } - // + // this method obtains tag method in a defensive way + def getCaseTag(x:Type): Int = { x.typeSymbol.tag } + // type SymSet = collection.immutable.Set[Symbol] /** returns the child patterns of a pattern -- cgit v1.2.3