| 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 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 final TypePromotionFact<VariableDeclaration> _fact; | 857 final TypePromotionFact<VariableDeclaration> _fact; |
| 858 | 858 |
| 859 final TypePromotionScope _scope; | 859 final TypePromotionScope _scope; |
| 860 | 860 |
| 861 KernelVariableGet(VariableDeclaration variable, this._fact, this._scope) | 861 KernelVariableGet(VariableDeclaration variable, this._fact, this._scope) |
| 862 : super(variable); | 862 : super(variable); |
| 863 | 863 |
| 864 @override | 864 @override |
| 865 DartType _inferExpression( | 865 DartType _inferExpression( |
| 866 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { | 866 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { |
| 867 bool mutatedInClosure; | 867 var variable = this.variable as KernelVariableDeclaration; |
| 868 DartType declaredType; | 868 bool mutatedInClosure = variable._mutatedInClosure; |
| 869 var variable = this.variable; | 869 DartType declaredType = variable._declaredType; |
| 870 if (variable is KernelVariableDeclaration) { | |
| 871 mutatedInClosure = variable._mutatedInClosure; | |
| 872 declaredType = variable._declaredType; | |
| 873 } else { | |
| 874 // Hack to deal with the fact that BodyBuilder still creates raw | |
| 875 // VariableDeclaration objects sometimes. | |
| 876 // TODO(paulberry): get rid of this once the type parameter is | |
| 877 // KernelVariableDeclaration. | |
| 878 mutatedInClosure = true; | |
| 879 declaredType = variable.type; | |
| 880 } | |
| 881 return inferrer.inferVariableGet(typeContext, typeNeeded, mutatedInClosure, | 870 return inferrer.inferVariableGet(typeContext, typeNeeded, mutatedInClosure, |
| 882 _fact, _scope, fileOffset, declaredType, (type) { | 871 _fact, _scope, fileOffset, declaredType, (type) { |
| 883 promotedType = type; | 872 promotedType = type; |
| 884 }); | 873 }); |
| 885 } | 874 } |
| 886 } | 875 } |
| OLD | NEW |