Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.constant; | 8 library engine.constant; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 2764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2775 | 2775 |
| 2776 @override | 2776 @override |
| 2777 NumState divide(InstanceState rightOperand) { | 2777 NumState divide(InstanceState rightOperand) { |
| 2778 assertNumOrNull(rightOperand); | 2778 assertNumOrNull(rightOperand); |
| 2779 if (value == null) { | 2779 if (value == null) { |
| 2780 return UNKNOWN_VALUE; | 2780 return UNKNOWN_VALUE; |
| 2781 } | 2781 } |
| 2782 if (rightOperand is IntState) { | 2782 if (rightOperand is IntState) { |
| 2783 int rightValue = rightOperand.value; | 2783 int rightValue = rightOperand.value; |
| 2784 if (rightValue == null) { | 2784 if (rightValue == null) { |
| 2785 return UNKNOWN_VALUE; | 2785 return UNKNOWN_VALUE; |
|
danrubel
2015/03/23 16:48:48
DoubleState.UNKNOWN_VALUE ?
Paul Berry
2015/03/23 19:30:18
This code is in the DoubleState class so it would
| |
| 2786 } | 2786 } |
| 2787 return new DoubleState(value / rightValue.toDouble()); | 2787 return new DoubleState(value / rightValue.toDouble()); |
| 2788 } else if (rightOperand is DoubleState) { | 2788 } else if (rightOperand is DoubleState) { |
| 2789 double rightValue = rightOperand.value; | 2789 double rightValue = rightOperand.value; |
| 2790 if (rightValue == null) { | 2790 if (rightValue == null) { |
| 2791 return UNKNOWN_VALUE; | 2791 return UNKNOWN_VALUE; |
| 2792 } | 2792 } |
| 2793 return new DoubleState(value / rightValue); | 2793 return new DoubleState(value / rightValue); |
| 2794 } else if (rightOperand is DynamicState || rightOperand is NumState) { | 2794 } else if (rightOperand is DynamicState || rightOperand is NumState) { |
| 2795 return UNKNOWN_VALUE; | 2795 return UNKNOWN_VALUE; |
| (...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4042 if (value == null) { | 4042 if (value == null) { |
| 4043 return StringState.UNKNOWN_VALUE; | 4043 return StringState.UNKNOWN_VALUE; |
| 4044 } | 4044 } |
| 4045 return new StringState(value.toString()); | 4045 return new StringState(value.toString()); |
| 4046 } | 4046 } |
| 4047 | 4047 |
| 4048 @override | 4048 @override |
| 4049 NumState divide(InstanceState rightOperand) { | 4049 NumState divide(InstanceState rightOperand) { |
| 4050 assertNumOrNull(rightOperand); | 4050 assertNumOrNull(rightOperand); |
| 4051 if (value == null) { | 4051 if (value == null) { |
| 4052 if (rightOperand is DoubleState) { | 4052 return DoubleState.UNKNOWN_VALUE; |
| 4053 return DoubleState.UNKNOWN_VALUE; | |
| 4054 } | |
| 4055 return UNKNOWN_VALUE; | |
| 4056 } | 4053 } |
| 4057 if (rightOperand is IntState) { | 4054 if (rightOperand is IntState) { |
| 4058 int rightValue = rightOperand.value; | 4055 int rightValue = rightOperand.value; |
| 4059 if (rightValue == null) { | 4056 if (rightValue == null) { |
| 4060 return UNKNOWN_VALUE; | 4057 return DoubleState.UNKNOWN_VALUE; |
| 4061 } else if (rightValue == 0) { | 4058 } else { |
| 4062 return new DoubleState(value.toDouble() / rightValue.toDouble()); | 4059 return new DoubleState(value.toDouble() / rightValue.toDouble()); |
| 4063 } | 4060 } |
| 4064 return new IntState(value ~/ rightValue); | |
| 4065 } else if (rightOperand is DoubleState) { | 4061 } else if (rightOperand is DoubleState) { |
| 4066 double rightValue = rightOperand.value; | 4062 double rightValue = rightOperand.value; |
| 4067 if (rightValue == null) { | 4063 if (rightValue == null) { |
| 4068 return DoubleState.UNKNOWN_VALUE; | 4064 return DoubleState.UNKNOWN_VALUE; |
| 4069 } | 4065 } |
| 4070 return new DoubleState(value.toDouble() / rightValue); | 4066 return new DoubleState(value.toDouble() / rightValue); |
| 4071 } else if (rightOperand is DynamicState || rightOperand is NumState) { | 4067 } else if (rightOperand is DynamicState || rightOperand is NumState) { |
| 4072 return UNKNOWN_VALUE; | 4068 return DoubleState.UNKNOWN_VALUE; |
| 4073 } | 4069 } |
| 4074 throw new EvaluationException( | 4070 throw new EvaluationException( |
| 4075 CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION); | 4071 CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION); |
| 4076 } | 4072 } |
| 4077 | 4073 |
| 4078 @override | 4074 @override |
| 4079 BoolState equalEqual(InstanceState rightOperand) { | 4075 BoolState equalEqual(InstanceState rightOperand) { |
| 4080 assertBoolNumStringOrNull(rightOperand); | 4076 assertBoolNumStringOrNull(rightOperand); |
| 4081 return isIdentical(rightOperand); | 4077 return isIdentical(rightOperand); |
| 4082 } | 4078 } |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4677 assertNumOrNull(rightOperand); | 4673 assertNumOrNull(rightOperand); |
| 4678 return UNKNOWN_VALUE; | 4674 return UNKNOWN_VALUE; |
| 4679 } | 4675 } |
| 4680 | 4676 |
| 4681 @override | 4677 @override |
| 4682 StringState convertToString() => StringState.UNKNOWN_VALUE; | 4678 StringState convertToString() => StringState.UNKNOWN_VALUE; |
| 4683 | 4679 |
| 4684 @override | 4680 @override |
| 4685 NumState divide(InstanceState rightOperand) { | 4681 NumState divide(InstanceState rightOperand) { |
| 4686 assertNumOrNull(rightOperand); | 4682 assertNumOrNull(rightOperand); |
| 4687 return UNKNOWN_VALUE; | 4683 return DoubleState.UNKNOWN_VALUE; |
| 4688 } | 4684 } |
| 4689 | 4685 |
| 4690 @override | 4686 @override |
| 4691 BoolState equalEqual(InstanceState rightOperand) { | 4687 BoolState equalEqual(InstanceState rightOperand) { |
| 4692 assertBoolNumStringOrNull(rightOperand); | 4688 assertBoolNumStringOrNull(rightOperand); |
| 4693 return BoolState.UNKNOWN_VALUE; | 4689 return BoolState.UNKNOWN_VALUE; |
| 4694 } | 4690 } |
| 4695 | 4691 |
| 4696 @override | 4692 @override |
| 4697 BoolState greaterThan(InstanceState rightOperand) { | 4693 BoolState greaterThan(InstanceState rightOperand) { |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5077 return BoolState.from(_element == rightElement); | 5073 return BoolState.from(_element == rightElement); |
| 5078 } else if (rightOperand is DynamicState) { | 5074 } else if (rightOperand is DynamicState) { |
| 5079 return BoolState.UNKNOWN_VALUE; | 5075 return BoolState.UNKNOWN_VALUE; |
| 5080 } | 5076 } |
| 5081 return BoolState.FALSE_STATE; | 5077 return BoolState.FALSE_STATE; |
| 5082 } | 5078 } |
| 5083 | 5079 |
| 5084 @override | 5080 @override |
| 5085 String toString() => _element == null ? "-unknown-" : _element.name; | 5081 String toString() => _element == null ? "-unknown-" : _element.name; |
| 5086 } | 5082 } |
| OLD | NEW |