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

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

Issue 2863603004: Fix handling of null/bottom in front_end type inference. (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
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 : super(receiver, name, arguments, interfaceTarget); 357 : super(receiver, name, arguments, interfaceTarget);
358 358
359 KernelMethodInvocation.byReference(Expression receiver, Name name, 359 KernelMethodInvocation.byReference(Expression receiver, Name name,
360 Arguments arguments, Reference interfaceTargetReference) 360 Arguments arguments, Reference interfaceTargetReference)
361 : super.byReference(receiver, name, arguments, interfaceTargetReference); 361 : super.byReference(receiver, name, arguments, interfaceTargetReference);
362 362
363 @override 363 @override
364 DartType _inferExpression( 364 DartType _inferExpression(
365 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { 365 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
366 // TODO(scheglov): implement. 366 // TODO(scheglov): implement.
367 inferrer.inferExpression(receiver, null, false);
367 return typeNeeded ? const DynamicType() : null; 368 return typeNeeded ? const DynamicType() : null;
368 } 369 }
369 } 370 }
370 371
371 /// Shadow object for [Not]. 372 /// Shadow object for [Not].
372 class KernelNot extends Not implements KernelExpression { 373 class KernelNot extends Not implements KernelExpression {
373 KernelNot(Expression operand) : super(operand); 374 KernelNot(Expression operand) : super(operand);
374 375
375 @override 376 @override
376 DartType _inferExpression( 377 DartType _inferExpression(
377 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { 378 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
378 // TODO(scheglov): implement. 379 // TODO(scheglov): implement.
379 return typeNeeded ? const DynamicType() : null; 380 return typeNeeded ? const DynamicType() : null;
380 } 381 }
381 } 382 }
382 383
383 /// Concrete shadow object representing a null literal in kernel form. 384 /// Concrete shadow object representing a null literal in kernel form.
384 class KernelNullLiteral extends NullLiteral implements KernelExpression { 385 class KernelNullLiteral extends NullLiteral implements KernelExpression {
385 @override 386 @override
386 DartType _inferExpression( 387 DartType _inferExpression(
387 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { 388 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
388 // TODO(paulberry): implement. 389 return inferrer.inferNullLiteral(typeContext, typeNeeded);
389 return typeNeeded ? const DynamicType() : null;
390 } 390 }
391 } 391 }
392 392
393 /// Shadow object for [PropertyGet]. 393 /// Shadow object for [PropertyGet].
394 class KernelPropertyGet extends PropertyGet implements KernelExpression { 394 class KernelPropertyGet extends PropertyGet implements KernelExpression {
395 KernelPropertyGet(Expression receiver, Name name, [Member interfaceTarget]) 395 KernelPropertyGet(Expression receiver, Name name, [Member interfaceTarget])
396 : super(receiver, name, interfaceTarget); 396 : super(receiver, name, interfaceTarget);
397 397
398 KernelPropertyGet.byReference( 398 KernelPropertyGet.byReference(
399 Expression receiver, Name name, Reference interfaceTargetReference) 399 Expression receiver, Name name, Reference interfaceTargetReference)
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 : super(variable, value); 888 : super(variable, value);
889 889
890 @override 890 @override
891 DartType _inferExpression( 891 DartType _inferExpression(
892 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { 892 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
893 var variable = this.variable as KernelVariableDeclaration; 893 var variable = this.variable as KernelVariableDeclaration;
894 return inferrer.inferVariableSet( 894 return inferrer.inferVariableSet(
895 typeContext, typeNeeded, variable._declaredType, value); 895 typeContext, typeNeeded, variable._declaredType, value);
896 } 896 }
897 } 897 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698