| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 // Initialized after mirrorSystemClass has been resolved. | 193 // Initialized after mirrorSystemClass has been resolved. |
| 194 FunctionElement mirrorSystemGetNameFunction; | 194 FunctionElement mirrorSystemGetNameFunction; |
| 195 | 195 |
| 196 // Initialized when mirrorsUsedClass has been resolved. | 196 // Initialized when mirrorsUsedClass has been resolved. |
| 197 FunctionElement mirrorsUsedConstructor; | 197 FunctionElement mirrorsUsedConstructor; |
| 198 | 198 |
| 199 // Initialized when dart:mirrors is loaded. | 199 // Initialized when dart:mirrors is loaded. |
| 200 ClassElement deferredLibraryClass; | 200 ClassElement deferredLibraryClass; |
| 201 | 201 |
| 202 /// Document class from dart:mirrors. | |
| 203 ClassElement documentClass; | |
| 204 Element identicalFunction; | 202 Element identicalFunction; |
| 205 Element loadLibraryFunction; | 203 Element loadLibraryFunction; |
| 206 Element functionApplyMethod; | 204 Element functionApplyMethod; |
| 207 | 205 |
| 208 // TODO(zarah): Remove this map and incorporate compile-time errors | 206 // TODO(zarah): Remove this map and incorporate compile-time errors |
| 209 // in the model. | 207 // in the model. |
| 210 /// Tracks elements with compile-time errors. | 208 /// Tracks elements with compile-time errors. |
| 211 final Map<Element, List<DiagnosticMessage>> elementsWithCompileTimeErrors = | 209 final Map<Element, List<DiagnosticMessage>> elementsWithCompileTimeErrors = |
| 212 new Map<Element, List<DiagnosticMessage>>(); | 210 new Map<Element, List<DiagnosticMessage>>(); |
| 213 | 211 |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 reporter.reportWarningMessage( | 555 reporter.reportWarningMessage( |
| 558 NO_LOCATION_SPANNABLE, MessageKind.IMPORT_EXPERIMENTAL_MIRRORS, { | 556 NO_LOCATION_SPANNABLE, MessageKind.IMPORT_EXPERIMENTAL_MIRRORS, { |
| 559 'importChain': importChains | 557 'importChain': importChains |
| 560 .join(MessageTemplate.IMPORT_EXPERIMENTAL_MIRRORS_PADDING) | 558 .join(MessageTemplate.IMPORT_EXPERIMENTAL_MIRRORS_PADDING) |
| 561 }); | 559 }); |
| 562 } | 560 } |
| 563 | 561 |
| 564 coreClasses.functionClass.ensureResolved(resolution); | 562 coreClasses.functionClass.ensureResolved(resolution); |
| 565 functionApplyMethod = | 563 functionApplyMethod = |
| 566 coreClasses.functionClass.lookupLocalMember('apply'); | 564 coreClasses.functionClass.lookupLocalMember('apply'); |
| 567 | |
| 568 if (options.preserveComments) { | |
| 569 return libraryLoader | |
| 570 .loadLibrary(Uris.dart_mirrors) | |
| 571 .then((LibraryElement libraryElement) { | |
| 572 documentClass = libraryElement.find('Comment'); | |
| 573 }); | |
| 574 } | |
| 575 }).then((_) => backend.onLibrariesLoaded(loadedLibraries)); | 565 }).then((_) => backend.onLibrariesLoaded(loadedLibraries)); |
| 576 } | 566 } |
| 577 | 567 |
| 578 Element findRequiredElement(LibraryElement library, String name) { | 568 Element findRequiredElement(LibraryElement library, String name) { |
| 579 var element = library.find(name); | 569 var element = library.find(name); |
| 580 if (element == null) { | 570 if (element == null) { |
| 581 reporter.internalError( | 571 reporter.internalError( |
| 582 library, | 572 library, |
| 583 "The library '${library.canonicalUri}' does not contain required " | 573 "The library '${library.canonicalUri}' does not contain required " |
| 584 "element: '$name'."); | 574 "element: '$name'."); |
| (...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2186 _ElementScanner(this.scanner); | 2176 _ElementScanner(this.scanner); |
| 2187 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 2177 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
| 2188 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 2178 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
| 2189 } | 2179 } |
| 2190 | 2180 |
| 2191 class _EmptyEnvironment implements Environment { | 2181 class _EmptyEnvironment implements Environment { |
| 2192 const _EmptyEnvironment(); | 2182 const _EmptyEnvironment(); |
| 2193 | 2183 |
| 2194 String valueOf(String key) => null; | 2184 String valueOf(String key) => null; |
| 2195 } | 2185 } |
| OLD | NEW |