now actually removing plugin.quick

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@15297 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
rytz 2008-06-09 13:17:59 +00:00
parent 29fd9aca03
commit 964f4b3bb5
14 changed files with 97 additions and 57 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>scala</name>
<name>trunk</name>
<comment></comment>
<projects>
</projects>

View File

@ -602,30 +602,6 @@ PACKED QUICK BUILD (PACK)
<delete dir="${build-pack.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
</target>
<!-- ===========================================================================
PACKED QUICK BUILD FOR ECLIPSE PLUGINDEVELOPMENT (PLUGIN)
============================================================================ -->
<target name="pack.pre-libsrc" depends="pack.start">
<uptodate
property="pack.libsrc.available"
targetfile="${build-pack.dir}/lib/scala-library-src.jar"
srcfile="${build-quick.dir}/librarysrc.complete"/>
</target>
<target name="pack.libsrc" depends="pack.pre-libsrc">
<mkdir dir="${build-pack.dir}/src"/>
<jar destfile="${build-pack.dir}/src/scala-library-src.jar">
<fileset dir="${src.dir}/library"/>
<fileset dir="${src.dir}/actors"/>
</jar>
<jar destfile="${build-pack.dir}/src/scala-dbc-src.jar">
<fileset dir="${src.dir}/dbc"/>
</jar>
</target>
<target name="plugin.quick" depends="pack.lib, pack.libsrc"/>
<!-- ===========================================================================
BOOTSTRAPPING BUILD (STRAP)
============================================================================ -->

View File

@ -1,15 +1,15 @@
#Fri May 23 08:03:52 CEST 2008
#Mon Jun 09 10:07:56 CEST 2008
activeContentFilterList=*.makefile,makefile,*.Makefile,Makefile,Makefile.*,*.mk,MANIFEST.MF
convertActionOnSaave=AnyEdit.CnvrtTabToSpaces
eclipse.preferences.version=1
inActiveContentFilterList=
javaTabWidthForJava=true
org.eclipse.jdt.ui.editor.tab.width=2
projectPropsEnabled=false
projectPropsEnabled=true
removeTrailingSpaces=true
replaceAllSpaces=false
replaceAllTabs=false
saveAndAddLine=false
saveAndConvert=false
saveAndTrim=true
saveAndTrim=false
useModulo4Tabs=false

View File

@ -34,6 +34,10 @@ extends Global(settings, reporter) {
})
*/
/** The phases to be run.
*
* @todo: Adapt to specific plugin implementation
*/
override def phaseDescriptors: List[SubComponent] = List(
analyzer.namerFactory,
analyzer.typerFactory,

View File

@ -451,6 +451,10 @@ class Scalac extends MatchingTask {
\*============================================================================*/
protected val sourceEnding = ".scala"
protected def binaryEnding = backend match {
case Some("msil") => ".msil"
case _ => ".class"
}
protected def newSettings(error: String=>Unit): Settings =
new Settings(error)
protected def newGlobal(settings: Settings, reporter: Reporter) =
@ -470,8 +474,10 @@ class Scalac extends MatchingTask {
error("Attribute 'destdir' does not refer to an existing directory.")
if (destination.isEmpty) destination = Some(getOrigin.head)
// TODO msil: map packages (will be in filename for .msil files). Use
// RegexppatternMapper (?)
val mapper = new GlobPatternMapper()
mapper.setTo("*.class")
mapper.setTo("*" + binaryEnding)
mapper.setFrom("*" + sourceEnding)
// Scans source directories to build up a compile lists.

View File

@ -1595,7 +1595,12 @@ trait Parsers extends NewScanners with MarkupParsers {
accept(VAL)
val aname = ident()
accept(EQUALS)
val rhs = stripParens(prefixExpr())
val rhs =
if (inToken == AT) {
inNextToken
annotationExpr()
} else
stripParens(prefixExpr())
atPos(pos) { ValDef(NoMods, aname, TypeTree(), rhs) }
}
val pos = inCurrentPos

View File

@ -362,6 +362,9 @@ abstract class GenJVM extends SubComponent {
val arr = const.arrayValue
buf.putShort(arr.length.toShort)
for (val elem <- arr) emitElement(elem)
case AnnotationTag =>
// TODO: implement
()
}
var nattr = 0

View File

@ -27,17 +27,25 @@ trait AnnotationInfos {
trees2consArray(members, tree.tpe)
case Apply(meth, members)
case Apply(meth, members)
if (definitions.ArrayModule_apply.alternatives contains meth.symbol) =>
trees2consArray(members, tree.tpe)
case Typed(t, _) => tree2cons(t)
case Annotation(constr, elements) =>
/* val annotInfo = typer.tpyedAnnotation(tree)
if (annotInfo isConstant)
Some(new AnnotationConstant(annotInfo))
else */
println("getting annotation: "+ tree)
None
case tree =>
//println("could not convert: " + tree);
None
}
private def trees2consArray(trees: Seq[Tree], arrayType:Type)
: Option[Constant] =
{
@ -56,9 +64,25 @@ trait AnnotationInfos {
* and it includes a compile-time constant for the tree if possible.
*/
class AnnotationArgument(val intTree: Tree) {
def this(cons: Constant) = this(
Literal(cons).setType(cons.tpe))
/** This constructor is also used to create an AnnotationArgument
* containing a ArrayConstant, when an array of constants is seen
* in a parsed classfile (ClassfileParser.parseTaggedConstant).
* I.E. for Arrays of constants, intTree looks like:
* <ul>
* <li> Apply(ArrayModule_apply, members) if the AnnotationArgument
* is part of an Annotation in Scala source </li>
* <li> Literal(ArrayConstant(constants, tpe)) if the the argument
* was created when parsing a java annotation in a classfile</li>
* </ul>
*/
def this(cons: Constant) {
this(
Literal(cons).setType(cons.tpe))
println("AnnotationArgument constructor with constant: "+ cons)
}
//def this(annTree: Annotation, annConst: AnnotationConstant)
@deprecated
lazy val tree = {

View File

@ -51,6 +51,7 @@ trait Constants {
else if (value.isInstanceOf[Type]) ClassTag
else if (value.isInstanceOf[Symbol]) EnumTag
else if (value.isInstanceOf[Array[Constant]]) ArrayTag
else if (value.isInstanceOf[AnnotationInfo]) AnnotationTag
else if (value == null) NullTag
else throw new Error("bad constant value: " + value)
@ -68,7 +69,9 @@ trait Constants {
case NullTag => AllRefClass.tpe
case ClassTag => Predef_classOfType(value.asInstanceOf[Type])
case EnumTag => symbolValue.owner.linkedClassOfClass.tpe
case AnnotationTag => AnnotationClass.tpe // what should it be?
// ArrayTag not required; method tpe is overwritten in ArrayConstant
case AnnotationTag => annotationInfoValue.atp
//AnnotationClass.tpe // what should it be?
}
/** We need the equals method to take account of tags as well as values.
@ -222,6 +225,9 @@ trait Constants {
def symbolValue: Symbol = value.asInstanceOf[Symbol]
def annotationInfoValue: AnnotationInfo =
throw new Error("value " + value + " is not an array")
def arrayValue: Array[Constant] =
throw new Error("value " + value + " is not an array")
@ -235,10 +241,8 @@ trait Constants {
override def toString() = arrayValue.mkString("Constant(", "," , ")")
}
/** A place-holder for annotation constants. The contents of
* the constant are not read. */
class AnnotationConstant()
extends Constant(null) {
override val tag = AnnotationTag
class AnnotationConstant(override val annotationInfoValue: AnnotationInfo)
extends Constant(annotationInfoValue) {
assert(annotationInfoValue.isConstant, annotationInfoValue)
}
}

View File

@ -573,6 +573,7 @@ trait Symbols {
if (validTo < curPeriod) {
var itr = infoTransformers.nextFrom(phaseId(validTo))
infoTransformers = itr; // caching optimization
//println("running info transformer: "+ itr)
while (itr.pid != NoPhase.id && itr.pid < current.id) {
phase = phaseWithId(itr.pid)
val info1 = itr.transform(this, infos.info)

View File

@ -663,10 +663,16 @@ abstract class ClassfileParser {
staticModule.moduleClass.sourceFile = clazz.sourceFile
}
}
// Methods of a java annotation class wear this annotation when they
// provide a default value. The actual value does not need to be known
// in order to compile other classes
case nme.AnnotationDefaultATTR =>
sym.attributes =
AnnotationInfo(definitions.AnnotationDefaultAttr.tpe, List(), List()) :: sym.attributes
in.skip(attrLen)
// Java annotatinos present in classfiles (when the java annotation class is
// itself annotated with @Renention(RetentionPolicy.RUNTIME) or .CLASS) are
// stored in a "RuntimeVisibleAnnotation" (i.e. nme.RuntimeAnnotationATTR)
case nme.RuntimeAnnotationATTR =>
parseAnnotations(attrLen)
if (settings.debug.value)
@ -704,8 +710,8 @@ abstract class ClassfileParser {
new ArrayConstant(arr.toArray,
appliedType(definitions.ArrayClass.typeConstructor, List(arr(0).tpe)))
case ANNOTATION_TAG =>
parseAnnotation(index) // skip it
new AnnotationConstant()
val info = parseAnnotation(index)
new AnnotationConstant(info)
}
}
@ -713,7 +719,7 @@ abstract class ClassfileParser {
* throw an exception. If it contains a nested annotation,
* return None.
*/
def parseAnnotation(attrNameIndex: Char): Option[AnnotationInfo] = {
def parseAnnotation(attrNameIndex: Char): /* Option[ */ AnnotationInfo /*]*/ = {
val attrType = pool.getType(attrNameIndex)
val nargs = in.nextChar
val nvpairs = new ListBuffer[(Name,AnnotationArgument)]
@ -722,16 +728,16 @@ abstract class ClassfileParser {
for (i <- 0 until nargs) {
val name = pool.getName(in.nextChar)
val argConst = parseTaggedConstant
if (argConst.tag == AnnotationTag)
nestedAnnot = true
else
//if (argConst.tag == AnnotationTag)
//nestedAnnot = true
//else
nvpairs += ((name, new AnnotationArgument(argConst)))
}
if (nestedAnnot)
None
else
Some(AnnotationInfo(attrType, List(), nvpairs.toList))
//if (nestedAnnot)
//None
//else
AnnotationInfo(attrType, List(), nvpairs.toList)
}
/** Parse a sequence of annotations and attach them to the
@ -740,7 +746,7 @@ abstract class ClassfileParser {
def parseAnnotations(len: Int) {
val nAttr = in.nextChar
for (n <- 0 until nAttr)
parseAnnotation(in.nextChar) match {
/* parseAnnotation(in.nextChar) match {
case None =>
if (settings.debug.value)
global.inform("dropping annotation on " +
@ -748,7 +754,8 @@ abstract class ClassfileParser {
" that has a nested annotation")
case Some(annot) =>
sym.attributes = annot :: sym.attributes
}
}*/
sym.attributes = parseAnnotation(in.nextChar) :: sym.attributes
}
def makeInnerAlias(outer: Symbol, name: Name, iclazz: Symbol, scope: Scope): Symbol = {

View File

@ -138,6 +138,7 @@ abstract class Pickler extends SubComponent {
putChildren(sym, children.sort((x, y) => x isLess y))
}
for (attr <- sym.attributes.reverse) {
println("put annot? "+ attr +", "+ (attr.atp.typeSymbol isNonBottomSubClass definitions.StaticAnnotationClass))
if (attr.atp.typeSymbol isNonBottomSubClass definitions.StaticAnnotationClass)
putAnnotation(sym, attr)
}
@ -290,6 +291,7 @@ abstract class Pickler extends SubComponent {
putTrees(args)
case ArrayValue(elemtpt, trees) =>
println("putting array value: "+ trees)
putTree(elemtpt)
putTrees(trees)
@ -397,17 +399,19 @@ abstract class Pickler extends SubComponent {
private def putMods(mods: Modifiers) = if (putEntry(mods)) {
val Modifiers(flags, privateWithin, annotations) = mods
putEntry(privateWithin)
println("putting annotation trees: "+ annotations)
putTrees(annotations)
}
/** Store a constant in map <code>index</code> along with
* anything it references.
*/
private def putConstant(c: Constant) =
private def putConstant(c: Constant) = {
if (putEntry(c)) {
if (c.tag == StringTag) putEntry(newTermName(c.stringValue))
else if (c.tag == ClassTag) putEntry(c.typeValue)
}
}
private def putChildren(sym: Symbol, children: List[Symbol]) {
assert(putEntry((sym, children)))
@ -415,6 +419,7 @@ abstract class Pickler extends SubComponent {
}
private def putAnnotation(sym: Symbol, annot: AnnotationInfo) {
println("putting annotation: "+ annot)
assert(putEntry((sym, annot)))
val AnnotationInfo(atp, args, assocs) = annot
putType(atp)
@ -432,10 +437,11 @@ abstract class Pickler extends SubComponent {
}
private def putAnnotationArg(arg: AnnotationArgument) {
println("putting annotation arg: "+ arg)
if (putEntry(arg)) {
arg.constant match {
case Some(c) => putConstant(c)
case _ => putTree(arg.intTree)
case Some(c) => println(" const: "+ c); putConstant(c)
case _ => println(" tree: "+ arg.intTree); putTree(arg.intTree)
}
}
}
@ -534,6 +540,7 @@ abstract class Pickler extends SubComponent {
case DeBruijnIndex(l, i) =>
writeNat(l); writeNat(i); DEBRUIJNINDEXtpe
case c @ Constant(_) =>
println("putting constant with tag: "+ c.tag)
if (c.tag == BooleanTag) writeLong(if (c.booleanValue) 1 else 0)
else if (ByteTag <= c.tag && c.tag <= LongTag) writeLong(c.longValue)
else if (c.tag == FloatTag) writeLong(Float.floatToIntBits(c.floatValue))
@ -729,6 +736,7 @@ abstract class Pickler extends SubComponent {
TREE
case tree@ArrayValue(elemtpt, trees) =>
println("arrayValue tree: "+ trees)
writeNat(ARRAYVALUEtree)
writeRef(tree.tpe)
writeRef(elemtpt)
@ -929,6 +937,7 @@ abstract class Pickler extends SubComponent {
ANNOTINFO
case arg:AnnotationArgument =>
println("writing AnnotationArgument: "+ arg)
arg.constant match {
case Some(c) => writeBody(c)
case None => writeBody(arg.intTree)

View File

@ -30,6 +30,7 @@ trait InfoTransform extends Transform {
val pid = id
val changesBaseClasses = InfoTransform.this.changesBaseClasses
def transform(sym: Symbol, tpe: Type): Type = transformInfo(sym, tpe)
override def toString() = InfoTransform.this.toString()
}
infoTransformers.insert(infoTransformer)
}

View File

@ -1987,7 +1987,7 @@ trait Typers { self: Analyzer =>
} else {
names -= sym
val annArg =
annotArg(
annotArg( // also checks that rhs is constant
typed(rhs, EXPRmode, sym.tpe.resultType))
(sym.name, annArg)
}