diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-07-02 13:51:06 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-07-03 13:31:36 +0200 |
commit | 2ad2ef9d129b209edb9377da0899f5f35b674197 (patch) | |
tree | 821e687fa2f475eafd0871cd8b55c21fdf5404f1 /src/reflect | |
parent | bc2e6fe8bf20b2aa985ea78a2c610ac33497da38 (diff) | |
download | scala-2ad2ef9d129b209edb9377da0899f5f35b674197.tar.gz scala-2ad2ef9d129b209edb9377da0899f5f35b674197.tar.bz2 scala-2ad2ef9d129b209edb9377da0899f5f35b674197.zip |
SI-5990 u.build now correctly invokes missing symbol hooks
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/internal/BuildUtils.scala | 24 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/Mirrors.scala | 4 |
2 files changed, 16 insertions, 12 deletions
diff --git a/src/reflect/scala/reflect/internal/BuildUtils.scala b/src/reflect/scala/reflect/internal/BuildUtils.scala index 3bde57ded8..0bf5aa4b69 100644 --- a/src/reflect/scala/reflect/internal/BuildUtils.scala +++ b/src/reflect/scala/reflect/internal/BuildUtils.scala @@ -7,19 +7,21 @@ trait BuildUtils extends base.BuildUtils { self: SymbolTable => class BuildImpl extends BuildBase { - def selectType(owner: Symbol, name: String): TypeSymbol = { - val result = owner.info.decl(newTypeName(name)) - if (result ne NoSymbol) result.asTypeSymbol - else MissingRequirementError.notFound("type %s in %s".format(name, owner.fullName)) - } + def selectType(owner: Symbol, name: String): TypeSymbol = + select(owner, newTypeName(name)).asTypeSymbol def selectTerm(owner: Symbol, name: String): TermSymbol = { - val sym = owner.info.decl(newTermName(name)) - val result = - if (sym.isOverloaded) sym.suchThat(!_.isMethod) - else sym - if (result ne NoSymbol) result.asTermSymbol - else MissingRequirementError.notFound("term %s in %s".format(name, owner.fullName)) + val result = select(owner, newTermName(name)).asTermSymbol + if (result.isOverloaded) result.suchThat(!_.isMethod).asTermSymbol + else result + } + + private def select(owner: Symbol, name: Name): Symbol = { + val result = owner.info decl name + if (result ne NoSymbol) result + else + mirrorThatLoaded(owner).tryMissingHooks(owner, name) orElse + MissingRequirementError.notFound("%s %s in %s".format(if (name.isTermName) "term" else "type", name, owner.fullName)) } def selectOverloadedMethod(owner: Symbol, name: String, index: Int): MethodSymbol = { diff --git a/src/reflect/scala/reflect/internal/Mirrors.scala b/src/reflect/scala/reflect/internal/Mirrors.scala index e3680b14d5..dedfd41e83 100644 --- a/src/reflect/scala/reflect/internal/Mirrors.scala +++ b/src/reflect/scala/reflect/internal/Mirrors.scala @@ -41,7 +41,7 @@ trait Mirrors extends api.Mirrors { if (result != NoSymbol) result else { if (settings.debug.value) { log(sym.info); log(sym.info.members) }//debug - mirrorMissingHook(owner, name) orElse symbolTableMissingHook(owner, name) orElse { + tryMissingHooks(owner, name) orElse { MissingRequirementError.notFound((if (path.isTermName) "object " else "class ")+path+" in "+thisMirror) } } @@ -51,6 +51,8 @@ trait Mirrors extends api.Mirrors { protected def symbolTableMissingHook(owner: Symbol, name: Name): Symbol = self.missingHook(owner, name) + private[reflect] def tryMissingHooks(owner: Symbol, name: Name): Symbol = mirrorMissingHook(owner, name) orElse symbolTableMissingHook(owner, name) + /** If you're looking for a class, pass a type name. * If a module, a term name. */ |