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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// This file declares a "shadow hierarchy" of concrete classes which extend 5 /// This file declares a "shadow hierarchy" of concrete classes which extend
6 /// the kernel class hierarchy, adding methods and fields needed by the 6 /// the kernel class hierarchy, adding methods and fields needed by the
7 /// BodyBuilder. 7 /// BodyBuilder.
8 /// 8 ///
9 /// Instances of these classes may be created using the factory methods in 9 /// Instances of these classes may be created using the factory methods in
10 /// `ast_factory.dart`. 10 /// `ast_factory.dart`.
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 } 683 }
684 } 684 }
685 685
686 /// Concrete shadow object representing a field in kernel form. 686 /// Concrete shadow object representing a field in kernel form.
687 class KernelField extends Field { 687 class KernelField extends Field {
688 FieldNode _fieldNode; 688 FieldNode _fieldNode;
689 689
690 KernelTypeInferrer _typeInferrer; 690 KernelTypeInferrer _typeInferrer;
691 691
692 KernelField(Name name, {String fileUri}) : super(name, fileUri: fileUri) {} 692 KernelField(Name name, {String fileUri}) : super(name, fileUri: fileUri) {}
693
694 static FieldNode getFieldNode(Field field) {
695 if (field is KernelField) return field._fieldNode;
696 return null;
697 }
698
699 static void recordOverride(
700 KernelField field, Member overriddenMember, bool isSetter) {
701 if (field._fieldNode != null) {
702 if (isSetter && overriddenMember is Field) {
703 // When overriding a field, we are called twice; once for the setter and
704 // once for the getter. Ignore the setter.
705 return;
706 }
707 field._fieldNode.overrides.add(overriddenMember);
708 }
709 }
693 } 710 }
694 711
695 /// Concrete shadow object representing a for-in loop in kernel form. 712 /// Concrete shadow object representing a for-in loop in kernel form.
696 class KernelForInStatement extends ForInStatement implements KernelStatement { 713 class KernelForInStatement extends ForInStatement implements KernelStatement {
697 final bool _declaresVariable; 714 final bool _declaresVariable;
698 715
699 KernelForInStatement(VariableDeclaration variable, Expression iterable, 716 KernelForInStatement(VariableDeclaration variable, Expression iterable,
700 Statement body, this._declaresVariable, 717 Statement body, this._declaresVariable,
701 {bool isAsync: false}) 718 {bool isAsync: false})
702 : super(variable, iterable, body, isAsync: isAsync); 719 : super(variable, iterable, body, isAsync: isAsync);
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after
2287 } 2304 }
2288 2305
2289 transformChildren(v) { 2306 transformChildren(v) {
2290 return internalError("Internal error: Unsupported operation."); 2307 return internalError("Internal error: Unsupported operation.");
2291 } 2308 }
2292 2309
2293 visitChildren(v) { 2310 visitChildren(v) {
2294 return internalError("Internal error: Unsupported operation."); 2311 return internalError("Internal error: Unsupported operation.");
2295 } 2312 }
2296 } 2313 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698