| 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 '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
| 9 import '../constants/expressions.dart' show ConstantExpression; | 9 import '../constants/expressions.dart' show ConstantExpression; |
| 10 import '../core_types.dart' show CoreTypes; | 10 import '../core_types.dart' show CoreTypes; |
| 11 import '../dart_types.dart' show DartType, InterfaceType; | 11 import '../dart_types.dart' show DartType, InterfaceType; |
| 12 import '../elements/elements.dart' | 12 import '../elements/elements.dart' |
| 13 show | 13 show |
| 14 AstElement, | 14 AstElement, |
| 15 ClassElement, | 15 ClassElement, |
| 16 Element, | 16 Element, |
| 17 ExecutableElement, |
| 17 FunctionElement, | 18 FunctionElement, |
| 18 FunctionSignature, | 19 FunctionSignature, |
| 19 MetadataAnnotation, | 20 MetadataAnnotation, |
| 20 ResolvedAst, | 21 ResolvedAst, |
| 21 TypedefElement; | 22 TypedefElement; |
| 22 import '../enqueue.dart' show ResolutionEnqueuer; | 23 import '../enqueue.dart' show ResolutionEnqueuer; |
| 23 import '../options.dart' show ParserOptions; | 24 import '../options.dart' show ParserOptions; |
| 24 import '../parser/element_listener.dart' show ScannerOptions; | 25 import '../parser/element_listener.dart' show ScannerOptions; |
| 25 import '../parser/parser_task.dart'; | 26 import '../parser/parser_task.dart'; |
| 26 import '../patch_parser.dart'; | 27 import '../patch_parser.dart'; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 183 |
| 183 String toString() { | 184 String toString() { |
| 184 return 'ListLiteralUse($type,isConstant:$isConstant,isEmpty:$isEmpty)'; | 185 return 'ListLiteralUse($type,isConstant:$isConstant,isEmpty:$isEmpty)'; |
| 185 } | 186 } |
| 186 } | 187 } |
| 187 | 188 |
| 188 /// Interface for the accessing the front-end analysis. | 189 /// Interface for the accessing the front-end analysis. |
| 189 // TODO(johnniwinther): Find a better name for this. | 190 // TODO(johnniwinther): Find a better name for this. |
| 190 abstract class Frontend { | 191 abstract class Frontend { |
| 191 /// Returns `true` if [element] has a [ResolvedAst]. | 192 /// Returns `true` if [element] has a [ResolvedAst]. |
| 192 bool hasResolvedAst(Element element); | 193 bool hasResolvedAst(ExecutableElement element); |
| 193 | 194 |
| 194 /// Returns the `ResolvedAst` for the [element]. | 195 /// Returns the `ResolvedAst` for the [element]. |
| 195 ResolvedAst getResolvedAst(Element element); | 196 ResolvedAst getResolvedAst(ExecutableElement element); |
| 196 | 197 |
| 197 /// Returns the [ResolutionImpact] for [element]. | 198 /// Returns the [ResolutionImpact] for [element]. |
| 198 ResolutionImpact getResolutionImpact(Element element); | 199 ResolutionImpact getResolutionImpact(Element element); |
| 199 } | 200 } |
| 200 | 201 |
| 201 // TODO(johnniwinther): Rename to `Resolver` or `ResolverContext`. | 202 // TODO(johnniwinther): Rename to `Resolver` or `ResolverContext`. |
| 202 abstract class Resolution implements Frontend { | 203 abstract class Resolution implements Frontend { |
| 203 ParsingContext get parsingContext; | 204 ParsingContext get parsingContext; |
| 204 DiagnosticReporter get reporter; | 205 DiagnosticReporter get reporter; |
| 205 CoreTypes get coreTypes; | 206 CoreTypes get coreTypes; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 221 // return `false`. | 222 // return `false`. |
| 222 bool hasBeenResolved(Element element); | 223 bool hasBeenResolved(Element element); |
| 223 | 224 |
| 224 /// Resolve [element] if it has not already been resolved. | 225 /// Resolve [element] if it has not already been resolved. |
| 225 void ensureResolved(Element element); | 226 void ensureResolved(Element element); |
| 226 | 227 |
| 227 ResolutionWorkItem createWorkItem( | 228 ResolutionWorkItem createWorkItem( |
| 228 Element element, ItemCompilationContext compilationContext); | 229 Element element, ItemCompilationContext compilationContext); |
| 229 | 230 |
| 230 /// Returns `true` if [element] as a fully computed [ResolvedAst]. | 231 /// Returns `true` if [element] as a fully computed [ResolvedAst]. |
| 231 bool hasResolvedAst(Element element); | 232 bool hasResolvedAst(ExecutableElement element); |
| 232 | 233 |
| 233 /// Returns the `ResolvedAst` for the [element]. | 234 /// Returns the `ResolvedAst` for the [element]. |
| 234 ResolvedAst getResolvedAst(Element element); | 235 ResolvedAst getResolvedAst(ExecutableElement element); |
| 235 | 236 |
| 236 /// Returns `true` if the [ResolutionImpact] for [element] is cached. | 237 /// Returns `true` if the [ResolutionImpact] for [element] is cached. |
| 237 bool hasResolutionImpact(Element element); | 238 bool hasResolutionImpact(Element element); |
| 238 | 239 |
| 239 /// Returns the precomputed [ResolutionImpact] for [element]. | 240 /// Returns the precomputed [ResolutionImpact] for [element]. |
| 240 ResolutionImpact getResolutionImpact(Element element); | 241 ResolutionImpact getResolutionImpact(Element element); |
| 241 | 242 |
| 242 /// Returns the [ResolvedAst] for [element], computing it if necessary. | 243 /// Returns the [ResolvedAst] for [element], computing it if necessary. |
| 243 ResolvedAst computeResolvedAst(Element element); | 244 ResolvedAst computeResolvedAst(Element element); |
| 244 | 245 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 if (cls.isPatch) { | 306 if (cls.isPatch) { |
| 306 patchParser.parsePatchClassNode(cls); | 307 patchParser.parsePatchClassNode(cls); |
| 307 } | 308 } |
| 308 }); | 309 }); |
| 309 } | 310 } |
| 310 | 311 |
| 311 @override | 312 @override |
| 312 ScannerOptions getScannerOptionsFor(Element element) => new ScannerOptions( | 313 ScannerOptions getScannerOptionsFor(Element element) => new ScannerOptions( |
| 313 canUseNative: backend.canLibraryUseNative(element.library)); | 314 canUseNative: backend.canLibraryUseNative(element.library)); |
| 314 } | 315 } |
| OLD | NEW |