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

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

Issue 2855323004: Infer VariableSet types. (Closed)
Patch Set: Fixes for review comments. 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 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 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 // KernelVariableDeclaration. 877 // KernelVariableDeclaration.
878 mutatedInClosure = true; 878 mutatedInClosure = true;
879 declaredType = variable.type; 879 declaredType = variable.type;
880 } 880 }
881 return inferrer.inferVariableGet(typeContext, typeNeeded, mutatedInClosure, 881 return inferrer.inferVariableGet(typeContext, typeNeeded, mutatedInClosure,
882 _fact, _scope, fileOffset, declaredType, (type) { 882 _fact, _scope, fileOffset, declaredType, (type) {
883 promotedType = type; 883 promotedType = type;
884 }); 884 });
885 } 885 }
886 } 886 }
887
888 /// Concrete shadow object representing a write to a variable in kernel form.
889 class KernelVariableSet extends VariableSet implements KernelExpression {
890 KernelVariableSet(VariableDeclaration variable, Expression value)
891 : super(variable, value);
892
893 @override
894 DartType _inferExpression(
895 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
896 var variable = this.variable as KernelVariableDeclaration;
897 return inferrer.inferVariableSet(
898 typeContext, typeNeeded, variable._declaredType, value);
899 }
900 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698