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

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

Issue 2994533002: Perform type inference on constructor field initializer expressions. (Closed)
Patch Set: Created 3 years, 4 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 @override 684 @override
685 void setInferredType( 685 void setInferredType(
686 TypeInferenceEngineImpl engine, String uri, DartType inferredType) { 686 TypeInferenceEngineImpl engine, String uri, DartType inferredType) {
687 engine.instrumentation?.record(Uri.parse(uri), fileOffset, 'topType', 687 engine.instrumentation?.record(Uri.parse(uri), fileOffset, 'topType',
688 new InstrumentationValueForType(inferredType)); 688 new InstrumentationValueForType(inferredType));
689 type = inferredType; 689 type = inferredType;
690 } 690 }
691 } 691 }
692 692
693 /// Concrete shadow object representing a field initializer in kernel form.
694 class KernelFieldInitializer extends FieldInitializer
695 implements KernelInitializer {
696 KernelFieldInitializer(Field field, Expression value) : super(field, value);
697
698 @override
699 void _inferInitializer(KernelTypeInferrer inferrer) {
700 inferrer.listener.fieldInitializerEnter(this);
701 inferrer.inferExpression(value, field.type, false);
702 inferrer.listener.fieldInitializerExit(this);
703 }
704 }
705
693 /// Concrete shadow object representing a for-in loop in kernel form. 706 /// Concrete shadow object representing a for-in loop in kernel form.
694 class KernelForInStatement extends ForInStatement implements KernelStatement { 707 class KernelForInStatement extends ForInStatement implements KernelStatement {
695 final bool _declaresVariable; 708 final bool _declaresVariable;
696 709
697 KernelForInStatement(VariableDeclaration variable, Expression iterable, 710 KernelForInStatement(VariableDeclaration variable, Expression iterable,
698 Statement body, this._declaresVariable, 711 Statement body, this._declaresVariable,
699 {bool isAsync: false}) 712 {bool isAsync: false})
700 : super(variable, iterable, body, isAsync: isAsync); 713 : super(variable, iterable, body, isAsync: isAsync);
701 714
702 @override 715 @override
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after
2415 accept(v) => unsupported("accept", -1, null); 2428 accept(v) => unsupported("accept", -1, null);
2416 2429
2417 accept1(v, arg) => unsupported("accept1", -1, null); 2430 accept1(v, arg) => unsupported("accept1", -1, null);
2418 2431
2419 getStaticType(types) => unsupported("getStaticType", -1, null); 2432 getStaticType(types) => unsupported("getStaticType", -1, null);
2420 2433
2421 transformChildren(v) => unsupported("transformChildren", -1, null); 2434 transformChildren(v) => unsupported("transformChildren", -1, null);
2422 2435
2423 visitChildren(v) => unsupported("visitChildren", -1, null); 2436 visitChildren(v) => unsupported("visitChildren", -1, null);
2424 } 2437 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698