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 library dart2js.compiler_base; | 5 library dart2js.compiler_base; |
6 | 6 |
7 import 'dart:async' show | 7 import 'dart:async' show |
8 EventSink, | 8 EventSink, |
9 Future; | 9 Future; |
10 | 10 |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 MessageKind.CONSIDER_ANALYZE_ALL, {'main': Identifiers.main}, | 883 MessageKind.CONSIDER_ANALYZE_ALL, {'main': Identifiers.main}, |
884 Identifiers.main, mainApp); | 884 Identifiers.main, mainApp); |
885 } | 885 } |
886 } else { | 886 } else { |
887 // Compilation requires a main method. | 887 // Compilation requires a main method. |
888 errorElement = new ErroneousElementX( | 888 errorElement = new ErroneousElementX( |
889 MessageKind.MISSING_MAIN, {'main': Identifiers.main}, | 889 MessageKind.MISSING_MAIN, {'main': Identifiers.main}, |
890 Identifiers.main, mainApp); | 890 Identifiers.main, mainApp); |
891 } | 891 } |
892 mainFunction = backend.helperForMissingMain(); | 892 mainFunction = backend.helperForMissingMain(); |
893 } else if (main.isErroneous && main.isSynthesized) { | 893 } else if (main.isError && main.isSynthesized) { |
894 if (main is ErroneousElement) { | 894 if (main is ErroneousElement) { |
895 errorElement = main; | 895 errorElement = main; |
896 } else { | 896 } else { |
897 reporter.internalError(main, 'Problem with ${Identifiers.main}.'); | 897 reporter.internalError(main, 'Problem with ${Identifiers.main}.'); |
898 } | 898 } |
899 mainFunction = backend.helperForBadMain(); | 899 mainFunction = backend.helperForBadMain(); |
900 } else if (!main.isFunction) { | 900 } else if (!main.isFunction) { |
901 errorElement = new ErroneousElementX( | 901 errorElement = new ErroneousElementX( |
902 MessageKind.MAIN_NOT_A_FUNCTION, {'main': Identifiers.main}, | 902 MessageKind.MAIN_NOT_A_FUNCTION, {'main': Identifiers.main}, |
903 Identifiers.main, main); | 903 Identifiers.main, main); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 void emptyQueue(Enqueuer world) { | 1098 void emptyQueue(Enqueuer world) { |
1099 world.forEach((WorkItem work) { | 1099 world.forEach((WorkItem work) { |
1100 reporter.withCurrentElement(work.element, () { | 1100 reporter.withCurrentElement(work.element, () { |
1101 world.applyImpact(work.element, work.run(this, world)); | 1101 world.applyImpact(work.element, work.run(this, world)); |
1102 }); | 1102 }); |
1103 }); | 1103 }); |
1104 } | 1104 } |
1105 | 1105 |
1106 void processQueue(Enqueuer world, Element main) { | 1106 void processQueue(Enqueuer world, Element main) { |
1107 world.nativeEnqueuer.processNativeClasses(libraryLoader.libraries); | 1107 world.nativeEnqueuer.processNativeClasses(libraryLoader.libraries); |
1108 if (main != null && !main.isErroneous) { | 1108 if (main != null && !main.isMalformed) { |
1109 FunctionElement mainMethod = main; | 1109 FunctionElement mainMethod = main; |
1110 mainMethod.computeType(resolution); | 1110 mainMethod.computeType(resolution); |
1111 if (mainMethod.functionSignature.parameterCount != 0) { | 1111 if (mainMethod.functionSignature.parameterCount != 0) { |
1112 // The first argument could be a list of strings. | 1112 // The first argument could be a list of strings. |
1113 backend.listImplementation.ensureResolved(resolution); | 1113 backend.listImplementation.ensureResolved(resolution); |
1114 backend.registerInstantiatedType( | 1114 backend.registerInstantiatedType( |
1115 backend.listImplementation.rawType, world, globalDependencies); | 1115 backend.listImplementation.rawType, world, globalDependencies); |
1116 backend.stringImplementation.ensureResolved(resolution); | 1116 backend.stringImplementation.ensureResolved(resolution); |
1117 backend.registerInstantiatedType( | 1117 backend.registerInstantiatedType( |
1118 backend.stringImplementation.rawType, world, globalDependencies); | 1118 backend.stringImplementation.rawType, world, globalDependencies); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 } | 1293 } |
1294 } | 1294 } |
1295 prevToken = currentToken; | 1295 prevToken = currentToken; |
1296 currentToken = currentToken.next; | 1296 currentToken = currentToken.next; |
1297 } | 1297 } |
1298 return firstToken; | 1298 return firstToken; |
1299 } | 1299 } |
1300 | 1300 |
1301 void reportUnusedCode() { | 1301 void reportUnusedCode() { |
1302 void checkLive(member) { | 1302 void checkLive(member) { |
1303 if (member.isErroneous) return; | 1303 if (member.isMalformed) return; |
1304 if (member.isFunction) { | 1304 if (member.isFunction) { |
1305 if (!enqueuer.resolution.hasBeenProcessed(member)) { | 1305 if (!enqueuer.resolution.hasBeenProcessed(member)) { |
1306 reporter.reportHintMessage( | 1306 reporter.reportHintMessage( |
1307 member, MessageKind.UNUSED_METHOD, {'name': member.name}); | 1307 member, MessageKind.UNUSED_METHOD, {'name': member.name}); |
1308 } | 1308 } |
1309 } else if (member.isClass) { | 1309 } else if (member.isClass) { |
1310 if (!member.isResolved) { | 1310 if (!member.isResolved) { |
1311 reporter.reportHintMessage( | 1311 reporter.reportHintMessage( |
1312 member, MessageKind.UNUSED_CLASS, {'name': member.name}); | 1312 member, MessageKind.UNUSED_CLASS, {'name': member.name}); |
1313 } else { | 1313 } else { |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2042 if (_otherDependencies == null) { | 2042 if (_otherDependencies == null) { |
2043 _otherDependencies = new Setlet<Element>(); | 2043 _otherDependencies = new Setlet<Element>(); |
2044 } | 2044 } |
2045 _otherDependencies.add(element.implementation); | 2045 _otherDependencies.add(element.implementation); |
2046 } | 2046 } |
2047 | 2047 |
2048 Iterable<Element> get otherDependencies { | 2048 Iterable<Element> get otherDependencies { |
2049 return _otherDependencies != null ? _otherDependencies : const <Element>[]; | 2049 return _otherDependencies != null ? _otherDependencies : const <Element>[]; |
2050 } | 2050 } |
2051 } | 2051 } |
OLD | NEW |