| 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.common.resolution; | 5 library dart2js.common.resolution; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../compile_time_constants.dart'; | 8 import '../compile_time_constants.dart'; |
| 9 import '../constants/expressions.dart' show ConstantExpression; | 9 import '../constants/expressions.dart' show ConstantExpression; |
| 10 import '../constants/values.dart' show ConstantValue; | 10 import '../constants/values.dart' show ConstantValue; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 Iterable<Feature> get features => const <Feature>[]; | 69 Iterable<Feature> get features => const <Feature>[]; |
| 70 Iterable<MapLiteralUse> get mapLiterals => const <MapLiteralUse>[]; | 70 Iterable<MapLiteralUse> get mapLiterals => const <MapLiteralUse>[]; |
| 71 Iterable<ListLiteralUse> get listLiterals => const <ListLiteralUse>[]; | 71 Iterable<ListLiteralUse> get listLiterals => const <ListLiteralUse>[]; |
| 72 Iterable<String> get constSymbolNames => const <String>[]; | 72 Iterable<String> get constSymbolNames => const <String>[]; |
| 73 Iterable<ConstantExpression> get constantLiterals => | 73 Iterable<ConstantExpression> get constantLiterals => |
| 74 const <ConstantExpression>[]; | 74 const <ConstantExpression>[]; |
| 75 | 75 |
| 76 Iterable<dynamic> get nativeData => const <dynamic>[]; | 76 Iterable<dynamic> get nativeData => const <dynamic>[]; |
| 77 } | 77 } |
| 78 | 78 |
| 79 /// Interface for the accessing the front-end analysis. | |
| 80 // TODO(johnniwinther): Find a better name for this. | |
| 81 abstract class Frontend { | |
| 82 /// Returns the [ResolutionImpact] for [element]. | |
| 83 ResolutionImpact getResolutionImpact(Element element); | |
| 84 } | |
| 85 | |
| 86 /// Interface defining target-specific behavior for resolution. | 79 /// Interface defining target-specific behavior for resolution. |
| 87 abstract class Target { | 80 abstract class Target { |
| 88 /// Returns `true` if [library] is a target specific library whose members | 81 /// Returns `true` if [library] is a target specific library whose members |
| 89 /// have special treatment, such as being allowed to extends blacklisted | 82 /// have special treatment, such as being allowed to extends blacklisted |
| 90 /// classes or members being eagerly resolved. | 83 /// classes or members being eagerly resolved. |
| 91 bool isTargetSpecificLibrary(LibraryElement element); | 84 bool isTargetSpecificLibrary(LibraryElement element); |
| 92 | 85 |
| 93 /// Resolve target specific information for [element] and register it with | 86 /// Resolve target specific information for [element] and register it with |
| 94 /// [registry]. | 87 /// [registry]. |
| 95 void resolveNativeMember(MemberElement element, NativeRegistry registry) {} | 88 void resolveNativeMember(MemberElement element, NativeRegistry registry) {} |
| (...skipping 23 matching lines...) Expand all Loading... |
| 119 | 112 |
| 120 /// Returns `true` if [element] is a foreign element, that is, that the | 113 /// Returns `true` if [element] is a foreign element, that is, that the |
| 121 /// backend has specialized handling for the element. | 114 /// backend has specialized handling for the element. |
| 122 bool isForeign(Element element) => false; | 115 bool isForeign(Element element) => false; |
| 123 | 116 |
| 124 /// Returns `true` if this target supports async/await. | 117 /// Returns `true` if this target supports async/await. |
| 125 bool get supportsAsyncAwait => true; | 118 bool get supportsAsyncAwait => true; |
| 126 } | 119 } |
| 127 | 120 |
| 128 // TODO(johnniwinther): Rename to `Resolver` or `ResolverContext`. | 121 // TODO(johnniwinther): Rename to `Resolver` or `ResolverContext`. |
| 129 abstract class Resolution implements Frontend { | 122 abstract class Resolution { |
| 130 ParsingContext get parsingContext; | 123 ParsingContext get parsingContext; |
| 131 DiagnosticReporter get reporter; | 124 DiagnosticReporter get reporter; |
| 132 CommonElements get commonElements; | 125 CommonElements get commonElements; |
| 133 Types get types; | 126 Types get types; |
| 134 Target get target; | 127 Target get target; |
| 135 ResolverTask get resolver; | 128 ResolverTask get resolver; |
| 136 ResolutionEnqueuer get enqueuer; | 129 ResolutionEnqueuer get enqueuer; |
| 137 CompilerOptions get options; | 130 CompilerOptions get options; |
| 138 IdGenerator get idGenerator; | 131 IdGenerator get idGenerator; |
| 139 ConstantEnvironment get constants; | 132 ConstantEnvironment get constants; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 if (cls.isPatch) { | 251 if (cls.isPatch) { |
| 259 patchParser.parsePatchClassNode(cls); | 252 patchParser.parsePatchClassNode(cls); |
| 260 } | 253 } |
| 261 }); | 254 }); |
| 262 } | 255 } |
| 263 | 256 |
| 264 @override | 257 @override |
| 265 ScannerOptions getScannerOptionsFor(Element element) => new ScannerOptions( | 258 ScannerOptions getScannerOptionsFor(Element element) => new ScannerOptions( |
| 266 canUseNative: backend.canLibraryUseNative(element.library)); | 259 canUseNative: backend.canLibraryUseNative(element.library)); |
| 267 } | 260 } |
| OLD | NEW |