Index: sdk/lib/_internal/pub/lib/src/dart.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/dart.dart b/sdk/lib/_internal/pub/lib/src/dart.dart |
index af2c409263a6ae267ad32ef6d0e2ee780bb42597..481e124dbe6485f940908b9a49c8029e5bf94d75 100644 |
--- a/sdk/lib/_internal/pub/lib/src/dart.dart |
+++ b/sdk/lib/_internal/pub/lib/src/dart.dart |
@@ -107,11 +107,14 @@ String get _libPath { |
/// Returns whether [dart] looks like an entrypoint file. |
bool isEntrypoint(CompilationUnit dart) { |
+ // Allow two or fewer arguments so that entrypoints intended for use with |
+ // [spawnUri] get counted. |
+ // |
// TODO(nweiz): this misses the case where a Dart file doesn't contain main(), |
// but it parts in another file that does. |
return dart.declarations.any((node) { |
return node is FunctionDeclaration && node.name.name == "main" && |
- node.functionExpression.parameters.parameters.isEmpty; |
+ node.functionExpression.parameters.parameters.length <= 2; |
}); |
} |