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

Side by Side 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, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart2js; 5 part of dart2js;
6 6
7 /** 7 /**
8 * If true, print a warning for each method that was resolved, but not 8 * If true, print a warning for each method that was resolved, but not
9 * compiled. 9 * compiled.
10 */ 10 */
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 } 1021 }
1022 } else { 1022 } else {
1023 if (!main.isFunction()) { 1023 if (!main.isFunction()) {
1024 reportFatalError( 1024 reportFatalError(
1025 main, 1025 main,
1026 MessageKind.GENERIC, 1026 MessageKind.GENERIC,
1027 {'text': "Error: '$MAIN' is not a function."}); 1027 {'text': "Error: '$MAIN' is not a function."});
1028 } 1028 }
1029 FunctionElement mainMethod = main; 1029 FunctionElement mainMethod = main;
1030 FunctionSignature parameters = mainMethod.computeSignature(this); 1030 FunctionSignature parameters = mainMethod.computeSignature(this);
1031 parameters.forEachParameter((Element parameter) { 1031 if (parameters.parameterCount > 2) {
1032 reportError( 1032 parameters.forEachParameter((Element parameter) {
1033 parameter, 1033 reportError(
1034 MessageKind.GENERIC, 1034 parameter,
1035 {'text': 1035 MessageKind.GENERIC,
1036 "Error: '$MAIN' cannot have parameters."}); 1036 {'text':
1037 }); 1037 "Error: '$MAIN' cannot have parameters."});
floitsch 2013/10/25 10:56:09 cannot have more than 2 parameters.
ngeoffray 2013/10/25 11:09:52 Done.
1038 });
1039 }
1038 } 1040 }
1039 1041
1040 mirrorUsageAnalyzerTask.analyzeUsage(mainApp); 1042 mirrorUsageAnalyzerTask.analyzeUsage(mainApp);
1041 1043
1042 // In order to see if a library is deferred, we must compute the 1044 // In order to see if a library is deferred, we must compute the
1043 // compile-time constants that are metadata. This means adding 1045 // compile-time constants that are metadata. This means adding
1044 // something to the resolution queue. So we cannot wait with 1046 // something to the resolution queue. So we cannot wait with
1045 // this until after the resolution queue is processed. 1047 // this until after the resolution queue is processed.
1046 // TODO(ahe): Clean this up, for example, by not enqueueing 1048 // TODO(ahe): Clean this up, for example, by not enqueueing
1047 // classes only used for metadata. 1049 // classes only used for metadata.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 for (MetadataAnnotation metadata in library.metadata) { 1136 for (MetadataAnnotation metadata in library.metadata) {
1135 metadata.ensureResolved(this); 1137 metadata.ensureResolved(this);
1136 } 1138 }
1137 } 1139 }
1138 } 1140 }
1139 } 1141 }
1140 1142
1141 void processQueue(Enqueuer world, Element main) { 1143 void processQueue(Enqueuer world, Element main) {
1142 world.nativeEnqueuer.processNativeClasses(libraries.values); 1144 world.nativeEnqueuer.processNativeClasses(libraries.values);
1143 if (main != null) { 1145 if (main != null) {
1146 if (main.computeSignature(this).parameterCount != 0) {
1147 // TODO(ngeoffray, floitsch): we should also ensure that the
1148 // class IsolateMessage is instantiated. Currently, just enabling
1149 // isolate support works.
1150 world.enableIsolateSupport(main.getLibrary());
1151 world.registerInstantiatedClass(listClass, globalDependencies);
1152 world.registerInstantiatedClass(stringClass, globalDependencies);
1153 }
1144 world.addToWorkList(main); 1154 world.addToWorkList(main);
1145 } 1155 }
1146 progress.reset(); 1156 progress.reset();
1147 world.forEach((WorkItem work) { 1157 world.forEach((WorkItem work) {
1148 withCurrentElement(work.element, () => work.run(this, world)); 1158 withCurrentElement(work.element, () => work.run(this, world));
1149 }); 1159 });
1150 world.queueIsClosed = true; 1160 world.queueIsClosed = true;
1151 world.forEachPostProcessTask((PostProcessTask work) { 1161 world.forEachPostProcessTask((PostProcessTask work) {
1152 withCurrentElement(work.element, () => work.action()); 1162 withCurrentElement(work.element, () => work.action());
1153 }); 1163 });
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 1623
1614 void close() {} 1624 void close() {}
1615 1625
1616 toString() => name; 1626 toString() => name;
1617 1627
1618 /// Convenience method for getting an [api.CompilerOutputProvider]. 1628 /// Convenience method for getting an [api.CompilerOutputProvider].
1619 static NullSink outputProvider(String name, String extension) { 1629 static NullSink outputProvider(String name, String extension) {
1620 return new NullSink('$name.$extension'); 1630 return new NullSink('$name.$extension');
1621 } 1631 }
1622 } 1632 }
OLDNEW
« 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