From 24f40bc76493410f2688c8a74028ecb1db7306bf Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 31 Mar 2017 14:40:06 +0200 Subject: Make outer select names semantic --- compiler/src/dotty/tools/dotc/core/NameKinds.scala | 10 ++++++++++ compiler/src/dotty/tools/dotc/core/NameOps.scala | 8 -------- compiler/src/dotty/tools/dotc/core/StdNames.scala | 1 - compiler/src/dotty/tools/dotc/core/tasty/TastyFormat.scala | 2 ++ 4 files changed, 12 insertions(+), 9 deletions(-) (limited to 'compiler/src/dotty/tools/dotc/core') diff --git a/compiler/src/dotty/tools/dotc/core/NameKinds.scala b/compiler/src/dotty/tools/dotc/core/NameKinds.scala index 8279c21bb..cabb83171 100644 --- a/compiler/src/dotty/tools/dotc/core/NameKinds.scala +++ b/compiler/src/dotty/tools/dotc/core/NameKinds.scala @@ -242,6 +242,16 @@ object NameKinds { } } + /** Names of the form N_. Emitted by inliner, replaced by outer path + * in ExplicitOuter. + */ + object OuterSelectName extends NumberedNameKind(OUTERSELECT, "OuterSelect") { + def mkString(underlying: TermName, info: ThisInfo) = { + assert(underlying.isEmpty) + info.num + "_" + } + } + val SuperAccessorName = new PrefixNameKind(SUPERACCESSOR, "super$") val InitializerName = new PrefixNameKind(INITIALIZER, "initial$") val ShadowedName = new PrefixNameKind(SHADOWED, "(shadowed)") diff --git a/compiler/src/dotty/tools/dotc/core/NameOps.scala b/compiler/src/dotty/tools/dotc/core/NameOps.scala index b262fb536..44c5c1e09 100644 --- a/compiler/src/dotty/tools/dotc/core/NameOps.scala +++ b/compiler/src/dotty/tools/dotc/core/NameOps.scala @@ -60,11 +60,9 @@ object NameOps { 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.exclude(UniqueName).is(ModuleVarName) def isSelectorName = name.startsWith("_") && name.tail.forall(_.isDigit) - def isOuterSelect = name.endsWith(nme.OUTER_SELECT) /** Is name a variable name? */ def isVariableName: Boolean = name.length > 0 && { @@ -247,12 +245,6 @@ object NameOps { else -1 } - /** The number of hops specified in an outer-select name */ - def outerSelectHops: Int = { - require(isOuterSelect) - name.dropRight(nme.OUTER_SELECT.length).toString.toInt - } - /** The name of the generic runtime operation corresponding to an array operation */ def genericArrayOp: TermName = name match { case nme.apply => nme.array_apply diff --git a/compiler/src/dotty/tools/dotc/core/StdNames.scala b/compiler/src/dotty/tools/dotc/core/StdNames.scala index b89775e9e..b5d8e356e 100644 --- a/compiler/src/dotty/tools/dotc/core/StdNames.scala +++ b/compiler/src/dotty/tools/dotc/core/StdNames.scala @@ -253,7 +253,6 @@ object StdNames { val MODULE_INSTANCE_FIELD: N = NameTransformer.MODULE_INSTANCE_NAME // "MODULE$" val OUTER: N = "$outer" val OUTER_LOCAL: N = "$outer " - val OUTER_SELECT: N = "_" // emitted by inliner, replaced by outer path in explicitouter val REFINE_CLASS: N = "" val ROOTPKG: N = "_root_" val SELECTOR_DUMMY: N = "" diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TastyFormat.scala b/compiler/src/dotty/tools/dotc/core/tasty/TastyFormat.scala index 04550f188..68c5bf10e 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TastyFormat.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TastyFormat.scala @@ -229,6 +229,8 @@ object TastyFormat { final val UNIQUE = 10 final val DEFAULTGETTER = 11 final val VARIANT = 12 + final val OUTERSELECT = 13 + final val SUPERACCESSOR = 20 final val PROTECTEDACCESSOR = 21 final val PROTECTEDSETTER = 22 -- cgit v1.2.3