summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2011-05-14 12:39:07 +0000
committerIulian Dragos <jaguarul@gmail.com>2011-05-14 12:39:07 +0000
commite8c89255a59d545d8c425a5e23bf68ebd2fa0677 (patch)
tree1c65adf65b478e78c2a7a7f88732b5456a61f426
parent23697c8da5faf26a8f7638395d7425f519f98af8 (diff)
downloadscala-e8c89255a59d545d8c425a5e23bf68ebd2fa0677.tar.gz
scala-e8c89255a59d545d8c425a5e23bf68ebd2fa0677.tar.bz2
scala-e8c89255a59d545d8c425a5e23bf68ebd2fa0677.zip
Ported the minimum necessary changes to the 2.8...
Ported the minimum necessary changes to the 2.8.x branch so that the IDE can build against it. Trunk has diverged way too much for any meaningful patch to apply cleanly, so after a few hours of frustration I abandoned svnmerge and did all the changes manually. There still one test failing, in neg/named-defaults-something. It's only about different output in error messages. I'll probably update the check file when I'm confident it's nothing else.
-rw-r--r--.classpath1
-rw-r--r--.project6
-rw-r--r--META-INF/MANIFEST.MF3
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala6
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala258
-rw-r--r--src/compiler/scala/tools/nsc/reporters/Reporter.scala3
-rw-r--r--src/compiler/scala/tools/nsc/settings/MutableSettings.scala6
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Names.scala37
-rw-r--r--src/compiler/scala/tools/nsc/symtab/StdNames.scala4
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala7
10 files changed, 116 insertions, 215 deletions
diff --git a/.classpath b/.classpath
index dbbacc419b..6ccb74aae0 100644
--- a/.classpath
+++ b/.classpath
@@ -6,5 +6,6 @@
<classpathentry kind="lib" path="lib/jline.jar"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="lib/fjbg.jar"/>
+ <classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/.project b/.project
index 71b4782bbe..68938dd571 100644
--- a/.project
+++ b/.project
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>scala</name>
+ <name>scala-2.8.x</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
- <name>ch.epfl.lamp.sdt.core.scalabuilder</name>
+ <name>org.scala-ide.sdt.core.scalabuilder</name>
<arguments>
</arguments>
</buildCommand>
@@ -23,7 +23,7 @@
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
- <nature>ch.epfl.lamp.sdt.core.scalanature</nature>
+ <nature>org.scala-ide.sdt.core.scalanature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF
index 3577eadaf4..4864127f49 100644
--- a/META-INF/MANIFEST.MF
+++ b/META-INF/MANIFEST.MF
@@ -41,5 +41,4 @@ Export-Package:
ch.epfl.lamp.fjbg,
ch.epfl.lamp.util
Require-Bundle:
- org.apache.ant,
- scala.library
+ org.apache.ant
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index ef3f596d93..ad688083a8 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -653,6 +653,12 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
private var phasec: Int = 0
private var unitc: Int = 0
+ /**
+ * For subclasses to override. Called when `phase` is about to be run on `unit`.
+ * Variables are passed explicitly to indicate that `globalPhase` and `currentUnit` have been set.
+ */
+ def informUnitStarting(phase: Phase, unit: CompilationUnit) { }
+
/** take note that phase is completed
* (for progress reporting)
*/
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
index 21d1246cc4..037f830979 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
@@ -25,7 +25,7 @@ import reflect.generic.{PickleFormat, PickleBuffer}
* @version 1.0
*
*/
-abstract class GenJVM extends SubComponent {
+abstract class GenJVM extends SubComponent with GenJVMUtil {
import global._
import icodes._
import icodes.opcodes._
@@ -70,7 +70,7 @@ abstract class GenJVM extends SubComponent {
* Java bytecode generator.
*
*/
- class BytecodeGenerator {
+ class BytecodeGenerator extends BytecodeUtil {
import JAccessFlags._
def debugLevel = settings.debuginfo.indexOfChoice
@@ -128,6 +128,13 @@ abstract class GenJVM extends SubComponent {
val emitLines = debugLevel >= 2
val emitVars = debugLevel >= 3
+ override def javaName(sym: Symbol): String = {
+ if (sym.isClass && !sym.rawowner.isPackageClass && !sym.isModuleClass)
+ innerClasses = innerClasses + sym;
+
+ super.javaName(sym)
+ }
+
/** Write a class to disk, adding the Scala signature (pickled type information) and
* inner classes.
*
@@ -568,15 +575,6 @@ abstract class GenJVM extends SubComponent {
}
}
- def isTopLevelModule(sym: Symbol): Boolean =
- atPhase (currentRun.picklerPhase.next) {
- sym.isModuleClass && !sym.isImplClass && !sym.isNestedClass
- }
-
- def isStaticModule(sym: Symbol): Boolean = {
- sym.isModuleClass && !sym.isImplClass && !sym.hasFlag(Flags.LIFTED)
- }
-
def genField(f: IField) {
if (settings.debug.value)
log("Adding field: " + f.symbol.fullName);
@@ -929,36 +927,6 @@ abstract class GenJVM extends SubComponent {
var linearization: List[BasicBlock] = Nil
var isModuleInitialized = false
- private def genConstant(jcode: JExtendedCode, const: Constant) {
- const.tag match {
- case UnitTag => ()
- case BooleanTag => jcode.emitPUSH(const.booleanValue)
- case ByteTag => jcode.emitPUSH(const.byteValue)
- case ShortTag => jcode.emitPUSH(const.shortValue)
- case CharTag => jcode.emitPUSH(const.charValue)
- case IntTag => jcode.emitPUSH(const.intValue)
- case LongTag => jcode.emitPUSH(const.longValue)
- case FloatTag => jcode.emitPUSH(const.floatValue)
- case DoubleTag => jcode.emitPUSH(const.doubleValue)
- case StringTag => jcode.emitPUSH(const.stringValue)
- case NullTag => jcode.emitACONST_NULL()
- case ClassTag =>
- val kind = toTypeKind(const.typeValue)
- val toPush =
- if (kind.isValueType) classLiteral(kind)
- else javaType(kind).asInstanceOf[JReferenceType]
-
- jcode emitPUSH toPush
-
- case EnumTag =>
- val sym = const.symbolValue
- jcode.emitGETSTATIC(javaName(sym.owner),
- javaName(sym),
- javaType(sym.tpe.underlying))
- case _ => abort("Unknown constant value: " + const);
- }
- }
-
/**
* @param m ...
*/
@@ -1653,37 +1621,6 @@ abstract class GenJVM extends SubComponent {
/** For each basic block, the first PC address following it. */
val endPC: HashMap[BasicBlock, Int] = new HashMap()
- val conds: HashMap[TestOp, Int] = new HashMap()
-
- conds += (EQ -> JExtendedCode.COND_EQ)
- conds += (NE -> JExtendedCode.COND_NE)
- conds += (LT -> JExtendedCode.COND_LT)
- conds += (GT -> JExtendedCode.COND_GT)
- conds += (LE -> JExtendedCode.COND_LE)
- conds += (GE -> JExtendedCode.COND_GE)
-
- val negate: HashMap[TestOp, TestOp] = new HashMap()
-
- negate += (EQ -> NE)
- negate += (NE -> EQ)
- negate += (LT -> GE)
- negate += (GT -> LE)
- negate += (LE -> GT)
- negate += (GE -> LT)
-
- /** Map from type kinds to the Java reference types. It is used for
- * loading class constants. @see Predef.classOf. */
- val classLiteral: Map[TypeKind, JObjectType] = new HashMap()
-
- classLiteral += (UNIT -> new JObjectType("java.lang.Void"))
- classLiteral += (BOOL -> new JObjectType("java.lang.Boolean"))
- classLiteral += (BYTE -> new JObjectType("java.lang.Byte"))
- classLiteral += (SHORT -> new JObjectType("java.lang.Short"))
- classLiteral += (CHAR -> new JObjectType("java.lang.Character"))
- classLiteral += (INT -> new JObjectType("java.lang.Integer"))
- classLiteral += (LONG -> new JObjectType("java.lang.Long"))
- classLiteral += (FLOAT -> new JObjectType("java.lang.Float"))
- classLiteral += (DOUBLE -> new JObjectType("java.lang.Double"))
////////////////////// local vars ///////////////////////
@@ -1726,96 +1663,6 @@ abstract class GenJVM extends SubComponent {
////////////////////// Utilities ////////////////////////
- /**
- * <p>
- * Return the a name of this symbol that can be used on the Java
- * platform. It removes spaces from names.
- * </p>
- * <p>
- * Special handling: scala.Nothing and <code>scala.Null</code> are
- * <em>erased</em> to <code>scala.runtime.Nothing$</code> and
- * </code>scala.runtime.Null$</code>. This is needed because they are
- * not real classes, and they mean 'abrupt termination upon evaluation
- * of that expression' or <code>null</code> respectively. This handling is
- * done already in <a href="../icode/GenIcode.html" target="contentFrame">
- * <code>GenICode</code></a>, but here we need to remove references
- * from method signatures to these types, because such classes can
- * not exist in the classpath: the type checker will be very confused.
- * </p>
- */
- def javaName(sym: Symbol): String = {
- val suffix = moduleSuffix(sym)
-
- if (sym == definitions.NothingClass)
- return javaName(definitions.RuntimeNothingClass)
- else if (sym == definitions.NullClass)
- return javaName(definitions.RuntimeNullClass)
- else if (definitions.primitiveCompanions(sym.companionModule))
- return javaName(definitions.getModule("scala.runtime." + sym.name))
-
- if (sym.isClass && !sym.rawowner.isPackageClass && !sym.isModuleClass) {
- innerClasses = innerClasses + sym;
- }
-
- (if (sym.isClass || (sym.isModule && !sym.isMethod))
- sym.fullName('/')
- else
- sym.simpleName.toString.trim()) + suffix
- }
-
- def javaNames(syms: List[Symbol]): Array[String] = {
- val res = new Array[String](syms.length)
- var i = 0
- syms foreach (s => { res(i) = javaName(s); i += 1 })
- res
- }
-
- /**
- * Return the Java modifiers for the given symbol.
- * Java modifiers for classes:
- * - public, abstract, final, strictfp (not used)
- * for interfaces:
- * - the same as for classes, without 'final'
- * for fields:
- * - public, private (*)
- * - static, final
- * for methods:
- * - the same as for fields, plus:
- * - abstract, synchronized (not used), strictfp (not used), native (not used)
- *
- * (*) protected cannot be used, since inner classes 'see' protected members,
- * and they would fail verification after lifted.
- */
- def javaFlags(sym: Symbol): Int = {
- import JAccessFlags._
-
- var jf: Int = 0
- val f = sym.flags
- jf = jf | (if (sym hasFlag Flags.SYNTHETIC) ACC_SYNTHETIC else 0)
-/* jf = jf | (if (sym hasFlag Flags.PRIVATE) ACC_PRIVATE else
- if (sym hasFlag Flags.PROTECTED) ACC_PROTECTED else ACC_PUBLIC)
-*/
- jf = jf | (if (sym hasFlag Flags.PRIVATE) ACC_PRIVATE else ACC_PUBLIC)
- jf = jf | (if ((sym hasFlag Flags.ABSTRACT) ||
- (sym hasFlag Flags.DEFERRED)) ACC_ABSTRACT else 0)
- jf = jf | (if (sym hasFlag Flags.INTERFACE) ACC_INTERFACE else 0)
- jf = jf | (if ((sym hasFlag Flags.FINAL)
- && !sym.enclClass.hasFlag(Flags.INTERFACE)
- && !sym.isClassConstructor) ACC_FINAL else 0)
- jf = jf | (if (sym.isStaticMember) ACC_STATIC else 0)
- jf = jf | (if (sym hasFlag Flags.BRIDGE) ACC_BRIDGE | ACC_SYNTHETIC else 0)
-
- if (sym.isClass && !sym.hasFlag(Flags.INTERFACE))
- jf = jf | ACC_SUPER
-
- // constructors of module classes should be private
- if (sym.isPrimaryConstructor && isTopLevelModule(sym.owner)) {
- jf |= ACC_PRIVATE
- jf &= ~ACC_PUBLIC
- }
- jf
- }
-
/** Calls to methods in 'sym' need invokeinterface? */
def needsInterfaceCall(sym: Symbol): Boolean = {
log("checking for interface call: " + sym.fullName)
@@ -1830,37 +1677,6 @@ abstract class GenJVM extends SubComponent {
}
- def javaType(t: TypeKind): JType = (t: @unchecked) match {
- case UNIT => JType.VOID
- case BOOL => JType.BOOLEAN
- case BYTE => JType.BYTE
- case SHORT => JType.SHORT
- case CHAR => JType.CHAR
- case INT => JType.INT
- case LONG => JType.LONG
- case FLOAT => JType.FLOAT
- case DOUBLE => JType.DOUBLE
- case REFERENCE(cls) => new JObjectType(javaName(cls))
- case ARRAY(elem) => new JArrayType(javaType(elem))
- }
-
- def javaType(t: Type): JType = javaType(toTypeKind(t))
-
- def javaType(s: Symbol): JType =
- if (s.isMethod)
- new JMethodType(
- if (s.isClassConstructor) JType.VOID else javaType(s.tpe.resultType),
- s.tpe.paramTypes.map(javaType).toArray)
- else
- javaType(s.tpe)
-
- def javaTypes(ts: List[TypeKind]): Array[JType] = {
- val res = new Array[JType](ts.length)
- var i = 0
- ts foreach ( t => { res(i) = javaType(t); i += 1 } );
- res
- }
-
/** Return an abstract file for the given class symbol, with the desired suffix.
* Create all necessary subdirectories on the way.
*/
@@ -1889,4 +1705,60 @@ abstract class GenJVM extends SubComponent {
def assert(cond: Boolean) { assert(cond, "Assertion failed.") }
}
+
+ /**
+ * Return the Java modifiers for the given symbol.
+ * Java modifiers for classes:
+ * - public, abstract, final, strictfp (not used)
+ * for interfaces:
+ * - the same as for classes, without 'final'
+ * for fields:
+ * - public, private (*)
+ * - static, final
+ * for methods:
+ * - the same as for fields, plus:
+ * - abstract, synchronized (not used), strictfp (not used), native (not used)
+ *
+ * (*) protected cannot be used, since inner classes 'see' protected members,
+ * and they would fail verification after lifted.
+ */
+ def javaFlags(sym: Symbol): Int = {
+ import JAccessFlags._
+
+ var jf: Int = 0
+ val f = sym.flags
+ jf = jf | (if (sym hasFlag Flags.SYNTHETIC) ACC_SYNTHETIC else 0)
+ /* jf = jf | (if (sym hasFlag Flags.PRIVATE) ACC_PRIVATE else
+ if (sym hasFlag Flags.PROTECTED) ACC_PROTECTED else ACC_PUBLIC)
+ */
+ jf = jf | (if (sym hasFlag Flags.PRIVATE) ACC_PRIVATE else ACC_PUBLIC)
+ jf = jf | (if ((sym hasFlag Flags.ABSTRACT) ||
+ (sym hasFlag Flags.DEFERRED)) ACC_ABSTRACT else 0)
+ jf = jf | (if (sym hasFlag Flags.INTERFACE) ACC_INTERFACE else 0)
+ jf = jf | (if ((sym hasFlag Flags.FINAL)
+ && !sym.enclClass.hasFlag(Flags.INTERFACE)
+ && !sym.isClassConstructor) ACC_FINAL else 0)
+ jf = jf | (if (sym.isStaticMember) ACC_STATIC else 0)
+ jf = jf | (if (sym hasFlag Flags.BRIDGE) ACC_BRIDGE | ACC_SYNTHETIC else 0)
+
+ if (sym.isClass && !sym.hasFlag(Flags.INTERFACE))
+ jf = jf | ACC_SUPER
+
+ // constructors of module classes should be private
+ if (sym.isPrimaryConstructor && isTopLevelModule(sym.owner)) {
+ jf |= ACC_PRIVATE
+ jf &= ~ACC_PUBLIC
+ }
+ jf
+ }
+
+ def isTopLevelModule(sym: Symbol): Boolean =
+ atPhase (currentRun.picklerPhase.next) {
+ sym.isModuleClass && !sym.isImplClass && !sym.isNestedClass
+ }
+
+ def isStaticModule(sym: Symbol): Boolean = {
+ sym.isModuleClass && !sym.isImplClass && !sym.hasFlag(Flags.LIFTED)
+ }
+
}
diff --git a/src/compiler/scala/tools/nsc/reporters/Reporter.scala b/src/compiler/scala/tools/nsc/reporters/Reporter.scala
index cb8ef01ddd..e253a8f5f0 100644
--- a/src/compiler/scala/tools/nsc/reporters/Reporter.scala
+++ b/src/compiler/scala/tools/nsc/reporters/Reporter.scala
@@ -14,9 +14,8 @@ import scala.tools.nsc.util._
*/
abstract class Reporter {
object severity extends Enumeration
- class Severity(_id: Int) extends severity.Value {
+ class Severity(val id: Int) extends severity.Value {
var count: Int = 0
- def id = _id
}
val INFO = new Severity(0)
val WARNING = new Severity(1)
diff --git a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
index c15a4279fb..359d2ebc80 100644
--- a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
@@ -195,7 +195,11 @@ class MutableSettings(val errorFn: String => Unit) extends AbsSettings with Scal
}
def BooleanSetting(name: String, descr: String) = add(new BooleanSetting(name, descr))
- def ChoiceSetting(name: String, descr: String, choices: List[String], default: String) =
+ /** Compatibility layer, so that the IDE can call the 2.9 method. */
+ def ChoiceSetting(name: String, helpArg: String, descr: String, choices: List[String], default: String): ChoiceSetting =
+ ChoiceSetting(name, descr, choices, default) // helpArg is ignored
+
+ def ChoiceSetting(name: String, descr: String, choices: List[String], default: String): ChoiceSetting =
add(new ChoiceSetting(name, descr, choices, default))
def DefinesSetting() = add(new DefinesSetting())
def IntSetting(name: String, descr: String, default: Int, range: Option[(Int, Int)], parser: String => Option[Int]) = add(new IntSetting(name, descr, default, range, parser))
diff --git a/src/compiler/scala/tools/nsc/symtab/Names.scala b/src/compiler/scala/tools/nsc/symtab/Names.scala
index e6222a7a94..9ab5914843 100644
--- a/src/compiler/scala/tools/nsc/symtab/Names.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Names.scala
@@ -35,11 +35,11 @@ trait Names extends reflect.generic.Names {
/** hashtable for finding term names quickly
*/
- private val termHashtable = new Array[Name](HASH_SIZE)
+ private val termHashtable = new Array[TermName](HASH_SIZE)
/** hashtable for finding type names quickly
*/
- private val typeHashtable = new Array[Name](HASH_SIZE)
+ private val typeHashtable = new Array[TypeName](HASH_SIZE)
/** the hashcode of a name
*/
@@ -111,7 +111,7 @@ trait Names extends reflect.generic.Names {
* @param len ...
* @return the created term name
*/
- def newTermName(cs: Array[Char], offset: Int, len: Int): Name = {
+ def newTermName(cs: Array[Char], offset: Int, len: Int): TermName = {
val h = hashValue(cs, offset, len) & HASH_MASK
var n = termHashtable(h)
while ((n ne null) && (n.length != len || !equals(n.start, cs, offset, len)))
@@ -125,7 +125,7 @@ trait Names extends reflect.generic.Names {
/** create a term name from string
*/
- def newTermName(s: String): Name =
+ def newTermName(s: String): TermName =
newTermName(s.toCharArray(), 0, s.length())
/** Create a term name from the UTF8 encoded bytes in <code>bs[offset..offset+len-1]</code>.
@@ -135,7 +135,7 @@ trait Names extends reflect.generic.Names {
* @param len ...
* @return the created term name
*/
- def newTermName(bs: Array[Byte], offset: Int, len: Int): Name =
+ def newTermName(bs: Array[Byte], offset: Int, len: Int): TermName =
newTermName(Codec toUTF8 bs.slice(offset, offset + len) mkString)
/** Create a type name from the characters in <code>cs[offset..offset+len-1]</code>.
@@ -145,12 +145,12 @@ trait Names extends reflect.generic.Names {
* @param len ...
* @return the created type name
*/
- def newTypeName(cs: Array[Char], offset: Int, len: Int): Name =
+ def newTypeName(cs: Array[Char], offset: Int, len: Int): TypeName =
newTermName(cs, offset, len).toTypeName
/** create a type name from string
*/
- def newTypeName(s: String): Name =
+ def newTypeName(s: String): TypeName =
newTermName(s).toTypeName
/** Create a type name from the UTF8 encoded bytes in <code>bs[offset..offset+len-1]</code>.
@@ -160,7 +160,7 @@ trait Names extends reflect.generic.Names {
* @param len ...
* @return the create type name
*/
- def newTypeName(bs: Array[Byte], offset: Int, len: Int): Name =
+ def newTypeName(bs: Array[Byte], offset: Int, len: Int): TypeName =
newTermName(bs, offset, len).toTypeName
def mkTermName(name: Name) = name.toTermName
@@ -180,7 +180,7 @@ trait Names extends reflect.generic.Names {
/** next name in the same hash bucket
*/
- var next: Name = null
+ def next: Name
/** return the length of this name
*/
@@ -393,11 +393,14 @@ trait Names extends reflect.generic.Names {
NameTransformer.decode(toString()) +
(if (nameDebug && isTypeName) "!" else ""))//debug
+ def append(suffix: String): Name
+ def append(suffix: Name): Name
+
def isOperatorName: Boolean = decode != toString
}
- private class TermName(index: Int, len: Int, hash: Int) extends Name(index, len) {
- next = termHashtable(hash)
+ final class TermName(index: Int, len: Int, hash: Int) extends Name(index, len) {
+ var next: TermName = termHashtable(hash)
termHashtable(hash) = this
def isTermName: Boolean = true
def isTypeName: Boolean = false
@@ -413,10 +416,14 @@ trait Names extends reflect.generic.Names {
}
def subName(from: Int, to: Int): Name =
newTermName(chrs, start + from, to - from)
+
+ def append(suffix: String): TermName = newTermName(this + suffix)
+ def append(suffix: Name): TermName = append(suffix.toString)
+
}
- private class TypeName(index: Int, len: Int, hash: Int) extends Name(index, len) {
- next = typeHashtable(hash)
+ final class TypeName(index: Int, len: Int, hash: Int) extends Name(index, len) {
+ var next: TypeName = typeHashtable(hash)
typeHashtable(hash) = this
def isTermName: Boolean = false
def isTypeName: Boolean = true
@@ -432,5 +439,9 @@ trait Names extends reflect.generic.Names {
def toTypeName: Name = this
def subName(from: Int, to: Int): Name =
newTypeName(chrs, start + from, to - from)
+
+ def append(suffix: String): TypeName = newTypeName(this + suffix)
+ def append(suffix: Name): TypeName = append(suffix.toString)
+
}
}
diff --git a/src/compiler/scala/tools/nsc/symtab/StdNames.scala b/src/compiler/scala/tools/nsc/symtab/StdNames.scala
index 8c4078e91e..69af23c912 100644
--- a/src/compiler/scala/tools/nsc/symtab/StdNames.scala
+++ b/src/compiler/scala/tools/nsc/symtab/StdNames.scala
@@ -143,7 +143,6 @@ trait StdNames extends reflect.generic.StdNames { self: SymbolTable =>
(name, "", "")
def localToGetter(name: Name): Name = {
- assert(isLocalName(name))//debug
name.subName(0, name.length - LOCAL_SUFFIX.length)
}
@@ -166,6 +165,9 @@ trait StdNames extends reflect.generic.StdNames { self: SymbolTable =>
def getterName(name: Name): Name =
if (isLocalName(name)) localToGetter(name) else name;
+ def isConstructorName(name: Name) =
+ name == CONSTRUCTOR || name == MIXIN_CONSTRUCTOR
+
def isImplClassName(name: Name): Boolean =
name endsWith IMPL_CLASS_SUFFIX;
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
index 046c5c596a..b1c8ec1536 100644
--- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
@@ -437,6 +437,8 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable =>
final def isPackageObject = isModule && name == nme.PACKAGEkw && owner.isPackageClass
final def isPackageObjectClass = isModuleClass && name.toTermName == nme.PACKAGEkw && owner.isPackageClass
final def definedInPackage = owner.isPackageClass || owner.isPackageObjectClass
+ final def isJavaInterface = hasFlag(JAVA) && isTrait
+
final def isPredefModule = isModule && name == nme.Predef && owner.isScalaPackageClass // not printed as a prefix
final def isScalaPackage = isPackage && name == nme.scala_ && owner.isRoot || // not printed as a prefix
isPackageObject && owner.isScalaPackageClass
@@ -1617,6 +1619,11 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable =>
def infosString = infos.toString()
+ def hasFlagsToString(mask: Long): String = flagsToString(
+ flags & mask,
+ if (hasAccessBoundary) privateWithin.toString else ""
+ )
+
/** String representation of symbol's variance */
def varianceString: String =
if (variance == 1) "+"