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

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

Issue 43723002: Ensure list/string/isolate are enabled when main has arguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/compiler.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/compiler.dart (revision 29238)
+++ sdk/lib/_internal/compiler/implementation/compiler.dart (working copy)
@@ -1028,13 +1028,17 @@
}
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 index = 0;
+ parameters.forEachParameter((Element parameter) {
+ if (index++ < 2) return;
+ reportError(
+ parameter,
+ MessageKind.GENERIC,
+ {'text':
+ "Error: '$MAIN' cannot have more than two parameters."});
+ });
+ }
}
mirrorUsageAnalyzerTask.analyzeUsage(mainApp);
@@ -1141,6 +1145,14 @@
void processQueue(Enqueuer world, Element main) {
world.nativeEnqueuer.processNativeClasses(libraries.values);
if (main != null) {
+ if (main.computeSignature(this).parameterCount != 0) {
+ // TODO(ngeoffray, floitsch): we should also ensure that the
+ // class IsolateMessage is instantiated. Currently, just enabling
+ // isolate support works.
+ world.enableIsolateSupport(main.getLibrary());
+ world.registerInstantiatedClass(listClass, globalDependencies);
+ world.registerInstantiatedClass(stringClass, globalDependencies);
+ }
world.addToWorkList(main);
}
progress.reset();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698