summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorAleksandar Prokopec <aleksandar@aleksandar-Latitude-E6500.(none)>2012-07-20 15:15:41 +0200
committerAleksandar Prokopec <aleksandar@aleksandar-Latitude-E6500.(none)>2012-07-20 15:15:41 +0200
commit124f316b0813116c6574f60737e5b63f06f4329e (patch)
tree04c632d3a4c75ab74266747f9773b94fcbe4778d /src/compiler
parent227239018b38ab7218ee6b30493c9c8e1836c8c9 (diff)
downloadscala-124f316b0813116c6574f60737e5b63f06f4329e.tar.gz
scala-124f316b0813116c6574f60737e5b63f06f4329e.tar.bz2
scala-124f316b0813116c6574f60737e5b63f06f4329e.zip
Use `findMember` to lookup the static field in the host class.
The upcoming `findMember` optimizations should ensure that this is fast enough.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/GenICode.scala12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
index 9ec212b084..982267097b 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
@@ -116,14 +116,14 @@ abstract class GenICode extends SubComponent {
if (m.symbol.isAccessor && m.symbol.accessed.hasStaticAnnotation) {
// in companion object accessors to @static fields, we access the static field directly
val hostClass = m.symbol.owner.companionClass
- val staticfield = hostClass.info.decls.find(_.name.toString.trim == m.symbol.accessed.name.toString.trim)
+ val staticfield = hostClass.info.findMember(m.symbol.accessed.name, NoFlags, NoFlags, false)
if (m.symbol.isGetter) {
- ctx1.bb.emit(LOAD_FIELD(staticfield.get, true) setHostClass hostClass, tree.pos)
+ ctx1.bb.emit(LOAD_FIELD(staticfield, true) setHostClass hostClass, tree.pos)
ctx1.bb.closeWith(RETURN(m.returnType))
} else if (m.symbol.isSetter) {
ctx1.bb.emit(LOAD_LOCAL(m.locals.head), tree.pos)
- ctx1.bb.emit(STORE_FIELD(staticfield.get, true), tree.pos)
+ ctx1.bb.emit(STORE_FIELD(staticfield, true), tree.pos)
ctx1.bb.closeWith(RETURN(m.returnType))
} else assert(false, "unreachable")
} else {
@@ -878,14 +878,14 @@ abstract class GenICode extends SubComponent {
val sym = fun.symbol
generatedType = toTypeKind(sym.accessed.info)
val hostClass = qual.tpe.typeSymbol.orElse(sym.owner).companionClass
- val staticfield = hostClass.info.decls.find(_.name.toString.trim == sym.accessed.name.toString.trim)
+ val staticfield = hostClass.info.findMember(sym.accessed.name, NoFlags, NoFlags, false)
if (sym.isGetter) {
- ctx.bb.emit(LOAD_FIELD(staticfield.get, true) setHostClass hostClass, tree.pos)
+ ctx.bb.emit(LOAD_FIELD(staticfield, true) setHostClass hostClass, tree.pos)
ctx
} else if (sym.isSetter) {
val ctx1 = genLoadArguments(args, sym.info.paramTypes, ctx)
- ctx1.bb.emit(STORE_FIELD(staticfield.get, true), tree.pos)
+ ctx1.bb.emit(STORE_FIELD(staticfield, true), tree.pos)
ctx1.bb.emit(CONSTANT(Constant(false)), tree.pos)
ctx1
} else {