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; |
11 import 'closure.dart' as closureMapping show ClosureTask; | 11 import 'closure.dart' as closureMapping show ClosureTask; |
12 import 'common/backend_api.dart' show Backend; | 12 import 'common/backend_api.dart' show Backend; |
13 import 'common/codegen.dart' show CodegenWorkItem; | 13 import 'common/codegen.dart' show CodegenWorkItem; |
14 import 'common/names.dart' show Selectors; | 14 import 'common/names.dart' show Selectors; |
15 import 'common/names.dart' show Identifiers, Uris; | 15 import 'common/names.dart' show Identifiers, Uris; |
16 import 'common/registry.dart' show EagerRegistry, Registry; | 16 import 'common/registry.dart' show EagerRegistry, Registry; |
17 import 'common/resolution.dart' | 17 import 'common/resolution.dart' |
18 show ParsingContext, Resolution, ResolutionWorkItem, ResolutionImpact; | 18 show |
| 19 ParsingContext, |
| 20 Resolution, |
| 21 ResolutionWorkItem, |
| 22 ResolutionImpact, |
| 23 Target; |
19 import 'common/tasks.dart' show CompilerTask, GenericTask, Measurer; | 24 import 'common/tasks.dart' show CompilerTask, GenericTask, Measurer; |
20 import 'common/work.dart' show ItemCompilationContext, WorkItem; | 25 import 'common/work.dart' show ItemCompilationContext, WorkItem; |
21 import 'common.dart'; | 26 import 'common.dart'; |
22 import 'compile_time_constants.dart'; | 27 import 'compile_time_constants.dart'; |
23 import 'constants/values.dart'; | 28 import 'constants/values.dart'; |
24 import 'core_types.dart' show CoreClasses, CoreTypes; | 29 import 'core_types.dart' show CoreClasses, CoreTypes; |
25 import 'dart_backend/dart_backend.dart' as dart_backend; | 30 import 'dart_backend/dart_backend.dart' as dart_backend; |
26 import 'dart_types.dart' show DartType, DynamicType, InterfaceType, Types; | 31 import 'dart_types.dart' show DartType, DynamicType, InterfaceType, Types; |
27 import 'deferred_load.dart' show DeferredLoadTask; | 32 import 'deferred_load.dart' show DeferredLoadTask; |
28 import 'diagnostics/code_location.dart'; | 33 import 'diagnostics/code_location.dart'; |
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 if (e.isClass || | 1031 if (e.isClass || |
1027 e.isField || | 1032 e.isField || |
1028 e.isTypeVariable || | 1033 e.isTypeVariable || |
1029 e.isTypedef || | 1034 e.isTypedef || |
1030 identical(e.kind, ElementKind.ABSTRACT_FIELD)) { | 1035 identical(e.kind, ElementKind.ABSTRACT_FIELD)) { |
1031 resolved.remove(e); | 1036 resolved.remove(e); |
1032 } | 1037 } |
1033 if (identical(e.kind, ElementKind.GENERATIVE_CONSTRUCTOR)) { | 1038 if (identical(e.kind, ElementKind.GENERATIVE_CONSTRUCTOR)) { |
1034 resolved.remove(e); | 1039 resolved.remove(e); |
1035 } | 1040 } |
1036 if (backend.isBackendLibrary(e.library)) { | 1041 if (backend.isTargetSpecificLibrary(e.library)) { |
1037 resolved.remove(e); | 1042 resolved.remove(e); |
1038 } | 1043 } |
1039 } | 1044 } |
1040 reporter.log('Excess resolution work: ${resolved.length}.'); | 1045 reporter.log('Excess resolution work: ${resolved.length}.'); |
1041 for (Element e in resolved) { | 1046 for (Element e in resolved) { |
1042 reporter.reportWarningMessage(e, MessageKind.GENERIC, | 1047 reporter.reportWarningMessage(e, MessageKind.GENERIC, |
1043 {'text': 'Warning: $e resolved but not compiled.'}); | 1048 {'text': 'Warning: $e resolved but not compiled.'}); |
1044 } | 1049 } |
1045 } | 1050 } |
1046 | 1051 |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1550 if (message.spannable is Element) { | 1555 if (message.spannable is Element) { |
1551 errorElement = message.spannable; | 1556 errorElement = message.spannable; |
1552 } else { | 1557 } else { |
1553 errorElement = currentElement; | 1558 errorElement = currentElement; |
1554 } | 1559 } |
1555 compiler.registerCompiletimeError(errorElement, message); | 1560 compiler.registerCompiletimeError(errorElement, message); |
1556 compiler.fatalDiagnosticReported(message, infos, kind); | 1561 compiler.fatalDiagnosticReported(message, infos, kind); |
1557 } | 1562 } |
1558 } | 1563 } |
1559 | 1564 |
| 1565 @override |
| 1566 bool get hasReportedError => compiler.compilationFailed; |
| 1567 |
1560 /** | 1568 /** |
1561 * Perform an operation, [f], returning the return value from [f]. If an | 1569 * Perform an operation, [f], returning the return value from [f]. If an |
1562 * error occurs then report it as having occurred during compilation of | 1570 * error occurs then report it as having occurred during compilation of |
1563 * [element]. Can be nested. | 1571 * [element]. Can be nested. |
1564 */ | 1572 */ |
1565 withCurrentElement(Element element, f()) { | 1573 withCurrentElement(Element element, f()) { |
1566 Element old = currentElement; | 1574 Element old = currentElement; |
1567 _currentElement = element; | 1575 _currentElement = element; |
1568 try { | 1576 try { |
1569 return f(); | 1577 return f(); |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1879 | 1887 |
1880 _CompilerResolution(this.compiler); | 1888 _CompilerResolution(this.compiler); |
1881 | 1889 |
1882 @override | 1890 @override |
1883 DiagnosticReporter get reporter => compiler.reporter; | 1891 DiagnosticReporter get reporter => compiler.reporter; |
1884 | 1892 |
1885 @override | 1893 @override |
1886 ParsingContext get parsingContext => compiler.parsingContext; | 1894 ParsingContext get parsingContext => compiler.parsingContext; |
1887 | 1895 |
1888 @override | 1896 @override |
| 1897 CoreClasses get coreClasses => compiler.coreClasses; |
| 1898 |
| 1899 @override |
1889 CoreTypes get coreTypes => compiler.coreTypes; | 1900 CoreTypes get coreTypes => compiler.coreTypes; |
1890 | 1901 |
1891 @override | 1902 @override |
| 1903 Types get types => compiler.types; |
| 1904 |
| 1905 @override |
| 1906 Target get target => compiler.backend; |
| 1907 |
| 1908 @override |
1892 void registerClass(ClassElement cls) { | 1909 void registerClass(ClassElement cls) { |
1893 compiler.world.registerClass(cls); | 1910 compiler.world.registerClass(cls); |
1894 } | 1911 } |
1895 | 1912 |
1896 @override | 1913 @override |
1897 void resolveClass(ClassElement cls) { | 1914 void resolveClass(ClassElement cls) { |
1898 compiler.resolver.resolveClass(cls); | 1915 compiler.resolver.resolveClass(cls); |
1899 } | 1916 } |
1900 | 1917 |
1901 @override | 1918 @override |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2099 _ElementScanner(this.scanner); | 2116 _ElementScanner(this.scanner); |
2100 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 2117 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
2101 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 2118 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
2102 } | 2119 } |
2103 | 2120 |
2104 class _EmptyEnvironment implements Environment { | 2121 class _EmptyEnvironment implements Environment { |
2105 const _EmptyEnvironment(); | 2122 const _EmptyEnvironment(); |
2106 | 2123 |
2107 String valueOf(String key) => null; | 2124 String valueOf(String key) => null; |
2108 } | 2125 } |
OLD | NEW |