| 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 '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
| 10 import '../constants/expressions.dart' show ConstantExpression; | 10 import '../constants/expressions.dart' show ConstantExpression; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 FunctionElement, | 21 FunctionElement, |
| 22 FunctionSignature, | 22 FunctionSignature, |
| 23 LibraryElement, | 23 LibraryElement, |
| 24 MetadataAnnotation, | 24 MetadataAnnotation, |
| 25 MethodElement, | 25 MethodElement, |
| 26 ResolvedAst, | 26 ResolvedAst, |
| 27 TypedefElement; | 27 TypedefElement; |
| 28 import '../enqueue.dart' show ResolutionEnqueuer; | 28 import '../enqueue.dart' show ResolutionEnqueuer; |
| 29 import '../id_generator.dart'; | 29 import '../id_generator.dart'; |
| 30 import '../mirrors_used.dart'; | 30 import '../mirrors_used.dart'; |
| 31 import '../options.dart' show CompilerOptions, ParserOptions; | 31 import '../options.dart' show CompilerOptions; |
| 32 import '../parser/element_listener.dart' show ScannerOptions; | 32 import '../parser/element_listener.dart' show ScannerOptions; |
| 33 import '../parser/parser_task.dart'; | 33 import '../parser/parser_task.dart'; |
| 34 import '../patch_parser.dart'; | 34 import '../patch_parser.dart'; |
| 35 import '../resolution/resolution.dart'; | 35 import '../resolution/resolution.dart'; |
| 36 import '../tree/tree.dart' show Send, TypeAnnotation; | 36 import '../tree/tree.dart' show Send, TypeAnnotation; |
| 37 import '../universe/call_structure.dart' show CallStructure; | 37 import '../universe/call_structure.dart' show CallStructure; |
| 38 import '../universe/world_impact.dart' show WorldImpact; | 38 import '../universe/world_impact.dart' show WorldImpact; |
| 39 import '../universe/feature.dart'; | 39 import '../universe/feature.dart'; |
| 40 import 'backend_api.dart'; | 40 import 'backend_api.dart'; |
| 41 import 'work.dart' show WorkItem; | 41 import 'work.dart' show WorkItem; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 /// Returns `true` if [value] is the top-level [proxy] annotation from the | 206 /// Returns `true` if [value] is the top-level [proxy] annotation from the |
| 207 /// core library. | 207 /// core library. |
| 208 bool isProxyConstant(ConstantValue value); | 208 bool isProxyConstant(ConstantValue value); |
| 209 } | 209 } |
| 210 | 210 |
| 211 /// A container of commonly used dependencies for tasks that involve parsing. | 211 /// A container of commonly used dependencies for tasks that involve parsing. |
| 212 abstract class ParsingContext { | 212 abstract class ParsingContext { |
| 213 factory ParsingContext( | 213 factory ParsingContext( |
| 214 DiagnosticReporter reporter, | 214 DiagnosticReporter reporter, |
| 215 ParserOptions parserOptions, | |
| 216 ParserTask parser, | 215 ParserTask parser, |
| 217 PatchParserTask patchParser, | 216 PatchParserTask patchParser, |
| 218 Backend backend) = _ParsingContext; | 217 Backend backend) = _ParsingContext; |
| 219 | 218 |
| 220 DiagnosticReporter get reporter; | 219 DiagnosticReporter get reporter; |
| 221 ParserOptions get parserOptions; | |
| 222 ParserTask get parser; | 220 ParserTask get parser; |
| 223 PatchParserTask get patchParser; | 221 PatchParserTask get patchParser; |
| 224 | 222 |
| 225 /// Use [patchParser] directly instead. | 223 /// Use [patchParser] directly instead. |
| 226 @deprecated | 224 @deprecated |
| 227 void parsePatchClass(ClassElement cls); | 225 void parsePatchClass(ClassElement cls); |
| 228 | 226 |
| 229 /// Use [parser] and measure directly instead. | 227 /// Use [parser] and measure directly instead. |
| 230 @deprecated | 228 @deprecated |
| 231 measure(f()); | 229 measure(f()); |
| 232 | 230 |
| 233 /// Get the [ScannerOptions] to scan the given [element]. | 231 /// Get the [ScannerOptions] to scan the given [element]. |
| 234 ScannerOptions getScannerOptionsFor(Element element); | 232 ScannerOptions getScannerOptionsFor(Element element); |
| 235 } | 233 } |
| 236 | 234 |
| 237 class _ParsingContext implements ParsingContext { | 235 class _ParsingContext implements ParsingContext { |
| 238 final DiagnosticReporter reporter; | 236 final DiagnosticReporter reporter; |
| 239 final ParserOptions parserOptions; | |
| 240 final ParserTask parser; | 237 final ParserTask parser; |
| 241 final PatchParserTask patchParser; | 238 final PatchParserTask patchParser; |
| 242 final Backend backend; | 239 final Backend backend; |
| 243 | 240 |
| 244 _ParsingContext(this.reporter, this.parserOptions, this.parser, | 241 _ParsingContext(this.reporter, this.parser, |
| 245 this.patchParser, this.backend); | 242 this.patchParser, this.backend); |
| 246 | 243 |
| 247 @override | 244 @override |
| 248 measure(f()) => parser.measure(f); | 245 measure(f()) => parser.measure(f); |
| 249 | 246 |
| 250 @override | 247 @override |
| 251 void parsePatchClass(ClassElement cls) { | 248 void parsePatchClass(ClassElement cls) { |
| 252 patchParser.measure(() { | 249 patchParser.measure(() { |
| 253 if (cls.isPatch) { | 250 if (cls.isPatch) { |
| 254 patchParser.parsePatchClassNode(cls); | 251 patchParser.parsePatchClassNode(cls); |
| 255 } | 252 } |
| 256 }); | 253 }); |
| 257 } | 254 } |
| 258 | 255 |
| 259 @override | 256 @override |
| 260 ScannerOptions getScannerOptionsFor(Element element) => new ScannerOptions( | 257 ScannerOptions getScannerOptionsFor(Element element) => new ScannerOptions( |
| 261 canUseNative: backend.canLibraryUseNative(element.library)); | 258 canUseNative: backend.canLibraryUseNative(element.library)); |
| 262 } | 259 } |
| OLD | NEW |