File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import core.Contexts._, core.Symbols._
7
7
import core .SymbolLoader
8
8
import core .SymDenotations .SymDenotation
9
9
import core .StdNames .nme
10
+ import core .Flags .Module
10
11
11
12
/** The platform dependent pieces of Global.
12
13
*/
@@ -36,12 +37,10 @@ abstract class Platform {
36
37
/** The given symbol is a method with the right name and signature to be a runnable program. */
37
38
def isMainMethod (sym : SymDenotation )(implicit ctx : Context ): Boolean
38
39
39
- /** The given class has a main method.
40
- * @param staticOnly only static main methods count
41
- */
42
- final def hasMainMethod (sym : Symbol , staticOnly : Boolean = false )(implicit ctx : Context ): Boolean =
40
+ /** The given class has a main method. */
41
+ final def hasMainMethod (sym : Symbol )(implicit ctx : Context ): Boolean =
43
42
sym.info.member(nme.main).hasAltWith {
44
- case x : SymDenotation => isMainMethod(x) && (! staticOnly || x.isStatic)
43
+ case x : SymDenotation => isMainMethod(x) && (sym.is( Module ) || x.isStatic)
45
44
case _ => false
46
45
}
47
46
}
Original file line number Diff line number Diff line change @@ -230,8 +230,7 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
230
230
231
231
allNonLocalClassesInSrc += cl
232
232
233
- if (sym.isStatic && ! sym.is(Trait ) &&
234
- ctx.platform.hasMainMethod(sym, staticOnly = ! sym.is(Module ))) {
233
+ if (sym.isStatic && ! sym.is(Trait ) && ctx.platform.hasMainMethod(sym)) {
235
234
// If sym is an object, all main methods count, otherwise only @static ones count.
236
235
_mainClasses += name
237
236
}
You can’t perform that action at this time.
0 commit comments