aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/NameOps.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-02-11 09:15:32 +0100
committerMartin Odersky <odersky@gmail.com>2016-02-11 09:16:25 +0100
commitc16ead8d78936cab3dada7aa5e70eeacc5f576d1 (patch)
tree4241a66dd37ecb09e5bae9fc261c4d36620fd9e6 /src/dotty/tools/dotc/core/NameOps.scala
parent13b61653439700ca6607074bcded4d714131bdc2 (diff)
downloaddotty-c16ead8d78936cab3dada7aa5e70eeacc5f576d1.tar.gz
dotty-c16ead8d78936cab3dada7aa5e70eeacc5f576d1.tar.bz2
dotty-c16ead8d78936cab3dada7aa5e70eeacc5f576d1.zip
Abstract out lazy local names somewhat
Add operations to NameOps to detect and produce names for lazy locals. @darkdimius Maybe there is already another way to do this? I could not find it.
Diffstat (limited to 'src/dotty/tools/dotc/core/NameOps.scala')
-rw-r--r--src/dotty/tools/dotc/core/NameOps.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/NameOps.scala b/src/dotty/tools/dotc/core/NameOps.scala
index 6c1930c9f..81240a9fc 100644
--- a/src/dotty/tools/dotc/core/NameOps.scala
+++ b/src/dotty/tools/dotc/core/NameOps.scala
@@ -82,6 +82,7 @@ object NameOps {
def isModuleVarName(name: Name): Boolean =
name.stripAnonNumberSuffix endsWith MODULE_VAR_SUFFIX
def isSelectorName = name.startsWith(" ") && name.tail.forall(_.isDigit)
+ def isLazyLocal = name.endsWith(nme.LAZY_LOCAL)
/** Is name a variable name? */
def isVariableName: Boolean = name.length > 0 && {
@@ -423,5 +424,11 @@ object NameOps {
case NO_NAME => primitivePostfixMethodName
case name => name
}
+
+ def lazyLocalName = name ++ nme.LAZY_LOCAL
+ def nonLazyName = {
+ assert(name.isLazyLocal)
+ name.dropRight(nme.LAZY_LOCAL.length)
+ }
}
}