| 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 using mixins from `builder/shadow_ast.dart`. | 6 /// the kernel class hierarchy using mixins from `builder/shadow_ast.dart`. |
| 7 /// | 7 /// |
| 8 /// Instances of these classes may be created using the factory methods in | 8 /// Instances of these classes may be created using the factory methods in |
| 9 /// `ast_factory.dart`. | 9 /// `ast_factory.dart`. |
| 10 /// | 10 /// |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 /// inference. Alternative: create a subclass of DynamicType which represents | 140 /// inference. Alternative: create a subclass of DynamicType which represents |
| 141 /// implicit dynamic ("MissingType" or "ImplicitDynamicType" perhaps). | 141 /// implicit dynamic ("MissingType" or "ImplicitDynamicType" perhaps). |
| 142 DartType _declaredType; | 142 DartType _declaredType; |
| 143 | 143 |
| 144 KernelVariableDeclaration(String name, | 144 KernelVariableDeclaration(String name, |
| 145 {KernelExpression initializer, | 145 {KernelExpression initializer, |
| 146 DartType type, | 146 DartType type, |
| 147 bool isFinal: false, | 147 bool isFinal: false, |
| 148 bool isConst: false}) | 148 bool isConst: false}) |
| 149 : _declaredType = type, | 149 : _declaredType = type, |
| 150 super(name, initializer, type ?? const kernel.DynamicType(), null, | 150 super(name, initializer, type ?? const kernel.DynamicType(), isFinal, |
| 151 isFinal, isConst); | 151 isConst); |
| 152 | 152 |
| 153 @override | 153 @override |
| 154 KernelExpression get shadowInitializer => initializer; | 154 KernelExpression get shadowInitializer => initializer; |
| 155 | 155 |
| 156 @override | 156 @override |
| 157 DartType get shadowType => _declaredType; | 157 DartType get shadowType => _declaredType; |
| 158 | 158 |
| 159 @override | 159 @override |
| 160 set shadowType(kernel.DartType type) { | 160 set shadowType(kernel.DartType type) { |
| 161 this.type = type; | 161 this.type = type; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 _KernelReturnStatement(KernelExpression expression) : super(expression); | 199 _KernelReturnStatement(KernelExpression expression) : super(expression); |
| 200 } | 200 } |
| 201 | 201 |
| 202 /// Adaptor class allowing [kernel.VariableDeclaration] to be extended with a | 202 /// Adaptor class allowing [kernel.VariableDeclaration] to be extended with a |
| 203 /// mixin. | 203 /// mixin. |
| 204 /// | 204 /// |
| 205 /// TODO(paulberry): see if we can eliminate the need for this class by adding | 205 /// TODO(paulberry): see if we can eliminate the need for this class by adding |
| 206 /// a named constructor to [kernel.VariableDeclaration] in which all arguments | 206 /// a named constructor to [kernel.VariableDeclaration] in which all arguments |
| 207 /// are required. | 207 /// are required. |
| 208 class _KernelVariableDeclaration extends kernel.VariableDeclaration { | 208 class _KernelVariableDeclaration extends kernel.VariableDeclaration { |
| 209 _KernelVariableDeclaration( | 209 _KernelVariableDeclaration(String name, kernel.Expression initializer, |
| 210 String name, | 210 DartType type, bool isFinal, bool isConst) |
| 211 kernel.Expression initializer, | |
| 212 DartType type, | |
| 213 kernel.InferredValue inferredValue, | |
| 214 bool isFinal, | |
| 215 bool isConst) | |
| 216 : super(name, | 211 : super(name, |
| 217 initializer: initializer, | 212 initializer: initializer, |
| 218 type: type, | 213 type: type, |
| 219 inferredValue: inferredValue, | |
| 220 isFinal: isFinal, | 214 isFinal: isFinal, |
| 221 isConst: isConst); | 215 isConst: isConst); |
| 222 } | 216 } |
| 223 | 217 |
| 224 /// Adaptor class allowing [kernel.VariableGet] to be extended with a mixin. | 218 /// Adaptor class allowing [kernel.VariableGet] to be extended with a mixin. |
| 225 /// | 219 /// |
| 226 /// TODO(paulberry): see if we can eliminate the need for this class by adding | 220 /// TODO(paulberry): see if we can eliminate the need for this class by adding |
| 227 /// a named constructor to [kernel.VariableGet] in which all arguments are | 221 /// a named constructor to [kernel.VariableGet] in which all arguments are |
| 228 /// required. | 222 /// required. |
| 229 class _KernelVariableGet extends kernel.VariableGet { | 223 class _KernelVariableGet extends kernel.VariableGet { |
| 230 _KernelVariableGet(kernel.VariableDeclaration variable, DartType promotedType) | 224 _KernelVariableGet(kernel.VariableDeclaration variable, DartType promotedType) |
| 231 : super(variable, promotedType); | 225 : super(variable, promotedType); |
| 232 } | 226 } |
| OLD | NEW |