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

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

Issue 2856363002: Inference for typed ListLiteral(s). (Closed)
Patch Set: 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 DartType _inferExpression( 292 DartType _inferExpression(
293 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { 293 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
294 IsExpression isExpression = this.operand; 294 IsExpression isExpression = this.operand;
295 return inferrer.inferIsExpression( 295 return inferrer.inferIsExpression(
296 typeContext, typeNeeded, isExpression.operand); 296 typeContext, typeNeeded, isExpression.operand);
297 } 297 }
298 } 298 }
299 299
300 /// Concrete shadow object representing a list literal in kernel form. 300 /// Concrete shadow object representing a list literal in kernel form.
301 class KernelListLiteral extends ListLiteral implements KernelExpression { 301 class KernelListLiteral extends ListLiteral implements KernelExpression {
302 KernelListLiteral(List<KernelExpression> expressions, 302 KernelListLiteral(List<Expression> expressions,
303 {DartType typeArgument, bool isConst: false}) 303 {DartType typeArgument, bool isConst: false})
304 : super(expressions, typeArgument: typeArgument, isConst: isConst); 304 : super(expressions, typeArgument: typeArgument, isConst: isConst);
305 305
306 @override 306 @override
307 DartType _inferExpression( 307 DartType _inferExpression(
308 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { 308 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
309 // TODO(paulberry): implement. 309 return inferrer.inferListLiteral(typeContext, typeNeeded, typeArgument);
310 return typeNeeded ? const DynamicType() : null;
311 } 310 }
312 } 311 }
313 312
314 /// Shadow object for [LogicalExpression]. 313 /// Shadow object for [LogicalExpression].
315 class KernelLogicalExpression extends LogicalExpression 314 class KernelLogicalExpression extends LogicalExpression
316 implements KernelExpression { 315 implements KernelExpression {
317 KernelLogicalExpression(Expression left, String operator, Expression right) 316 KernelLogicalExpression(Expression left, String operator, Expression right)
318 : super(left, operator, right); 317 : super(left, operator, right);
319 318
320 @override 319 @override
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 // KernelVariableDeclaration. 877 // KernelVariableDeclaration.
879 mutatedInClosure = true; 878 mutatedInClosure = true;
880 declaredType = variable.type; 879 declaredType = variable.type;
881 } 880 }
882 return inferrer.inferVariableGet(typeContext, typeNeeded, mutatedInClosure, 881 return inferrer.inferVariableGet(typeContext, typeNeeded, mutatedInClosure,
883 _fact, _scope, fileOffset, declaredType, (type) { 882 _fact, _scope, fileOffset, declaredType, (type) {
884 promotedType = type; 883 promotedType = type;
885 }); 884 });
886 } 885 }
887 } 886 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698