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

Unified Diff: pkg/compiler/lib/src/kernel/element_map.dart

Issue 2854013002: Make JavaScriptBackend.processAnnotations element-model agnostic (Closed)
Patch Set: Fix and check declaration invariant. Created 3 years, 7 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/compiler/lib/src/kernel/element_map.dart
diff --git a/pkg/compiler/lib/src/kernel/element_map.dart b/pkg/compiler/lib/src/kernel/element_map.dart
index 658a577988aa9fc44366727233b2fa1395216da7..b2a373ba557d8dfa2fea55393a9d6354754dd6fc 100644
--- a/pkg/compiler/lib/src/kernel/element_map.dart
+++ b/pkg/compiler/lib/src/kernel/element_map.dart
@@ -800,9 +800,9 @@ class _KClassEnv {
}
}
- Iterable<ConstantExpression> getMetadata(KernelToElementMap worldBuilder) {
+ Iterable<ConstantExpression> getMetadata(KernelToElementMap elementMap) {
if (_metadata == null) {
- _metadata = worldBuilder.getMetadata(cls.annotations);
+ _metadata = elementMap.getMetadata(cls.annotations);
}
return _metadata;
}
@@ -810,12 +810,17 @@ class _KClassEnv {
class _MemberData {
final ir.Member node;
+ Iterable<ConstantExpression> _metadata;
_MemberData(this.node);
ResolutionImpact getWorldImpact(KernelToElementMap elementMap) {
return buildKernelImpact(node, elementMap);
}
+
+ Iterable<ConstantExpression> getMetadata(KernelToElementMap elementMap) {
+ return _metadata ??= elementMap.getMetadata(node.annotations);
+ }
}
class _FunctionData extends _MemberData {
@@ -1040,6 +1045,16 @@ class KernelElementEnvironment implements ElementEnvironment {
// TODO(johnniwinther): Support these.
return false;
}
+
+ @override
+ Iterable<ConstantValue> getMemberMetadata(KMember member) {
+ List<ConstantValue> values = <ConstantValue>[];
+ _MemberData memberData = elementMap._memberList[member.memberIndex];
+ for (ConstantExpression constant in memberData.getMetadata(elementMap)) {
+ values.add(elementMap.constantEnvironment.getConstantValue(constant));
+ }
+ return values;
+ }
}
/// Visitor that converts kernel dart types into [DartType].
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/resolution/resolution_strategy.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698