summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2008-04-22 16:05:59 +0000
committermichelou <michelou@epfl.ch>2008-04-22 16:05:59 +0000
commit9a78b52ba3141c8893641919ec1a3c541e3c6330 (patch)
tree6ac456963ba9db2792951cbe696e0a12bbdd3018
parentfbe6aa9fc7e12d7fb17b29f1441c2c7e0489ceb1 (diff)
downloadscala-9a78b52ba3141c8893641919ec1a3c541e3c6330.tar.gz
scala-9a78b52ba3141c8893641919ec1a3c541e3c6330.tar.bz2
scala-9a78b52ba3141c8893641919ec1a3c541e3c6330.zip
added test for outer in Namers.scala
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Definitions.scala76
-rw-r--r--src/compiler/scala/tools/nsc/symtab/StdNames.scala1
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala7
3 files changed, 39 insertions, 45 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
index 3c23a8f481..c868907a55 100644
--- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
@@ -80,12 +80,6 @@ trait Definitions {
var FloatClass: Symbol = _
var DoubleClass: Symbol = _
- // remote classes
- //lazy val RemoteRefClass = getClass("scala.runtime.RemoteRef")
- //lazy val RemoteRefModule = getModule("scala.runtime.RemoteRef")
- //lazy val RemoteObjectRefClass = getClass("scala.runtime.remoting.RemoteObjectRef")
- //var RemoteRefClasses: HashMap[Symbol, Symbol] = _
-
// the scala reference classes
lazy val ScalaObjectClass: Symbol = getClass("scala.ScalaObject")
def ScalaObjectClass_tag = getMember(ScalaObjectClass, nme.tag)
@@ -196,8 +190,8 @@ trait Definitions {
lazy val OptionClass: Symbol = getClass("scala.Option")
- lazy val SomeClass : Symbol = getClass("scala.Some")
- lazy val NoneClass : Symbol = getModule("scala.None")
+ lazy val SomeClass: Symbol = getClass("scala.Some")
+ lazy val NoneClass: Symbol = getModule("scala.None")
def isOptionType(tp: Type) = tp.normalize match {
case TypeRef(_, sym, List(_)) if sym == OptionClass => true
@@ -693,7 +687,7 @@ trait Definitions {
EqualsPatternClass = newClass(ScalaPackageClass, nme.EQUALS_PATTERN_NAME, List());
{
- val tparam = newTypeParam(EqualsPatternClass, 0);
+ val tparam = newTypeParam(EqualsPatternClass, 0)
EqualsPatternClass.setInfo(
PolyType(
List(tparam),
@@ -764,49 +758,43 @@ trait Definitions {
val stringParam = List(stringType)
// additional methods of Object
- newMethod(ObjectClass, "clone", List(), AnyRefClass.typeConstructor);
- newMethod(ObjectClass, "wait", List(), unitType);
- newMethod(ObjectClass, "wait", List(longType), unitType);
- newMethod(ObjectClass, "wait", List(longType, intType), unitType);
- newMethod(ObjectClass, "notify", List(), unitType);
- newMethod(ObjectClass, "notifyAll", List(), unitType);
+ newMethod(ObjectClass, "clone", List(), AnyRefClass.typeConstructor)
+ newMethod(ObjectClass, "wait", List(), unitType)
+ newMethod(ObjectClass, "wait", List(longType), unitType)
+ newMethod(ObjectClass, "wait", List(longType, intType), unitType)
+ newMethod(ObjectClass, "notify", List(), unitType)
+ newMethod(ObjectClass, "notifyAll", List(), unitType)
// additional methods of String
- newMethod(StringClass, "length", List(), intType);
- newMethod(StringClass, "compareTo", stringParam, intType);
- newMethod(StringClass, "charAt", intParam, charType);
- newMethod(StringClass, "concat", stringParam, stringType);
- newMethod(StringClass, "indexOf", intParam, intType);
- newMethod(StringClass, "indexOf", List(intType, intType), intType);
- newMethod(StringClass, "indexOf", stringParam, intType);
- newMethod(StringClass, "indexOf", List(stringType, intType), intType);
- newMethod(StringClass, "lastIndexOf", intParam, intType);
- newMethod(StringClass, "lastIndexOf", List(intType, intType), intType);
- newMethod(StringClass, "lastIndexOf", stringParam, intType);
- newMethod(StringClass, "lastIndexOf", List(stringType, intType), intType);
- newMethod(StringClass, "toLowerCase", List(), stringType);
- newMethod(StringClass, "toUpperCase", List(), stringType);
- newMethod(StringClass, "startsWith", stringParam, booltype);
- newMethod(StringClass, "endsWith", stringParam, booltype);
- newMethod(StringClass, "substring", intParam, stringType);
- newMethod(StringClass, "substring", List(intType, intType), stringType);
- newMethod(StringClass, "trim", List(), stringType);
- newMethod(StringClass, "intern", List(), stringType);
- newMethod(StringClass, "replace", List(charType, charType), stringType);
+ newMethod(StringClass, "length", List(), intType)
+ newMethod(StringClass, "compareTo", stringParam, intType)
+ newMethod(StringClass, "charAt", intParam, charType)
+ newMethod(StringClass, "concat", stringParam, stringType)
+ newMethod(StringClass, "indexOf", intParam, intType)
+ newMethod(StringClass, "indexOf", List(intType, intType), intType)
+ newMethod(StringClass, "indexOf", stringParam, intType)
+ newMethod(StringClass, "indexOf", List(stringType, intType), intType)
+ newMethod(StringClass, "lastIndexOf", intParam, intType)
+ newMethod(StringClass, "lastIndexOf", List(intType, intType), intType)
+ newMethod(StringClass, "lastIndexOf", stringParam, intType)
+ newMethod(StringClass, "lastIndexOf", List(stringType, intType), intType)
+ newMethod(StringClass, "toLowerCase", List(), stringType)
+ newMethod(StringClass, "toUpperCase", List(), stringType)
+ newMethod(StringClass, "startsWith", stringParam, booltype)
+ newMethod(StringClass, "endsWith", stringParam, booltype)
+ newMethod(StringClass, "substring", intParam, stringType)
+ newMethod(StringClass, "substring", List(intType, intType), stringType)
+ newMethod(StringClass, "trim", List(), stringType)
+ newMethod(StringClass, "intern", List(), stringType)
+ newMethod(StringClass, "replace", List(charType, charType), stringType)
newMethod(StringClass, "toCharArray", List(),
- appliedType(ArrayClass.typeConstructor, List(charType)));
+ appliedType(ArrayClass.typeConstructor, List(charType)))
}
AnnotationDefaultAttr = newClass(RootClass,
nme.AnnotationDefaultATTR,
List(AnnotationClass.typeConstructor))
-
- //RemoteRefClasses = new HashMap[Symbol, Symbol]
- //for (clazz <- refClass.values) {
- // RemoteRefClasses(clazz) = getClass("scala.runtime.remoting.Remote" + clazz.name)
- //}
- //RemoteRefClasses(ObjectRefClass) = RemoteObjectRefClass
- }
+ } //init
var nbScalaCallers: Int = 0
def newScalaCaller(delegateType: Type): Symbol = {
diff --git a/src/compiler/scala/tools/nsc/symtab/StdNames.scala b/src/compiler/scala/tools/nsc/symtab/StdNames.scala
index 6b700d2f36..3d39632ac9 100644
--- a/src/compiler/scala/tools/nsc/symtab/StdNames.scala
+++ b/src/compiler/scala/tools/nsc/symtab/StdNames.scala
@@ -340,6 +340,7 @@ trait StdNames {
val unapplySeq = newTermName("unapplySeq")
val unbind = newTermName("unbind")
val unbox = newTermName("unbox")
+ val unreferenced = newTermName("unreferenced")
val update = newTermName("update")
val value = newTermName("value")
val view_ = newTermName("view")
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 6228429f98..dcaea1041b 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -325,7 +325,12 @@ trait Namers { self: Analyzer =>
finish
case ValDef(mods, name, tp, rhs) =>
- if (context.owner.isClass && (mods.flags & (PRIVATE | LOCAL)) != (PRIVATE | LOCAL)
+ if (name.endsWith(nme.OUTER, nme.OUTER.length)) { // SM
+ tree.symbol = enterInScope(owner.newValue(tree.pos, name)
+ .setFlag(mods.flags))
+ finish
+ }
+ else if (context.owner.isClass && (mods.flags & (PRIVATE | LOCAL)) != (PRIVATE | LOCAL)
|| (mods.flags & LAZY) != 0) {
val accflags: Long = ACCESSOR |
(if ((mods.flags & MUTABLE) != 0) mods.flags & ~MUTABLE & ~PRESUPER