aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/SymUtils.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-08-17 13:00:59 +0200
committerMartin Odersky <odersky@gmail.com>2014-08-17 13:00:59 +0200
commit58d4706463b08f2e448c3021adad809e6046e0fe (patch)
treeacee1e319a6c4ffcb9feef976cdfdd78a2568ea6 /src/dotty/tools/dotc/transform/SymUtils.scala
parentf91f030290ac817888a6249d91118f42b560ab87 (diff)
downloaddotty-58d4706463b08f2e448c3021adad809e6046e0fe.tar.gz
dotty-58d4706463b08f2e448c3021adad809e6046e0fe.tar.bz2
dotty-58d4706463b08f2e448c3021adad809e6046e0fe.zip
Split Nullarify functionality to ElimByName, Erasure
New phase ElimByName elimintaes by-name parameters. All other occurrences of parameterless methods and ExprTypes are eliminated in erasure. The reason for the split like this is that it is very hard for Nullarify to determine when to insert ()'s. The logic for this is fragile because we need to look at previous denotations which might not exist (before splitter) or might result from a merge between parameterless and nullary methods. In Erasure the same is much simpler to achieve.
Diffstat (limited to 'src/dotty/tools/dotc/transform/SymUtils.scala')
-rw-r--r--src/dotty/tools/dotc/transform/SymUtils.scala25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/transform/SymUtils.scala b/src/dotty/tools/dotc/transform/SymUtils.scala
new file mode 100644
index 000000000..e5dfd4d4e
--- /dev/null
+++ b/src/dotty/tools/dotc/transform/SymUtils.scala
@@ -0,0 +1,25 @@
+package dotty.tools.dotc
+package transform
+
+import core._
+import core.transform.Erasure.ErasedValueType
+import Types._
+import Contexts._
+import Symbols._
+import Decorators._
+import StdNames.nme
+import NameOps._
+import language.implicitConversions
+
+object SymUtils {
+ implicit def decorateSymUtils(sym: Symbol): SymUtils = new SymUtils(sym)
+}
+
+/** A decorator that provides methods on symbols
+ * that are needed in the transformer pipeline.
+ */
+class SymUtils(val self: Symbol) extends AnyVal {
+
+ def isTypeTestOrCast(implicit ctx: Context): Boolean =
+ self == defn.Any_asInstanceOf || self == defn.Any_isInstanceOf
+}