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

Unified Diff: pkg/analyzer/lib/src/dart/element/element.dart

Issue 1665353002: Use ElementAnnotation as the ConstantEvaluationTarget for annotations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « pkg/analyzer/lib/dart/element/element.dart ('k') | pkg/analyzer/lib/src/generated/constant.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/element/element.dart
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 11dc96c7d2d2713166a18d3a2333849427b8eb49..02d0fa107d6991f4f5a1e409d6e9df0cae39f4bb 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -1573,7 +1573,13 @@ class ElementAnnotationImpl implements ElementAnnotation {
/**
* The compliation unit in which this annotation appears.
*/
- final CompilationUnitElement compilationUnit;
+ final CompilationUnitElementImpl compilationUnit;
+
+ /**
+ * The AST of the annotation itself, cloned from the resolved AST for the
+ * source code.
+ */
+ Annotation annotationAst;
/**
* The result of evaluating this annotation as a compile-time constant
@@ -1592,6 +1598,9 @@ class ElementAnnotationImpl implements ElementAnnotation {
DartObject get constantValue => evaluationResult.value;
@override
+ AnalysisContext get context => compilationUnit.library.context;
+
+ @override
bool get isDeprecated {
if (element != null) {
LibraryElement library = element.library;
@@ -1639,6 +1648,14 @@ class ElementAnnotationImpl implements ElementAnnotation {
return false;
}
+ /**
+ * Get the library containing this annotation.
+ */
+ Source get librarySource => compilationUnit.librarySource;
+
+ @override
+ Source get source => compilationUnit.source;
+
@override
String toString() => '@$element';
}
@@ -4111,8 +4128,8 @@ class ParameterElementImpl extends VariableElementImpl
/**
* Creates a synthetic parameter with [name], [type] and [kind].
*/
- factory ParameterElementImpl.synthetic(String name, DartType type,
- ParameterKind kind) {
+ factory ParameterElementImpl.synthetic(
+ String name, DartType type, ParameterKind kind) {
ParameterElementImpl element = new ParameterElementImpl(name, -1);
element.type = type;
element.synthetic = true;
« no previous file with comments | « pkg/analyzer/lib/dart/element/element.dart ('k') | pkg/analyzer/lib/src/generated/constant.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698