| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 /// Calls back to [inferrer] to perform type inference for whatever concrete | 108 /// Calls back to [inferrer] to perform type inference for whatever concrete |
| 109 /// type of [KernelStatement] this is. | 109 /// type of [KernelStatement] this is. |
| 110 void _inferStatement(KernelTypeInferrer inferrer); | 110 void _inferStatement(KernelTypeInferrer inferrer); |
| 111 } | 111 } |
| 112 | 112 |
| 113 /// Concrete implementation of [TypeInferrer] specialized to work with kernel | 113 /// Concrete implementation of [TypeInferrer] specialized to work with kernel |
| 114 /// objects. | 114 /// objects. |
| 115 class KernelTypeInferrer extends TypeInferrer<Statement, Expression, | 115 class KernelTypeInferrer extends TypeInferrer<Statement, Expression, |
| 116 KernelVariableDeclaration, Field> { | 116 KernelVariableDeclaration, Field> { |
| 117 KernelTypeInferrer(CoreTypes coreTypes, ClassHierarchy classHierarchy, | 117 KernelTypeInferrer(CoreTypes coreTypes, ClassHierarchy classHierarchy, |
| 118 Instrumentation instrumentation) | 118 Instrumentation instrumentation, bool strongMode) |
| 119 : super(coreTypes, classHierarchy, instrumentation); | 119 : super(coreTypes, classHierarchy, instrumentation, strongMode); |
| 120 | 120 |
| 121 @override | 121 @override |
| 122 DartType inferExpression( | 122 DartType inferExpression( |
| 123 Expression expression, DartType typeContext, bool typeNeeded) { | 123 Expression expression, DartType typeContext, bool typeNeeded) { |
| 124 if (expression is KernelExpression) { | 124 if (expression is KernelExpression) { |
| 125 // Use polymorphic dispatch on [KernelExpression] to perform whatever kind | 125 // Use polymorphic dispatch on [KernelExpression] to perform whatever kind |
| 126 // of type inference is correct for this kind of statement. | 126 // of type inference is correct for this kind of statement. |
| 127 // TODO(paulberry): experiment to see if dynamic dispatch would be better, | 127 // TODO(paulberry): experiment to see if dynamic dispatch would be better, |
| 128 // so that the type hierarchy will be simpler (which may speed up "is" | 128 // so that the type hierarchy will be simpler (which may speed up "is" |
| 129 // checks). | 129 // checks). |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 KernelVariableGet(VariableDeclaration variable, [DartType promotedType]) | 186 KernelVariableGet(VariableDeclaration variable, [DartType promotedType]) |
| 187 : super(variable, promotedType); | 187 : super(variable, promotedType); |
| 188 | 188 |
| 189 @override | 189 @override |
| 190 DartType _inferExpression( | 190 DartType _inferExpression( |
| 191 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { | 191 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { |
| 192 // TODO(paulberry): implement. | 192 // TODO(paulberry): implement. |
| 193 return typeNeeded ? const DynamicType() : null; | 193 return typeNeeded ? const DynamicType() : null; |
| 194 } | 194 } |
| 195 } | 195 } |
| OLD | NEW |