From 130069ad787ca20e960d57e11e6f4911e3bed5a0 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 31 Mar 2017 15:01:06 +0200 Subject: Cleanups of NameOps Remove unused functionality --- compiler/src/dotty/tools/dotc/core/NameOps.scala | 79 ----------------------- compiler/src/dotty/tools/dotc/core/StdNames.scala | 1 - 2 files changed, 80 deletions(-) (limited to 'compiler/src/dotty/tools/dotc/core') diff --git a/compiler/src/dotty/tools/dotc/core/NameOps.scala b/compiler/src/dotty/tools/dotc/core/NameOps.scala index 44c5c1e09..2caaaf1ab 100644 --- a/compiler/src/dotty/tools/dotc/core/NameOps.scala +++ b/compiler/src/dotty/tools/dotc/core/NameOps.scala @@ -61,7 +61,6 @@ object NameOps { def isReplWrapperName = name.toSimpleName containsSlice INTERPRETER_IMPORT_WRAPPER def isSetterName = name endsWith SETTER_SUFFIX def isScala2LocalSuffix = name.endsWith(" ") - def isModuleVarName(name: Name): Boolean = name.exclude(UniqueName).is(ModuleVarName) def isSelectorName = name.startsWith("_") && name.tail.forall(_.isDigit) /** Is name a variable name? */ @@ -105,9 +104,6 @@ object NameOps { else name.toTermName.exclude(AvoidClashName) } - /** The superaccessor for method with given name */ - def superName: TermName = SuperAccessorName(name.toTermName) - def expandedName(base: Symbol, kind: QualifiedNameKind = ExpandedName)(implicit ctx: Context): N = { val prefix = if (base.name.is(ExpandedName)) base.name else base.fullNameSeparated(ExpandPrefixName) @@ -307,17 +303,6 @@ object NameOps { } } - // needed??? - private val Boxed = Map[TypeName, TypeName]( - tpnme.Boolean -> jtpnme.BoxedBoolean, - tpnme.Byte -> jtpnme.BoxedByte, - tpnme.Char -> jtpnme.BoxedCharacter, - tpnme.Short -> jtpnme.BoxedShort, - tpnme.Int -> jtpnme.BoxedInteger, - tpnme.Long -> jtpnme.BoxedLong, - tpnme.Float -> jtpnme.BoxedFloat, - tpnme.Double -> jtpnme.BoxedDouble) - implicit class TermNameDecorator(val name: TermName) extends AnyVal { import nme._ @@ -338,18 +323,6 @@ object NameOps { } else FieldName(name) - /** Nominally, name from name$default$N, CONSTRUCTOR for */ - def defaultGetterToMethod: TermName = - name rewrite { - case DefaultGetterName(methName, _) => methName - } - - /** If this is a default getter, its index (starting from 0), else -1 */ - def defaultGetterIndex: Int = - name collect { - case DefaultGetterName(_, num) => num - } getOrElse -1 - def stripScala2LocalSuffix: TermName = if (name.isScala2LocalSuffix) name.init.asTermName else name @@ -361,57 +334,5 @@ object NameOps { case raw.BANG => UNARY_! case _ => name } - - /** The name of a method which stands in for a primitive operation - * during structural type dispatch. - */ - def primitiveInfixMethodName: TermName = name match { - case OR => takeOr - case XOR => takeXor - case AND => takeAnd - case EQ => testEqual - case NE => testNotEqual - case ADD => add - case SUB => subtract - case MUL => multiply - case DIV => divide - case MOD => takeModulo - case LSL => shiftSignedLeft - case LSR => shiftLogicalRight - case ASR => shiftSignedRight - case LT => testLessThan - case LE => testLessOrEqualThan - case GE => testGreaterOrEqualThan - case GT => testGreaterThan - case ZOR => takeConditionalOr - case ZAND => takeConditionalAnd - case _ => NO_NAME - } - - /** Postfix/prefix, really. - */ - def primitivePostfixMethodName: TermName = name match { - case UNARY_! => takeNot - case UNARY_+ => positive - case UNARY_- => negate - case UNARY_~ => complement - case `toByte` => toByte - case `toShort` => toShort - case `toChar` => toCharacter - case `toInt` => toInteger - case `toLong` => toLong - case `toFloat` => toFloat - case `toDouble` => toDouble - case _ => NO_NAME - } - - def primitiveMethodName: TermName = - primitiveInfixMethodName match { - case NO_NAME => primitivePostfixMethodName - case name => name - } } - - private final val FalseSuper = "$$super".toTermName - private val FalseSuperLength = FalseSuper.length } diff --git a/compiler/src/dotty/tools/dotc/core/StdNames.scala b/compiler/src/dotty/tools/dotc/core/StdNames.scala index b5d8e356e..8eea6aded 100644 --- a/compiler/src/dotty/tools/dotc/core/StdNames.scala +++ b/compiler/src/dotty/tools/dotc/core/StdNames.scala @@ -252,7 +252,6 @@ object StdNames { val REIFY_SYMDEF_PREFIX: N = "symdef$" val MODULE_INSTANCE_FIELD: N = NameTransformer.MODULE_INSTANCE_NAME // "MODULE$" val OUTER: N = "$outer" - val OUTER_LOCAL: N = "$outer " val REFINE_CLASS: N = "" val ROOTPKG: N = "_root_" val SELECTOR_DUMMY: N = "" -- cgit v1.2.3