OLD | NEW |
| (Empty) |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | |
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. | |
4 | |
5 import 'dart:async'; | |
6 | |
7 import 'package:analyzer/dart/ast/ast.dart'; | |
8 import 'package:analyzer/dart/element/element.dart'; | |
9 import 'package:analyzer/src/dart/analysis/ast_provider_driver.dart'; | |
10 import 'package:analyzer/src/dart/element/ast_provider.dart'; | |
11 import 'package:analyzer/src/generated/engine.dart'; | |
12 | |
13 /** | |
14 * [AstProvider] implementation for [AnalysisContext]. | |
15 */ | |
16 class AstProviderForContext extends AbstractAstProvider { | |
17 final AnalysisContext context; | |
18 | |
19 AstProviderForContext(this.context); | |
20 | |
21 @override | |
22 Future<CompilationUnit> getParsedUnitForElement(Element element) async { | |
23 return context.parseCompilationUnit(element.source); | |
24 } | |
25 | |
26 @override | |
27 Future<CompilationUnit> getResolvedUnitForElement(Element element) async { | |
28 return context.getResolvedCompilationUnit2( | |
29 element.source, element.librarySource); | |
30 } | |
31 } | |
OLD | NEW |