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

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

Issue 2986983002: Resynthesize metadata from Kernel, when already supported. (Closed)
Patch Set: Created 3 years, 5 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 | « no previous file | pkg/analyzer/lib/src/kernel/resynthesize.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 5e4dd8cf752a5b8bb9a4d77c61de513ac018c146..e5636cc19a5ce67ad85a104abf2c9278718ec47b 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -849,6 +849,10 @@ class ClassElementImpl extends AbstractClassElementImpl
@override
List<ElementAnnotation> get metadata {
+ if (_kernel != null) {
+ _metadata ??= enclosingUnit._kernelContext
+ .buildAnnotations(enclosingUnit, _kernel.annotations);
+ }
if (_unlinkedClass != null) {
return _metadata ??=
_buildAnnotations(enclosingUnit, _unlinkedClass.annotations);
@@ -4086,6 +4090,10 @@ abstract class ExecutableElementImpl extends ElementImpl
@override
List<ElementAnnotation> get metadata {
+ if (_kernel != null) {
+ _metadata ??= enclosingUnit._kernelContext
+ .buildAnnotations(enclosingUnit, _kernel.annotations);
+ }
if (serializedExecutable != null) {
return _metadata ??=
_buildAnnotations(enclosingUnit, serializedExecutable.annotations);
@@ -5927,6 +5935,12 @@ abstract class KernelLibraryResynthesizerContext {
kernel.Library get library;
/**
+ * TODO(scheglov) document
+ */
+ List<ElementAnnotation> buildAnnotations(
+ CompilationUnitElementImpl unit, List<kernel.Expression> annotations);
+
+ /**
* Build explicit top-level property accessors.
*/
UnitExplicitTopLevelAccessors buildTopLevelAccessors(
@@ -7636,6 +7650,10 @@ abstract class NonParameterVariableElementImpl extends VariableElementImpl {
@override
List<ElementAnnotation> get metadata {
+ if (_kernel != null) {
+ _metadata ??= enclosingUnit._kernelContext
+ .buildAnnotations(enclosingUnit, _kernel.annotations);
+ }
if (_unlinkedVariable != null) {
return _metadata ??=
_buildAnnotations(enclosingUnit, _unlinkedVariable.annotations);
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/kernel/resynthesize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698