Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: pkg/code_transformers/lib/src/resolver.dart

Issue 140203007: Adding package:code_transformers for unifying common transformers code (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/code_transformers/lib/src/resolver.dart
diff --git a/pkg/code_transformers/lib/src/resolver.dart b/pkg/code_transformers/lib/src/resolver.dart
new file mode 100644
index 0000000000000000000000000000000000000000..d8975cc8dd301e301aa628b126737c17930b0182
--- /dev/null
+++ b/pkg/code_transformers/lib/src/resolver.dart
@@ -0,0 +1,76 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library code_transformer.src.resolver;
+
+import 'package:analyzer/src/generated/element.dart';
+import 'package:barback/barback.dart';
+import 'package:source_maps/refactor.dart';
+import 'package:source_maps/span.dart' show SourceFile, Span;
+
+
+/// Class for working with a barback based resolved AST.
+abstract class Resolver {
+ /// The Dart entry point file where parsing begins.
+ AssetId get entryPoint;
+
+ /// Gets the resolved Dart library for the entry asset, or null if
+ /// the AST has not been resolved.
+ ///
+ /// If the AST has not been resolved then this normally means that the
+ /// transformer hosting this needs to be in an earlier phase.
+ LibraryElement get entryLibrary;
+
+ /// Gets all libraries accessible from the entry point, recursively.
+ ///
+ /// This includes all Dart SDK libraries as well.
+ Iterable<LibraryElement> get libraries;
+
+ /// Finds the first library identified by [libraryName], or null if no
+ /// library can be found.
+ LibraryElement getLibraryByName(String libraryName);
+
+ /// Finds the first library identified by [libraryName], or null if no
+ /// library can be found.
+ ///
+ /// [uri] must be an absolute URI of the form [dart:|package:]path/file.dart.
Siggi Cherem (dart-lang) 2014/02/14 02:13:37 not sure what our dartdoc does here with the brack
blois 2014/02/19 21:42:58 Done.
+ LibraryElement getLibraryByUri(Uri uri);
+
+ /// Resolves a fully-qualified type name (library_name.ClassName).
+ ///
+ /// This will resolve the first instance of this, because of potential library
Siggi Cherem (dart-lang) 2014/02/14 02:13:37 of this => of it? or "of this type" (just lost tra
blois 2014/02/19 21:42:58 Done.
+ /// name conflicts the name is not guaranteed to be unique.
+ ClassElement getType(String typeName);
+
+ /// Resolves a fully-qualified top-level library variable (library_name.Name).
Siggi Cherem (dart-lang) 2014/02/14 02:13:37 Name => variableName (to match variable-naming con
blois 2014/02/19 21:42:58 Done.
+ ///
+ /// This will resolve the first instance of this, because of potential library
Siggi Cherem (dart-lang) 2014/02/14 02:13:37 same here, and below
blois 2014/02/19 21:42:58 Done.
+ /// name conflicts the name is not guaranteed to be unique.
+ Element getLibraryVariable(String variableName);
+
+ /// Resolves a fully-qualified top-level library function (library_name.Name).
Siggi Cherem (dart-lang) 2014/02/14 02:13:37 Name -> functionName
blois 2014/02/19 21:42:58 Done.
+ ///
+ /// This will resolve the first instance of this, because of potential library
+ /// name conflicts the name is not guaranteed to be unique.
+ Element getLibraryFunction(String fnName);
+
+ /// Gets an URI appropriate for importing the specified library.
+ ///
+ /// Returns null if the library cannot be imported via an absolute URI or
+ /// from [from] (if provided).
+ Uri getImportUri(LibraryElement lib, {AssetId from});
+
+ /// Get the asset ID of the file containing the asset.
+ AssetId getSourceAssetId(Element element);
+
+ /// Get the source span where the specified element was defined or null if
+ /// the element came from the Dart SDK.
+ Span getSourceSpan(Element element);
+
+ /// Creates a text edit transaction for the given element if it is able
+ /// to be edited, returns null otherwise.
Siggi Cherem (dart-lang) 2014/02/14 02:13:37 maybe indicate what does this transaction contain?
blois 2014/02/19 21:42:58 Done.
+ TextEditTransaction createTextEditTransaction(Element element);
+}
+
Siggi Cherem (dart-lang) 2014/02/14 02:13:37 nit: delete trailing lines
blois 2014/02/19 21:42:58 Done.
+

Powered by Google App Engine
This is Rietveld 408576698