| 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 EventSink, Future; | 7 import 'dart:async' show EventSink, Future; |
| 8 | 8 |
| 9 import '../compiler_new.dart' as api; | 9 import '../compiler_new.dart' as api; |
| 10 import 'cache_strategy.dart' show CacheStrategy; | 10 import 'cache_strategy.dart' show CacheStrategy; |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 | 601 |
| 602 void initializeCoreClasses() { | 602 void initializeCoreClasses() { |
| 603 final List missingCoreClasses = []; | 603 final List missingCoreClasses = []; |
| 604 ClassElement lookupCoreClass(String name) { | 604 ClassElement lookupCoreClass(String name) { |
| 605 ClassElement result = coreLibrary.find(name); | 605 ClassElement result = coreLibrary.find(name); |
| 606 if (result == null) { | 606 if (result == null) { |
| 607 missingCoreClasses.add(name); | 607 missingCoreClasses.add(name); |
| 608 } | 608 } |
| 609 return result; | 609 return result; |
| 610 } | 610 } |
| 611 |
| 611 _coreTypes.objectClass = lookupCoreClass('Object'); | 612 _coreTypes.objectClass = lookupCoreClass('Object'); |
| 612 _coreTypes.boolClass = lookupCoreClass('bool'); | 613 _coreTypes.boolClass = lookupCoreClass('bool'); |
| 613 _coreTypes.numClass = lookupCoreClass('num'); | 614 _coreTypes.numClass = lookupCoreClass('num'); |
| 614 _coreTypes.intClass = lookupCoreClass('int'); | 615 _coreTypes.intClass = lookupCoreClass('int'); |
| 615 _coreTypes.doubleClass = lookupCoreClass('double'); | 616 _coreTypes.doubleClass = lookupCoreClass('double'); |
| 616 _coreTypes.resourceClass = lookupCoreClass('Resource'); | 617 _coreTypes.resourceClass = lookupCoreClass('Resource'); |
| 617 _coreTypes.stringClass = lookupCoreClass('String'); | 618 _coreTypes.stringClass = lookupCoreClass('String'); |
| 618 _coreTypes.functionClass = lookupCoreClass('Function'); | 619 _coreTypes.functionClass = lookupCoreClass('Function'); |
| 619 _coreTypes.listClass = lookupCoreClass('List'); | 620 _coreTypes.listClass = lookupCoreClass('List'); |
| 620 _coreTypes.typeClass = lookupCoreClass('Type'); | 621 _coreTypes.typeClass = lookupCoreClass('Type'); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 | 895 |
| 895 backend.sourceInformationStrategy.onComplete(); | 896 backend.sourceInformationStrategy.onComplete(); |
| 896 | 897 |
| 897 checkQueues(); | 898 checkQueues(); |
| 898 }); | 899 }); |
| 899 | 900 |
| 900 void fullyEnqueueLibrary(LibraryElement library, Enqueuer world) { | 901 void fullyEnqueueLibrary(LibraryElement library, Enqueuer world) { |
| 901 void enqueueAll(Element element) { | 902 void enqueueAll(Element element) { |
| 902 fullyEnqueueTopLevelElement(element, world); | 903 fullyEnqueueTopLevelElement(element, world); |
| 903 } | 904 } |
| 905 |
| 904 library.implementation.forEachLocalMember(enqueueAll); | 906 library.implementation.forEachLocalMember(enqueueAll); |
| 905 library.imports.forEach((ImportElement import) { | 907 library.imports.forEach((ImportElement import) { |
| 906 if (import.isDeferred) { | 908 if (import.isDeferred) { |
| 907 // `import.prefix` and `loadLibrary` may be `null` when the deferred | 909 // `import.prefix` and `loadLibrary` may be `null` when the deferred |
| 908 // import has compile-time errors. | 910 // import has compile-time errors. |
| 909 GetterElement loadLibrary = import.prefix?.loadLibrary; | 911 GetterElement loadLibrary = import.prefix?.loadLibrary; |
| 910 if (loadLibrary != null) { | 912 if (loadLibrary != null) { |
| 911 world.addToWorkList(loadLibrary); | 913 world.addToWorkList(loadLibrary); |
| 912 } | 914 } |
| 913 } | 915 } |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 } else { | 1151 } else { |
| 1150 member.forEachLocalMember(checkLive); | 1152 member.forEachLocalMember(checkLive); |
| 1151 } | 1153 } |
| 1152 } else if (member.isTypedef) { | 1154 } else if (member.isTypedef) { |
| 1153 if (!member.isResolved) { | 1155 if (!member.isResolved) { |
| 1154 reporter.reportHintMessage( | 1156 reporter.reportHintMessage( |
| 1155 member, MessageKind.UNUSED_TYPEDEF, {'name': member.name}); | 1157 member, MessageKind.UNUSED_TYPEDEF, {'name': member.name}); |
| 1156 } | 1158 } |
| 1157 } | 1159 } |
| 1158 } | 1160 } |
| 1161 |
| 1159 libraryLoader.libraries.forEach((LibraryElement library) { | 1162 libraryLoader.libraries.forEach((LibraryElement library) { |
| 1160 // TODO(ahe): Implement better heuristics to discover entry points of | 1163 // TODO(ahe): Implement better heuristics to discover entry points of |
| 1161 // packages and use that to discover unused implementation details in | 1164 // packages and use that to discover unused implementation details in |
| 1162 // packages. | 1165 // packages. |
| 1163 if (library.isPlatformLibrary || library.isPackageLibrary) return; | 1166 if (library.isPlatformLibrary || library.isPackageLibrary) return; |
| 1164 library.compilationUnits.forEach((unit) { | 1167 library.compilationUnits.forEach((unit) { |
| 1165 unit.forEachLocalMember(checkLive); | 1168 unit.forEachLocalMember(checkLive); |
| 1166 }); | 1169 }); |
| 1167 }); | 1170 }); |
| 1168 } | 1171 } |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2170 _ElementScanner(this.scanner); | 2173 _ElementScanner(this.scanner); |
| 2171 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 2174 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
| 2172 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 2175 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
| 2173 } | 2176 } |
| 2174 | 2177 |
| 2175 class _EmptyEnvironment implements Environment { | 2178 class _EmptyEnvironment implements Environment { |
| 2176 const _EmptyEnvironment(); | 2179 const _EmptyEnvironment(); |
| 2177 | 2180 |
| 2178 String valueOf(String key) => null; | 2181 String valueOf(String key) => null; |
| 2179 } | 2182 } |
| OLD | NEW |