| 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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 variable.fileOffset, | 702 variable.fileOffset, |
| 703 'type', | 703 'type', |
| 704 new InstrumentationValueForType(inferredType)); | 704 new InstrumentationValueForType(inferredType)); |
| 705 variable.type = inferredType; | 705 variable.type = inferredType; |
| 706 } | 706 } |
| 707 inferrer.inferStatement(body); | 707 inferrer.inferStatement(body); |
| 708 inferrer.listener.forInStatementExit(this); | 708 inferrer.listener.forInStatementExit(this); |
| 709 } | 709 } |
| 710 } | 710 } |
| 711 | 711 |
| 712 /// Concrete shadow object representing a classic for loop in kernel form. |
| 713 class KernelForStatement extends ForStatement implements KernelStatement { |
| 714 KernelForStatement(List<VariableDeclaration> variables, Expression condition, |
| 715 List<Expression> updates, Statement body) |
| 716 : super(variables, condition, updates, body); |
| 717 |
| 718 @override |
| 719 void _inferStatement(KernelTypeInferrer inferrer) { |
| 720 inferrer.listener.forStatementEnter(this); |
| 721 variables.forEach(inferrer.inferStatement); |
| 722 inferrer.inferExpression( |
| 723 condition, inferrer.coreTypes.boolClass.rawType, false); |
| 724 for (var update in updates) { |
| 725 inferrer.inferExpression(update, null, false); |
| 726 } |
| 727 inferrer.inferStatement(body); |
| 728 inferrer.listener.forStatementExit(this); |
| 729 } |
| 730 } |
| 731 |
| 712 /// Concrete shadow object representing a local function declaration in kernel | 732 /// Concrete shadow object representing a local function declaration in kernel |
| 713 /// form. | 733 /// form. |
| 714 class KernelFunctionDeclaration extends FunctionDeclaration | 734 class KernelFunctionDeclaration extends FunctionDeclaration |
| 715 implements KernelStatement { | 735 implements KernelStatement { |
| 716 bool _hasImplicitReturnType = false; | 736 bool _hasImplicitReturnType = false; |
| 717 | 737 |
| 718 KernelFunctionDeclaration(VariableDeclaration variable, FunctionNode function) | 738 KernelFunctionDeclaration(VariableDeclaration variable, FunctionNode function) |
| 719 : super(variable, function); | 739 : super(variable, function); |
| 720 | 740 |
| 721 @override | 741 @override |
| (...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2216 } | 2236 } |
| 2217 | 2237 |
| 2218 transformChildren(v) { | 2238 transformChildren(v) { |
| 2219 return internalError("Internal error: Unsupported operation."); | 2239 return internalError("Internal error: Unsupported operation."); |
| 2220 } | 2240 } |
| 2221 | 2241 |
| 2222 visitChildren(v) { | 2242 visitChildren(v) { |
| 2223 return internalError("Internal error: Unsupported operation."); | 2243 return internalError("Internal error: Unsupported operation."); |
| 2224 } | 2244 } |
| 2225 } | 2245 } |
| OLD | NEW |