| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library code_transformer.src.resolver; |
| 6 |
| 7 import 'package:analyzer/src/generated/element.dart'; |
| 8 import 'package:barback/barback.dart'; |
| 9 import 'package:source_maps/refactor.dart'; |
| 10 import 'package:source_maps/span.dart' show SourceFile, Span; |
| 11 |
| 12 |
| 13 /// Class for working with a barback based resolved AST. |
| 14 abstract class Resolver { |
| 15 /// The Dart entry point file where parsing begins. |
| 16 AssetId get entryPoint; |
| 17 |
| 18 /// Gets the resolved Dart library for the entry asset, or null if |
| 19 /// the AST has not been resolved. |
| 20 /// |
| 21 /// If the AST has not been resolved then this normally means that the |
| 22 /// transformer hosting this needs to be in an earlier phase. |
| 23 LibraryElement get entryLibrary; |
| 24 |
| 25 /// Gets all libraries accessible from the entry point, recursively. |
| 26 /// |
| 27 /// This includes all Dart SDK libraries as well. |
| 28 Iterable<LibraryElement> get libraries; |
| 29 |
| 30 /// Finds the first library identified by [libraryName], or null if no |
| 31 /// library can be found. |
| 32 LibraryElement getLibraryByName(String libraryName); |
| 33 |
| 34 /// Finds the first library identified by [libraryName], or null if no |
| 35 /// library can be found. |
| 36 /// |
| 37 /// [uri] must be an absolute URI of the form |
| 38 /// `[dart:|package:]path/file.dart`. |
| 39 LibraryElement getLibraryByUri(Uri uri); |
| 40 |
| 41 /// Resolves a fully-qualified type name (library_name.ClassName). |
| 42 /// |
| 43 /// This will resolve the first instance of [typeName], because of potential |
| 44 /// library name conflicts the name is not guaranteed to be unique. |
| 45 ClassElement getType(String typeName); |
| 46 |
| 47 /// Resolves a fully-qualified top-level library variable |
| 48 /// (library_name.variableName). |
| 49 /// |
| 50 /// This will resolve the first instance of [variableName], because of |
| 51 /// potential library name conflicts the name is not guaranteed to be unique. |
| 52 Element getLibraryVariable(String variableName); |
| 53 |
| 54 /// Resolves a fully-qualified top-level library function |
| 55 /// (library_name.functionName). |
| 56 /// |
| 57 /// This will resolve the first instance of [functionName], because of |
| 58 /// potential library name conflicts the name is not guaranteed to be unique. |
| 59 Element getLibraryFunction(String functionName); |
| 60 |
| 61 /// Gets an URI appropriate for importing the specified library. |
| 62 /// |
| 63 /// Returns null if the library cannot be imported via an absolute URI or |
| 64 /// from [from] (if provided). |
| 65 Uri getImportUri(LibraryElement lib, {AssetId from}); |
| 66 |
| 67 /// Get the asset ID of the file containing the asset. |
| 68 AssetId getSourceAssetId(Element element); |
| 69 |
| 70 /// Get the source span where the specified element was defined or null if |
| 71 /// the element came from the Dart SDK. |
| 72 Span getSourceSpan(Element element); |
| 73 |
| 74 /// Creates a text edit transaction for the given element if it is able |
| 75 /// to be edited, returns null otherwise. |
| 76 /// |
| 77 /// 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 |
| 79 /// source file is the part file rather than the library. |
| 80 TextEditTransaction createTextEditTransaction(Element element); |
| 81 } |
| OLD | NEW |