OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library inferrer_visitor; | 5 library inferrer_visitor; |
6 | 6 |
7 import '../dart2jslib.dart' hide Selector, TypedSelector; | 7 import '../dart2jslib.dart' hide Selector, TypedSelector; |
8 import '../dart_types.dart'; | 8 import '../dart_types.dart'; |
9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
10 import '../tree/tree.dart'; | 10 import '../tree/tree.dart'; |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 LocalsHandler<T> saved = locals; | 851 LocalsHandler<T> saved = locals; |
852 locals = new LocalsHandler<T>.from(locals, node); | 852 locals = new LocalsHandler<T>.from(locals, node); |
853 updateIsChecks(isChecks, usePositive: true); | 853 updateIsChecks(isChecks, usePositive: true); |
854 visit(node.arguments.head); | 854 visit(node.arguments.head); |
855 saved.mergeDiamondFlow(locals, null); | 855 saved.mergeDiamondFlow(locals, null); |
856 locals = saved; | 856 locals = saved; |
857 return types.boolType; | 857 return types.boolType; |
858 } else if ("||" == op.source) { | 858 } else if ("||" == op.source) { |
859 conditionIsSimple = false; | 859 conditionIsSimple = false; |
860 List<Send> tests = <Send>[]; | 860 List<Send> tests = <Send>[]; |
861 handleCondition(node.receiver, tests); | 861 bool isSimple = handleCondition(node.receiver, tests); |
862 LocalsHandler<T> saved = locals; | 862 LocalsHandler<T> saved = locals; |
863 locals = new LocalsHandler<T>.from(locals, node); | 863 locals = new LocalsHandler<T>.from(locals, node); |
864 updateIsChecks(tests, usePositive: false); | 864 if (isSimple) updateIsChecks(tests, usePositive: false); |
865 bool oldAccumulateIsChecks = accumulateIsChecks; | 865 bool oldAccumulateIsChecks = accumulateIsChecks; |
866 accumulateIsChecks = false; | 866 accumulateIsChecks = false; |
867 isChecks = null; | 867 isChecks = null; |
868 visit(node.arguments.head); | 868 visit(node.arguments.head); |
869 accumulateIsChecks = oldAccumulateIsChecks; | 869 accumulateIsChecks = oldAccumulateIsChecks; |
870 saved.mergeDiamondFlow(locals, null); | 870 saved.mergeDiamondFlow(locals, null); |
871 locals = saved; | 871 locals = saved; |
872 return types.boolType; | 872 return types.boolType; |
873 } else if ("!" == op.source) { | 873 } else if ("!" == op.source) { |
874 bool oldAccumulateIsChecks = accumulateIsChecks; | 874 bool oldAccumulateIsChecks = accumulateIsChecks; |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 return type; | 1208 return type; |
1209 } | 1209 } |
1210 | 1210 |
1211 T visitCascade(Cascade node) { | 1211 T visitCascade(Cascade node) { |
1212 // Ignore the result of the cascade send and return the type of the cascade | 1212 // Ignore the result of the cascade send and return the type of the cascade |
1213 // receiver. | 1213 // receiver. |
1214 visit(node.expression); | 1214 visit(node.expression); |
1215 return cascadeReceiverStack.removeLast(); | 1215 return cascadeReceiverStack.removeLast(); |
1216 } | 1216 } |
1217 } | 1217 } |
OLD | NEW |