| 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 Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import '../compiler_new.dart' as api; | 9 import '../compiler_new.dart' as api; |
| 10 import 'backend_strategy.dart'; | 10 import 'backend_strategy.dart'; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 import 'dump_info.dart' show DumpInfoTask; | 32 import 'dump_info.dart' show DumpInfoTask; |
| 33 import 'elements/elements.dart'; | 33 import 'elements/elements.dart'; |
| 34 import 'elements/entities.dart'; | 34 import 'elements/entities.dart'; |
| 35 import 'elements/resolution_types.dart' show ResolutionDartType, Types; | 35 import 'elements/resolution_types.dart' show ResolutionDartType, Types; |
| 36 import 'elements/types.dart' show DartTypes; | 36 import 'elements/types.dart' show DartTypes; |
| 37 import 'enqueue.dart' show Enqueuer, EnqueueTask, ResolutionEnqueuer; | 37 import 'enqueue.dart' show Enqueuer, EnqueueTask, ResolutionEnqueuer; |
| 38 import 'environment.dart'; | 38 import 'environment.dart'; |
| 39 import 'frontend_strategy.dart'; | 39 import 'frontend_strategy.dart'; |
| 40 import 'id_generator.dart'; | 40 import 'id_generator.dart'; |
| 41 import 'io/source_information.dart' show SourceInformation; | 41 import 'io/source_information.dart' show SourceInformation; |
| 42 import 'io/source_file.dart' show Binary; |
| 42 import 'js_backend/backend.dart' show JavaScriptBackend; | 43 import 'js_backend/backend.dart' show JavaScriptBackend; |
| 43 import 'js_backend/element_strategy.dart' show ElementBackendStrategy; | 44 import 'js_backend/element_strategy.dart' show ElementBackendStrategy; |
| 44 import 'kernel/kernel_strategy.dart'; | 45 import 'kernel/kernel_strategy.dart'; |
| 45 import 'library_loader.dart' | 46 import 'library_loader.dart' |
| 46 show | 47 show |
| 47 ElementScanner, | 48 ElementScanner, |
| 48 LibraryLoader, | 49 LibraryLoader, |
| 49 LibraryLoaderTask, | 50 LibraryLoaderTask, |
| 50 LoadedLibraries, | 51 LoadedLibraries, |
| 51 ScriptLoader; | 52 ScriptLoader; |
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 /** | 850 /** |
| 850 * Reads the script specified by the [readableUri]. | 851 * Reads the script specified by the [readableUri]. |
| 851 * | 852 * |
| 852 * See [LibraryLoader] for terminology on URIs. | 853 * See [LibraryLoader] for terminology on URIs. |
| 853 */ | 854 */ |
| 854 Future<Script> readScript(Uri readableUri, [Spannable node]) { | 855 Future<Script> readScript(Uri readableUri, [Spannable node]) { |
| 855 throw new SpannableAssertionFailure( | 856 throw new SpannableAssertionFailure( |
| 856 node, 'Compiler.readScript not implemented.'); | 857 node, 'Compiler.readScript not implemented.'); |
| 857 } | 858 } |
| 858 | 859 |
| 860 Future<Binary> readBinary(Uri readableUri, [Spannable node]) { |
| 861 throw new SpannableAssertionFailure( |
| 862 node, 'Compiler.readBinary not implemented.'); |
| 863 } |
| 864 |
| 859 Element lookupElementIn(ScopeContainerElement container, String name) { | 865 Element lookupElementIn(ScopeContainerElement container, String name) { |
| 860 Element element = container.localLookup(name); | 866 Element element = container.localLookup(name); |
| 861 if (element == null) { | 867 if (element == null) { |
| 862 throw 'Could not find $name in $container'; | 868 throw 'Could not find $name in $container'; |
| 863 } | 869 } |
| 864 return element; | 870 return element; |
| 865 } | 871 } |
| 866 | 872 |
| 867 bool get isMockCompilation => false; | 873 bool get isMockCompilation => false; |
| 868 | 874 |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1535 return _proxyConstant == value; | 1541 return _proxyConstant == value; |
| 1536 } | 1542 } |
| 1537 } | 1543 } |
| 1538 | 1544 |
| 1539 class _ScriptLoader implements ScriptLoader { | 1545 class _ScriptLoader implements ScriptLoader { |
| 1540 Compiler compiler; | 1546 Compiler compiler; |
| 1541 _ScriptLoader(this.compiler); | 1547 _ScriptLoader(this.compiler); |
| 1542 | 1548 |
| 1543 Future<Script> readScript(Uri uri, [Spannable spannable]) => | 1549 Future<Script> readScript(Uri uri, [Spannable spannable]) => |
| 1544 compiler.readScript(uri, spannable); | 1550 compiler.readScript(uri, spannable); |
| 1551 |
| 1552 Future<Binary> readBinary(Uri uri, [Spannable spannable]) => |
| 1553 compiler.readBinary(uri, spannable); |
| 1545 } | 1554 } |
| 1546 | 1555 |
| 1547 /// [ScriptLoader] used to ensure that scripts are not loaded accidentally | 1556 /// [ScriptLoader] used to ensure that scripts are not loaded accidentally |
| 1548 /// through the [LibraryLoader] when `CompilerOptions.compileOnly` is `true`. | 1557 /// through the [LibraryLoader] when `CompilerOptions.compileOnly` is `true`. |
| 1549 class _NoScriptLoader implements ScriptLoader { | 1558 class _NoScriptLoader implements ScriptLoader { |
| 1550 Compiler compiler; | 1559 Compiler compiler; |
| 1551 _NoScriptLoader(this.compiler); | 1560 _NoScriptLoader(this.compiler); |
| 1552 | 1561 |
| 1553 Future<Script> readScript(Uri uri, [Spannable spannable]) { | 1562 Future<Script> readScript(Uri uri, [Spannable spannable]) { |
| 1554 throw compiler.reporter | 1563 throw compiler.reporter |
| 1555 .internalError(spannable, "Script loading of '$uri' is not enabled."); | 1564 .internalError(spannable, "Script loading of '$uri' is not enabled."); |
| 1556 } | 1565 } |
| 1566 |
| 1567 Future<Binary> readBinary(Uri uri, [Spannable spannable]) { |
| 1568 throw compiler.reporter |
| 1569 .internalError(spannable, "Script loading of '$uri' is not enabled."); |
| 1570 } |
| 1557 } | 1571 } |
| 1558 | 1572 |
| 1559 class _ElementScanner implements ElementScanner { | 1573 class _ElementScanner implements ElementScanner { |
| 1560 ScannerTask scanner; | 1574 ScannerTask scanner; |
| 1561 _ElementScanner(this.scanner); | 1575 _ElementScanner(this.scanner); |
| 1562 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 1576 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
| 1563 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 1577 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
| 1564 } | 1578 } |
| 1565 | 1579 |
| 1566 class _EmptyEnvironment implements Environment { | 1580 class _EmptyEnvironment implements Environment { |
| 1567 const _EmptyEnvironment(); | 1581 const _EmptyEnvironment(); |
| 1568 | 1582 |
| 1569 String valueOf(String key) => null; | 1583 String valueOf(String key) => null; |
| 1570 } | 1584 } |
| OLD | NEW |