diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2009-11-20 17:25:08 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2009-11-20 17:25:08 +0000 |
commit | 346aff23bf186ab911e12c856ba837e50aa218b3 (patch) | |
tree | 016297b9ab41bfee6956386d4d2ff73d99fda249 /src/compiler/scala/tools/nsc/backend/icode/Members.scala | |
parent | 88b60e35e60304b6e31cec8c53542855c30197bb (diff) | |
download | scala-346aff23bf186ab911e12c856ba837e50aa218b3.tar.gz scala-346aff23bf186ab911e12c856ba837e50aa218b3.tar.bz2 scala-346aff23bf186ab911e12c856ba837e50aa218b3.zip |
Changes made in the clean up phase - now the sy...
Changes made in the clean up phase - now the symbols get interned during classload for each symbol literal - references to them reside in static fields. These static fields get initialized in static constructors - the java backend will now identify ctors with static flags and generate a static initializer containing the necessary code.
Diffstat (limited to 'src/compiler/scala/tools/nsc/backend/icode/Members.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/icode/Members.scala | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Members.scala b/src/compiler/scala/tools/nsc/backend/icode/Members.scala index 35eeec316e..65616c9a1f 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Members.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Members.scala @@ -113,6 +113,11 @@ trait Members { self: ICodes => def lookupField(s: Symbol) = fields find (_.symbol == s) def lookupMethod(s: Symbol) = methods find (_.symbol == s) def lookupMethod(s: Name) = methods find (_.symbol.name == s) + + /* determines whether or not this class contains a static ctor. */ + def containsStaticCtor: Boolean = methods.exists(_.isStaticCtor) // alex + /* returns this methods static ctor if it has one. */ + def lookupStaticCtor: Option[IMethod] = methods.find(_.isStaticCtor) // alex } /** Represent a field in ICode */ @@ -193,6 +198,9 @@ trait Members { self: ICodes => def isStatic: Boolean = symbol.isStaticMember + /* determines whether or not this method is the class static constructor. */ + def isStaticCtor: Boolean = isStatic && symbol.rawname == nme.CONSTRUCTOR + override def toString() = symbol.fullNameString import opcodes._ |