| 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 17 matching lines...) Expand all Loading... |
| 28 KernelBlock(List<Statement> statements) : super(statements); | 28 KernelBlock(List<Statement> statements) : super(statements); |
| 29 | 29 |
| 30 @override | 30 @override |
| 31 void _inferStatement(KernelTypeInferrer inferrer) { | 31 void _inferStatement(KernelTypeInferrer inferrer) { |
| 32 for (var statement in statements) { | 32 for (var statement in statements) { |
| 33 inferrer.inferStatement(statement); | 33 inferrer.inferStatement(statement); |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 | 37 |
| 38 /// Concrete shadow object representing a double literal in kernel form. |
| 39 class KernelDoubleLiteral extends DoubleLiteral implements KernelExpression { |
| 40 KernelDoubleLiteral(double value) : super(value); |
| 41 |
| 42 @override |
| 43 DartType _inferExpression( |
| 44 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { |
| 45 return inferrer.inferDoubleLiteral(typeContext, typeNeeded); |
| 46 } |
| 47 } |
| 48 |
| 38 /// Common base class for shadow objects representing expressions in kernel | 49 /// Common base class for shadow objects representing expressions in kernel |
| 39 /// form. | 50 /// form. |
| 40 abstract class KernelExpression implements Expression { | 51 abstract class KernelExpression implements Expression { |
| 41 /// Calls back to [inferrer] to perform type inference for whatever concrete | 52 /// Calls back to [inferrer] to perform type inference for whatever concrete |
| 42 /// type of [KernelExpression] this is. | 53 /// type of [KernelExpression] this is. |
| 43 DartType _inferExpression( | 54 DartType _inferExpression( |
| 44 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded); | 55 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded); |
| 45 } | 56 } |
| 46 | 57 |
| 47 /// Concrete shadow object representing an expression statement in kernel form. | 58 /// Concrete shadow object representing an expression statement in kernel form. |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 // KernelVariableDeclaration. | 486 // KernelVariableDeclaration. |
| 476 mutatedInClosure = true; | 487 mutatedInClosure = true; |
| 477 declaredType = variable.type; | 488 declaredType = variable.type; |
| 478 } | 489 } |
| 479 return inferrer.inferVariableGet(typeContext, typeNeeded, mutatedInClosure, | 490 return inferrer.inferVariableGet(typeContext, typeNeeded, mutatedInClosure, |
| 480 _fact, _scope, fileOffset, declaredType, (type) { | 491 _fact, _scope, fileOffset, declaredType, (type) { |
| 481 promotedType = type; | 492 promotedType = type; |
| 482 }); | 493 }); |
| 483 } | 494 } |
| 484 } | 495 } |
| OLD | NEW |