summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-03-06 13:26:30 +0000
committerPaul Phillips <paulp@improving.org>2010-03-06 13:26:30 +0000
commit68c2fff4c1103ded18788861f99654292c4e71d1 (patch)
treea8d81b829e7f6cce92fde969ae5da8485c144b27 /src/compiler/scala/tools/nsc/ast/TreeDSL.scala
parent8d59708911be076e227a046eb1dd14421e1a9cb7 (diff)
downloadscala-68c2fff4c1103ded18788861f99654292c4e71d1.tar.gz
scala-68c2fff4c1103ded18788861f99654292c4e71d1.tar.bz2
scala-68c2fff4c1103ded18788861f99654292c4e71d1.zip
Fixes for #3126.
null, and thrown MatchErrors don't NPE trying to stringify null. No review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/TreeDSL.scala')
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeDSL.scala11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/TreeDSL.scala b/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
index a788015262..fd13958053 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
@@ -88,6 +88,8 @@ trait TreeDSL {
def ANY_>= (other: Tree) = fn(target, nme.GE, other)
def ANY_<= (other: Tree) = fn(target, nme.LE, other)
def OBJ_!= (other: Tree) = fn(target, Object_ne, other)
+ def OBJ_EQ (other: Tree) = fn(target, nme.eq, other)
+ def OBJ_NE (other: Tree) = fn(target, nme.ne, other)
def INT_| (other: Tree) = fn(target, getMember(IntClass, nme.OR), other)
def INT_& (other: Tree) = fn(target, getMember(IntClass, nme.AND), other)
@@ -187,10 +189,11 @@ trait TreeDSL {
}
/** Top level accessible. */
- def THROW(sym: Symbol, msg: Tree = null) = {
- val arg: List[Tree] = if (msg == null) Nil else List(msg.TOSTRING())
- Throw(New(TypeTree(sym.tpe), List(arg)))
- }
+ def MATCHERROR(arg: Tree) = Throw(New(TypeTree(MatchErrorClass.tpe), List(List(arg))))
+ /** !!! should generalize null guard from match error here. */
+ def THROW(sym: Symbol): Throw = Throw(New(TypeTree(sym.tpe), List(Nil)))
+ def THROW(sym: Symbol, msg: Tree): Throw = Throw(New(TypeTree(sym.tpe), List(List(msg.TOSTRING()))))
+
def NEW(tpe: Tree, args: Tree*) = New(tpe, List(args.toList))
def NEW(sym: Symbol, args: Tree*) =
if (args.isEmpty) New(TypeTree(sym.tpe))