Chromium Code Reviews

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.
Jump to:
View unified diff | | 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...)
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 int index = 0;
1033 parameter, 1033 parameters.forEachParameter((Element parameter) {
1034 MessageKind.GENERIC, 1034 if (index++ < 2) return;
1035 {'text': 1035 reportError(
1036 "Error: '$MAIN' cannot have parameters."}); 1036 parameter,
1037 }); 1037 MessageKind.GENERIC,
1038 {'text':
1039 "Error: '$MAIN' cannot have more than two parameters."});
1040 });
1041 }
1038 } 1042 }
1039 1043
1040 mirrorUsageAnalyzerTask.analyzeUsage(mainApp); 1044 mirrorUsageAnalyzerTask.analyzeUsage(mainApp);
1041 1045
1042 // In order to see if a library is deferred, we must compute the 1046 // In order to see if a library is deferred, we must compute the
1043 // compile-time constants that are metadata. This means adding 1047 // compile-time constants that are metadata. This means adding
1044 // something to the resolution queue. So we cannot wait with 1048 // something to the resolution queue. So we cannot wait with
1045 // this until after the resolution queue is processed. 1049 // this until after the resolution queue is processed.
1046 // TODO(ahe): Clean this up, for example, by not enqueueing 1050 // TODO(ahe): Clean this up, for example, by not enqueueing
1047 // classes only used for metadata. 1051 // classes only used for metadata.
(...skipping 86 matching lines...)
1134 for (MetadataAnnotation metadata in library.metadata) { 1138 for (MetadataAnnotation metadata in library.metadata) {
1135 metadata.ensureResolved(this); 1139 metadata.ensureResolved(this);
1136 } 1140 }
1137 } 1141 }
1138 } 1142 }
1139 } 1143 }
1140 1144
1141 void processQueue(Enqueuer world, Element main) { 1145 void processQueue(Enqueuer world, Element main) {
1142 world.nativeEnqueuer.processNativeClasses(libraries.values); 1146 world.nativeEnqueuer.processNativeClasses(libraries.values);
1143 if (main != null) { 1147 if (main != null) {
1148 if (main.computeSignature(this).parameterCount != 0) {
1149 // TODO(ngeoffray, floitsch): we should also ensure that the
1150 // class IsolateMessage is instantiated. Currently, just enabling
1151 // isolate support works.
1152 world.enableIsolateSupport(main.getLibrary());
1153 world.registerInstantiatedClass(listClass, globalDependencies);
1154 world.registerInstantiatedClass(stringClass, globalDependencies);
1155 }
1144 world.addToWorkList(main); 1156 world.addToWorkList(main);
1145 } 1157 }
1146 progress.reset(); 1158 progress.reset();
1147 world.forEach((WorkItem work) { 1159 world.forEach((WorkItem work) {
1148 withCurrentElement(work.element, () => work.run(this, world)); 1160 withCurrentElement(work.element, () => work.run(this, world));
1149 }); 1161 });
1150 world.queueIsClosed = true; 1162 world.queueIsClosed = true;
1151 world.forEachPostProcessTask((PostProcessTask work) { 1163 world.forEachPostProcessTask((PostProcessTask work) {
1152 withCurrentElement(work.element, () => work.action()); 1164 withCurrentElement(work.element, () => work.action());
1153 }); 1165 });
(...skipping 459 matching lines...)
1613 1625
1614 void close() {} 1626 void close() {}
1615 1627
1616 toString() => name; 1628 toString() => name;
1617 1629
1618 /// Convenience method for getting an [api.CompilerOutputProvider]. 1630 /// Convenience method for getting an [api.CompilerOutputProvider].
1619 static NullSink outputProvider(String name, String extension) { 1631 static NullSink outputProvider(String name, String extension) {
1620 return new NullSink('$name.$extension'); 1632 return new NullSink('$name.$extension');
1621 } 1633 }
1622 } 1634 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine