Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: sdk/lib/_internal/compiler/implementation/compiler.dart

Issue 39263007: Allow arguments to main. Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reupload due to error. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/_internal/lib/isolate_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/compiler.dart
diff --git a/sdk/lib/_internal/compiler/implementation/compiler.dart b/sdk/lib/_internal/compiler/implementation/compiler.dart
index 93474dc9e7ce61e4fe92380581dbafe22cf230ed..764b7294ed64fe6c7af9c298bde53db612a9aafb 100644
--- a/sdk/lib/_internal/compiler/implementation/compiler.dart
+++ b/sdk/lib/_internal/compiler/implementation/compiler.dart
@@ -1028,13 +1028,22 @@ abstract class Compiler implements DiagnosticListener {
}
FunctionElement mainMethod = main;
FunctionSignature parameters = mainMethod.computeSignature(this);
- parameters.forEachParameter((Element parameter) {
- reportError(
- parameter,
- MessageKind.GENERIC,
- {'text':
- "Error: '$MAIN' cannot have parameters."});
- });
+ if (parameters.parameterCount > 2) {
+ int argumentCount = 0;
+ parameters.forEachParameter((Element parameter) {
+ argumentCount++;
+ if (argumentCount > 2) {
+ reportError(
+ parameter,
+ MessageKind.GENERIC,
+ {'text':
+ "Error: '$MAIN' cannot have more than 2 parameters."});
+ }
+ });
+ }
+ if (parameters.parameterCount == 2) {
+ enqueuer.resolution.enableIsolateSupport(main.getLibrary());
+ }
}
mirrorUsageAnalyzerTask.analyzeUsage(mainApp);
« no previous file with comments | « no previous file | sdk/lib/_internal/lib/isolate_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698