OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 code_transformer.src.resolver; | 5 library code_transformer.src.resolver; |
6 | 6 |
7 import 'package:analyzer/src/generated/element.dart'; | 7 import 'package:analyzer/src/generated/element.dart'; |
8 import 'package:barback/barback.dart'; | 8 import 'package:barback/barback.dart'; |
9 import 'package:source_maps/refactor.dart'; | 9 import 'package:source_maps/refactor.dart'; |
10 import 'package:source_maps/span.dart' show SourceFile, Span; | 10 import 'package:source_maps/span.dart' show SourceFile, Span; |
11 | 11 |
12 | 12 |
13 /// Class for working with a barback based resolved AST. | 13 /// Class for working with a barback based resolved AST. |
14 abstract class Resolver { | 14 abstract class Resolver { |
15 /// The Dart entry point file where parsing begins. | 15 /// The Dart entry point file where parsing begins. |
16 AssetId get entryPoint; | 16 AssetId get entryPoint; |
17 | 17 |
| 18 /// Update the status of all the sources referenced by the entryPoint and |
| 19 /// update the resolved library. |
| 20 /// |
| 21 /// [release] must be called when done handling this Resolver to allow it |
| 22 /// to be used by later phases. |
| 23 Future<Resolver> resolve(Transform transform); |
| 24 |
| 25 /// Release this resolver so it can be updated by following transforms. |
| 26 void release(); |
| 27 |
18 /// Gets the resolved Dart library for the entry asset, or null if | 28 /// Gets the resolved Dart library for the entry asset, or null if |
19 /// the AST has not been resolved. | 29 /// the AST has not been resolved. |
20 /// | 30 /// |
21 /// If the AST has not been resolved then this normally means that the | 31 /// If the AST has not been resolved then this normally means that the |
22 /// transformer hosting this needs to be in an earlier phase. | 32 /// transformer hosting this needs to be in an earlier phase. |
23 LibraryElement get entryLibrary; | 33 LibraryElement get entryLibrary; |
24 | 34 |
25 /// Gets all libraries accessible from the entry point, recursively. | 35 /// Gets all libraries accessible from the entry point, recursively. |
26 /// | 36 /// |
27 /// This includes all Dart SDK libraries as well. | 37 /// This includes all Dart SDK libraries as well. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 Span getSourceSpan(Element element); | 82 Span getSourceSpan(Element element); |
73 | 83 |
74 /// Creates a text edit transaction for the given element if it is able | 84 /// Creates a text edit transaction for the given element if it is able |
75 /// to be edited, returns null otherwise. | 85 /// to be edited, returns null otherwise. |
76 /// | 86 /// |
77 /// The transaction contains the entire text of the source file where the | 87 /// The transaction contains the entire text of the source file where the |
78 /// element originated. If the element was from a library part then the | 88 /// element originated. If the element was from a library part then the |
79 /// source file is the part file rather than the library. | 89 /// source file is the part file rather than the library. |
80 TextEditTransaction createTextEditTransaction(Element element); | 90 TextEditTransaction createTextEditTransaction(Element element); |
81 } | 91 } |
OLD | NEW |