Skip to content

Commit 1cd8192

Browse files
author
changvvb
committed
remove some codes
1 parent 7c918b4 commit 1cd8192

File tree

1 file changed

+24
-34
lines changed

1 file changed

+24
-34
lines changed

compiler/src/dotty/tools/dotc/core/ContextOps.scala

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -49,42 +49,32 @@ object ContextOps:
4949

5050
final def javaFindMember(name: Name, pre: Type, required: FlagSet = EmptyFlags, excluded: FlagSet = EmptyFlags): Denotation = {
5151
inContext(ctx) {
52-
val result = {
53-
val preSym = pre.typeSymbol
54-
val denot = pre.findMember(name, pre, required, excluded)
55-
if (denot.exists || preSym.isPackageObject || !preSym.isClass) denot
56-
else {
57-
// In Java code, static innner classes, which we model as members of the companion object,
58-
// can be referenced from an ident in a subclass or by a selection prefixed by the subclass.
59-
val toSearch = if (preSym.is(Flags.Module)) then
60-
if pre.typeSymbol.sourceModule.companionClass.exists then
61-
pre.typeSymbol.sourceModule.companionClass.asClass.baseClasses.tail
62-
else Nil
63-
else
64-
preSym.asClass.baseClasses.tail
52+
val preSym = pre.typeSymbol
53+
val denot = pre.findMember(name, pre, required, excluded)
54+
if (denot.exists || preSym.isPackageObject || !preSym.isClass) denot
55+
else {
56+
// In Java code, static innner classes, which we model as members of the companion object,
57+
// can be referenced from an ident in a subclass or by a selection prefixed by the subclass.
58+
val toSearch = if (preSym.is(Flags.Module)) then
59+
if pre.typeSymbol.sourceModule.companionClass.exists then
60+
pre.typeSymbol.sourceModule.companionClass.asClass.baseClasses.tail
61+
else Nil
62+
else
63+
preSym.asClass.baseClasses.tail
6564

66-
val result = toSearch.iterator.map { bc =>
67-
val pre1 = bc.thisType
68-
val found = pre1.findMember(name,pre,required,excluded | Flags.TypeParam)
69-
val result = found match {
70-
case NoDenotation =>
71-
val companionModule = pre1.typeSymbol.companionClass
72-
val pre2 = companionModule.thisType
73-
val result = pre2.findMember(name, pre2, required, excluded)
74-
// println(result.symbol.fullName)
75-
result
76-
case denot => denot
77-
}
78-
// println((bc.show,pre1.show , pre.typeSymbol.show ,result.show))
79-
result
80-
}.find(_.exists).getOrElse(NoDenotation)
81-
result
82-
}
65+
toSearch.iterator.map { bc =>
66+
val pre1 = bc.thisType
67+
val found = pre1.findMember(name,pre,required,excluded | Flags.TypeParam)
68+
found match {
69+
case NoDenotation =>
70+
val companionModule = pre1.typeSymbol.companionClass
71+
val pre2 = companionModule.thisType
72+
val result = pre2.findMember(name, pre2, required, excluded)
73+
result
74+
case denot => denot
75+
}
76+
}.find(_.exists).getOrElse(NoDenotation)
8377
}
84-
// if(name.toSimpleName.toString == "InnerInterface") {
85-
// println((pre.show, result))
86-
// }
87-
result
8878
}
8979
}
9080

0 commit comments

Comments
 (0)