summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormihaylov <mihaylov@epfl.ch>2006-05-17 08:42:01 +0000
committermihaylov <mihaylov@epfl.ch>2006-05-17 08:42:01 +0000
commit98e286c19736adf7b70ae4c89c0d545e09a28dc2 (patch)
treeb7ff64a4a402b4a69a28ecdc7c4bb324e49a8633
parent8ab0305de71c63d8dcdba023fdb305202da57edd (diff)
downloadscala-98e286c19736adf7b70ae4c89c0d545e09a28dc2.tar.gz
scala-98e286c19736adf7b70ae4c89c0d545e09a28dc2.tar.bz2
scala-98e286c19736adf7b70ae4c89c0d545e09a28dc2.zip
Improved CLDC support
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Definitions.scala10
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala17
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala4
3 files changed, 17 insertions, 14 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
index dabbc842ae..38c90278ed 100644
--- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
@@ -60,7 +60,7 @@ trait Definitions requires SymbolTable {
def ScalaObjectClass_tag = getMember(ScalaObjectClass, nme.tag);
var AttributeClass: Symbol = _;
//var RemoteRefClass: Symbol = _
- var TypedCodeClass: Symbol = _;
+ //var TypedCodeClass: Symbol = _;
var CodeClass: Symbol = _;
var CodeModule: Symbol = _;
var PartialFunctionClass: Symbol = _;
@@ -476,8 +476,10 @@ trait Definitions requires SymbolTable {
ScalaObjectClass = getClass("scala.ScalaObject");
AttributeClass = getClass("scala.Attribute");
//RemoteRefClass = getClass("scala.distributed.RemoteRef");
- CodeClass = getClass("scala.reflect.Code");
- CodeModule = getModule("scala.reflect.Code");
+ if (!forCLDC) {
+ CodeClass = getClass("scala.reflect.Code");
+ CodeModule = getModule("scala.reflect.Code");
+ }
PartialFunctionClass = getClass("scala.PartialFunction");
IterableClass = getClass("scala.Iterable");
IteratorClass = getClass("scala.Iterator");
@@ -551,7 +553,7 @@ trait Definitions requires SymbolTable {
ObjectRefClass = getClass("scala.runtime.ObjectRef");
SerializableAttr = getClass("scala.serializable");
- BeanPropertyAttr = getClass("scala.reflect.BeanProperty");
+ BeanPropertyAttr = if (forCLDC) null else getClass("scala.reflect.BeanProperty");
}
}
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
index 7f06291c7c..a5c6abb92a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
@@ -197,14 +197,15 @@ trait SyntheticMethods requires Analyzer {
// jw-04-2003/jw-0425-designpatterns_p.html)
if (!hasImplementation(nme.readResolve)) ts += readResolveMethod;
}
- for (val sym <- clazz.info.decls.toList)
- if (!sym.getAttributes(BeanPropertyAttr).isEmpty)
- if (sym.isGetter)
- addBeanGetterMethod(sym)
- else if (sym.isSetter)
- addBeanSetterMethod(sym)
- else if (sym.isMethod || sym.isType)
- unit.error(sym.pos, "attribute `BeanProperty' is not applicable to " + sym);
+ if (!forCLDC)
+ for (val sym <- clazz.info.decls.toList)
+ if (!sym.getAttributes(BeanPropertyAttr).isEmpty)
+ if (sym.isGetter)
+ addBeanGetterMethod(sym)
+ else if (sym.isSetter)
+ addBeanSetterMethod(sym)
+ else if (sym.isMethod || sym.isType)
+ unit.error(sym.pos, "attribute `BeanProperty' is not applicable to " + sym);
}
val synthetics = ts.toList;
copy.Template(
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 81ac6b0458..68d569bfae 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -926,7 +926,7 @@ trait Typers requires Analyzer {
Triple(FunctionClass(fun.vparams.length), fun.vparams map (x => NoType), WildcardType)
val Triple(clazz, argpts, respt) =
- decompose(if (pt.symbol isSubClass CodeClass) pt.typeArgs.head else pt)
+ decompose(if (!forCLDC && (pt.symbol isSubClass CodeClass)) pt.typeArgs.head else pt)
if (fun.vparams.length != argpts.length)
errorTree(fun, "wrong number of parameters; expected = "+argpts.length)
@@ -951,7 +951,7 @@ trait Typers requires Analyzer {
val funtpe = typeRef(clazz.tpe.prefix, clazz, formals ::: List(restpe))
val fun1 = copy.Function(fun, vparams, checkNoEscaping.locals(context.scope, restpe, body))
.setType(funtpe)
- if (pt.symbol isSubClass CodeClass) {
+ if (!forCLDC && (pt.symbol isSubClass CodeClass)) {
val liftPoint = Apply(Select(Ident(CodeModule), nme.lift_), List(fun1))
typed(atPos(fun.pos)(liftPoint))
} else fun1