diff options
author | Martin Odersky <odersky@gmail.com> | 2017-03-31 14:17:16 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-04-11 09:33:12 +0200 |
commit | a3f6ca5a5cd96e17d2f9a9c5187f45ff02b5dd61 (patch) | |
tree | 5c6180be4cb80978555ebe99ac0f00837e77e70f /compiler/src/dotty/tools/dotc/core/NameOps.scala | |
parent | e3e5e79e24503a2e6be7f708d81c27068664b893 (diff) | |
download | dotty-a3f6ca5a5cd96e17d2f9a9c5187f45ff02b5dd61.tar.gz dotty-a3f6ca5a5cd96e17d2f9a9c5187f45ff02b5dd61.tar.bz2 dotty-a3f6ca5a5cd96e17d2f9a9c5187f45ff02b5dd61.zip |
Make module var names semantic
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/NameOps.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/NameOps.scala | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/NameOps.scala b/compiler/src/dotty/tools/dotc/core/NameOps.scala index 39981543d..b262fb536 100644 --- a/compiler/src/dotty/tools/dotc/core/NameOps.scala +++ b/compiler/src/dotty/tools/dotc/core/NameOps.scala @@ -57,15 +57,13 @@ object NameOps { def isConstructorName = name == CONSTRUCTOR || name == TRAIT_CONSTRUCTOR def isStaticConstructorName = name == STATIC_CONSTRUCTOR - def isImplClassName = name endsWith IMPL_CLASS_SUFFIX def isLocalDummyName = name startsWith LOCALDUMMY_PREFIX def isReplWrapperName = name.toSimpleName containsSlice INTERPRETER_IMPORT_WRAPPER def isSetterName = name endsWith SETTER_SUFFIX def isImportName = name startsWith IMPORT def isScala2LocalSuffix = name.endsWith(" ") - def isModuleVarName(name: Name): Boolean = - name.stripAnonNumberSuffix endsWith MODULE_VAR_SUFFIX - def isSelectorName = name.startsWith(" ") && name.tail.forall(_.isDigit) + def isModuleVarName(name: Name): Boolean = name.exclude(UniqueName).is(ModuleVarName) + def isSelectorName = name.startsWith("_") && name.tail.forall(_.isDigit) def isOuterSelect = name.endsWith(nme.OUTER_SELECT) /** Is name a variable name? */ @@ -86,21 +84,6 @@ object NameOps { false } - /** If the name ends with $nn where nn are - * all digits, strip the $ and the digits. - * Otherwise return the argument. - */ - def stripAnonNumberSuffix: Name = { - var pos = name.length - while (pos > 0 && name(pos - 1).isDigit) - pos -= 1 - - if (pos > 0 && pos < name.length && name(pos - 1) == '$') - name take (pos - 1) - else - name - } - /** Convert this module name to corresponding module class name */ def moduleClassName: TypeName = name.derived(ModuleClassName).toTypeName @@ -378,9 +361,6 @@ object NameOps { def stripScala2LocalSuffix: TermName = if (name.isScala2LocalSuffix) name.init.asTermName else name - def moduleVarName: TermName = - name ++ MODULE_VAR_SUFFIX - /** The name unary_x for a prefix operator x */ def toUnaryName: TermName = name match { case raw.MINUS => UNARY_- |