OLD | NEW |
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 Loading... |
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 argumentCount = 0; |
1033 parameter, | 1033 parameters.forEachParameter((Element parameter) { |
1034 MessageKind.GENERIC, | 1034 argumentCount++; |
1035 {'text': | 1035 if (argumentCount > 2) { |
1036 "Error: '$MAIN' cannot have parameters."}); | 1036 reportError( |
1037 }); | 1037 parameter, |
| 1038 MessageKind.GENERIC, |
| 1039 {'text': |
| 1040 "Error: '$MAIN' cannot have more than 2 parameters."}); |
| 1041 } |
| 1042 }); |
| 1043 } |
| 1044 if (parameters.parameterCount == 2) { |
| 1045 enqueuer.resolution.enableIsolateSupport(main.getLibrary()); |
| 1046 } |
1038 } | 1047 } |
1039 | 1048 |
1040 mirrorUsageAnalyzerTask.analyzeUsage(mainApp); | 1049 mirrorUsageAnalyzerTask.analyzeUsage(mainApp); |
1041 | 1050 |
1042 // In order to see if a library is deferred, we must compute the | 1051 // In order to see if a library is deferred, we must compute the |
1043 // compile-time constants that are metadata. This means adding | 1052 // compile-time constants that are metadata. This means adding |
1044 // something to the resolution queue. So we cannot wait with | 1053 // something to the resolution queue. So we cannot wait with |
1045 // this until after the resolution queue is processed. | 1054 // this until after the resolution queue is processed. |
1046 // TODO(ahe): Clean this up, for example, by not enqueueing | 1055 // TODO(ahe): Clean this up, for example, by not enqueueing |
1047 // classes only used for metadata. | 1056 // classes only used for metadata. |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1613 | 1622 |
1614 void close() {} | 1623 void close() {} |
1615 | 1624 |
1616 toString() => name; | 1625 toString() => name; |
1617 | 1626 |
1618 /// Convenience method for getting an [api.CompilerOutputProvider]. | 1627 /// Convenience method for getting an [api.CompilerOutputProvider]. |
1619 static NullSink outputProvider(String name, String extension) { | 1628 static NullSink outputProvider(String name, String extension) { |
1620 return new NullSink('$name.$extension'); | 1629 return new NullSink('$name.$extension'); |
1621 } | 1630 } |
1622 } | 1631 } |
OLD | NEW |