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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart

Issue 2938423003: Implement override-based inference of instance fields. (Closed)
Patch Set: Created 3 years, 6 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/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
index f399fa34020c504e66294ce0281f024fddba4bef..94839faa7f30f88ee44dbe0e796bfa8ed5efc5bb 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
@@ -690,6 +690,23 @@ class KernelField extends Field {
KernelTypeInferrer _typeInferrer;
KernelField(Name name, {String fileUri}) : super(name, fileUri: fileUri) {}
+
+ static FieldNode getFieldNode(Field field) {
+ if (field is KernelField) return field._fieldNode;
+ return null;
+ }
+
+ static void recordOverride(
+ KernelField field, Member overriddenMember, bool isSetter) {
+ if (field._fieldNode != null) {
+ if (isSetter && overriddenMember is Field) {
+ // When overriding a field, we are called twice; once for the setter and
+ // once for the getter. Ignore the setter.
+ return;
+ }
+ field._fieldNode.overrides.add(overriddenMember);
+ }
+ }
}
/// Concrete shadow object representing a for-in loop in kernel form.

Powered by Google App Engine
This is Rietveld 408576698