| OLD | NEW |
| 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 12 matching lines...) Expand all Loading... |
| 23 import 'package:front_end/src/fasta/type_inference/type_promotion.dart'; | 23 import 'package:front_end/src/fasta/type_inference/type_promotion.dart'; |
| 24 import 'package:kernel/ast.dart'; | 24 import 'package:kernel/ast.dart'; |
| 25 | 25 |
| 26 /// Shadow object for [AsExpression]. | 26 /// Shadow object for [AsExpression]. |
| 27 class KernelAsExpression extends AsExpression implements KernelExpression { | 27 class KernelAsExpression extends AsExpression implements KernelExpression { |
| 28 KernelAsExpression(Expression operand, DartType type) : super(operand, type); | 28 KernelAsExpression(Expression operand, DartType type) : super(operand, type); |
| 29 | 29 |
| 30 @override | 30 @override |
| 31 DartType _inferExpression( | 31 DartType _inferExpression( |
| 32 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { | 32 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { |
| 33 // TODO(scheglov): implement. | 33 return inferrer.inferAsExpression(typeContext, typeNeeded, operand, type); |
| 34 return typeNeeded ? const DynamicType() : null; | |
| 35 } | 34 } |
| 36 } | 35 } |
| 37 | 36 |
| 38 /// Shadow object for [AwaitExpression]. | 37 /// Shadow object for [AwaitExpression]. |
| 39 class KernelAwaitExpression extends AwaitExpression | 38 class KernelAwaitExpression extends AwaitExpression |
| 40 implements KernelExpression { | 39 implements KernelExpression { |
| 41 KernelAwaitExpression(Expression operand) : super(operand); | 40 KernelAwaitExpression(Expression operand) : super(operand); |
| 42 | 41 |
| 43 @override | 42 @override |
| 44 DartType _inferExpression( | 43 DartType _inferExpression( |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 // KernelVariableDeclaration. | 876 // KernelVariableDeclaration. |
| 878 mutatedInClosure = true; | 877 mutatedInClosure = true; |
| 879 declaredType = variable.type; | 878 declaredType = variable.type; |
| 880 } | 879 } |
| 881 return inferrer.inferVariableGet(typeContext, typeNeeded, mutatedInClosure, | 880 return inferrer.inferVariableGet(typeContext, typeNeeded, mutatedInClosure, |
| 882 _fact, _scope, fileOffset, declaredType, (type) { | 881 _fact, _scope, fileOffset, declaredType, (type) { |
| 883 promotedType = type; | 882 promotedType = type; |
| 884 }); | 883 }); |
| 885 } | 884 } |
| 886 } | 885 } |
| OLD | NEW |