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 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 /// Concrete shadow object representing a classic for loop in kernel form. | 752 /// Concrete shadow object representing a classic for loop in kernel form. |
753 class KernelForStatement extends ForStatement implements KernelStatement { | 753 class KernelForStatement extends ForStatement implements KernelStatement { |
754 KernelForStatement(List<VariableDeclaration> variables, Expression condition, | 754 KernelForStatement(List<VariableDeclaration> variables, Expression condition, |
755 List<Expression> updates, Statement body) | 755 List<Expression> updates, Statement body) |
756 : super(variables, condition, updates, body); | 756 : super(variables, condition, updates, body); |
757 | 757 |
758 @override | 758 @override |
759 void _inferStatement(KernelTypeInferrer inferrer) { | 759 void _inferStatement(KernelTypeInferrer inferrer) { |
760 inferrer.listener.forStatementEnter(this); | 760 inferrer.listener.forStatementEnter(this); |
761 variables.forEach(inferrer.inferStatement); | 761 variables.forEach(inferrer.inferStatement); |
762 inferrer.inferExpression( | 762 if (condition != null) { |
763 condition, inferrer.coreTypes.boolClass.rawType, false); | 763 inferrer.inferExpression( |
| 764 condition, inferrer.coreTypes.boolClass.rawType, false); |
| 765 } |
764 for (var update in updates) { | 766 for (var update in updates) { |
765 inferrer.inferExpression(update, null, false); | 767 inferrer.inferExpression(update, null, false); |
766 } | 768 } |
767 inferrer.inferStatement(body); | 769 inferrer.inferStatement(body); |
768 inferrer.listener.forStatementExit(this); | 770 inferrer.listener.forStatementExit(this); |
769 } | 771 } |
770 } | 772 } |
771 | 773 |
772 /// Concrete shadow object representing a local function declaration in kernel | 774 /// Concrete shadow object representing a local function declaration in kernel |
773 /// form. | 775 /// form. |
(...skipping 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2417 } | 2419 } |
2418 | 2420 |
2419 transformChildren(v) { | 2421 transformChildren(v) { |
2420 return internalError("Internal error: Unsupported operation."); | 2422 return internalError("Internal error: Unsupported operation."); |
2421 } | 2423 } |
2422 | 2424 |
2423 visitChildren(v) { | 2425 visitChildren(v) { |
2424 return internalError("Internal error: Unsupported operation."); | 2426 return internalError("Internal error: Unsupported operation."); |
2425 } | 2427 } |
2426 } | 2428 } |
OLD | NEW |