@@ -106,7 +106,7 @@ class ClassfileParser(
106
106
107
107
/** Return the class symbol of the given name. */
108
108
def classNameToSymbol (name : Name )(implicit ctx : Context ): Symbol = innerClasses.get(name) match {
109
- case Some (entry) => innerClasses.classSymbol(entry.externalName )
109
+ case Some (entry) => innerClasses.classSymbol(entry)
110
110
case None => ctx.requiredClass(name)
111
111
}
112
112
@@ -890,54 +890,42 @@ class ClassfileParser(
890
890
classNameToSymbol(tlName)
891
891
}
892
892
893
- /** Return the class symbol for `externalName `. It looks it up in its outer class.
893
+ /** Return the class symbol for `entry `. It looks it up in its outer class.
894
894
* Forces all outer class symbols to be completed.
895
- *
896
- * If the given name is not an inner class, it returns the symbol found in `defn`.
897
895
*/
898
- def classSymbol (externalName : Name )(implicit ctx : Context ): Symbol = {
899
- /** Return the symbol of `innerName`, having the given `externalName`. */
900
- def innerSymbol (externalName : Name , innerName : Name , static : Boolean ): Symbol = {
901
- def getMember (sym : Symbol , name : Name )(implicit ctx : Context ): Symbol =
902
- if (static)
903
- if (sym == classRoot.symbol) staticScope.lookup(name)
904
- else {
905
- var module = sym.companionModule
906
- if (! module.exists && sym.isAbsent)
907
- module = sym.scalacLinkedClass
908
- module.info.member(name).symbol
909
- }
896
+ def classSymbol (entry : InnerClassEntry )(implicit ctx : Context ): Symbol = {
897
+ def getMember (sym : Symbol , name : Name )(implicit ctx : Context ): Symbol =
898
+ if (isStatic(entry.jflags)) {
899
+ if (sym == classRoot.symbol)
900
+ staticScope.lookup(name)
901
+ else {
902
+ var module = sym.companionModule
903
+ if (! module.exists && sym.isAbsent)
904
+ module = sym.scalacLinkedClass
905
+ module.info.member(name).symbol
906
+ }
907
+ }
908
+ else {
909
+ if (sym == classRoot.symbol)
910
+ instanceScope.lookup(name)
910
911
else
911
- if (sym == classRoot.symbol) instanceScope.lookup(name)
912
- else sym.info.member(name).symbol
913
-
914
- innerClasses.get(externalName) match {
915
- case Some (entry) =>
916
- val outerName = entry.outerName.stripModuleClassSuffix
917
- val owner = classSymbol(outerName)
918
- val result = ctx.atPhaseNotLaterThan(ctx.typerPhase) { implicit ctx =>
919
- getMember(owner, innerName.toTypeName)
920
- }
921
- assert(result ne NoSymbol ,
922
- i """ failure to resolve inner class:
923
- |externalName = $externalName,
912
+ sym.info.member(name).symbol
913
+ }
914
+
915
+ val outerName = entry.outerName.stripModuleClassSuffix
916
+ val innerName = entry.originalName
917
+ val owner = classNameToSymbol(outerName)
918
+ val result = ctx.atPhaseNotLaterThan(ctx.typerPhase) { implicit ctx =>
919
+ getMember(owner, innerName.toTypeName)
920
+ }
921
+ assert(result ne NoSymbol ,
922
+ i """ failure to resolve inner class:
923
+ |externalName = ${entry.externalName},
924
924
|outerName = $outerName,
925
925
|innerName = $innerName
926
926
|owner.fullName = ${owner.showFullName}
927
927
|while parsing ${classfile}""" )
928
- result
929
-
930
- case None =>
931
- classNameToSymbol(externalName)
932
- }
933
- }
934
-
935
- get(externalName) match {
936
- case Some (entry) =>
937
- innerSymbol(entry.externalName, entry.originalName, isStatic(entry.jflags))
938
- case None =>
939
- classNameToSymbol(externalName)
940
- }
928
+ result
941
929
}
942
930
}
943
931
0 commit comments