| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 | 3 |
| 4 library engine.constant; | 4 library engine.constant; |
| 5 | 5 |
| 6 import 'java_core.dart'; | 6 import 'java_core.dart'; |
| 7 import 'source.dart' show Source; | 7 import 'source.dart' show Source; |
| 8 import 'error.dart' show AnalysisError, ErrorCode, CompileTimeErrorCode; | 8 import 'error.dart' show AnalysisError, ErrorCode, CompileTimeErrorCode; |
| 9 import 'scanner.dart' show TokenType; | 9 import 'scanner.dart' show TokenType; |
| 10 import 'ast.dart'; | 10 import 'ast.dart'; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 * compile-time constant that evaluates to the given value. | 98 * compile-time constant that evaluates to the given value. |
| 99 * | 99 * |
| 100 * @param value the value of the expression | 100 * @param value the value of the expression |
| 101 * @return the result of evaluating an expression that is a compile-time const
ant | 101 * @return the result of evaluating an expression that is a compile-time const
ant |
| 102 */ | 102 */ |
| 103 static EvaluationResult forValue(Object value) => new EvaluationResult(value,
null); | 103 static EvaluationResult forValue(Object value) => new EvaluationResult(value,
null); |
| 104 | 104 |
| 105 /** | 105 /** |
| 106 * The value of the expression. | 106 * The value of the expression. |
| 107 */ | 107 */ |
| 108 Object value; | 108 final Object value; |
| 109 | 109 |
| 110 /** | 110 /** |
| 111 * The errors that should be reported for the expression(s) that were evaluate
d. | 111 * The errors that should be reported for the expression(s) that were evaluate
d. |
| 112 */ | 112 */ |
| 113 List<AnalysisError> _errors; | 113 List<AnalysisError> _errors; |
| 114 | 114 |
| 115 /** | 115 /** |
| 116 * Initialize a newly created result object with the given state. Clients shou
ld use one of the | 116 * Initialize a newly created result object with the given state. Clients shou
ld use one of the |
| 117 * factory methods: [forErrors] and [forValue]. | 117 * factory methods: [forErrors] and [forValue]. |
| 118 * | 118 * |
| 119 * @param value the value of the expression | 119 * @param value the value of the expression |
| 120 * @param errors the errors that should be reported for the expression(s) that
were evaluated | 120 * @param errors the errors that should be reported for the expression(s) that
were evaluated |
| 121 */ | 121 */ |
| 122 EvaluationResult(Object value, List<AnalysisError> errors) { | 122 EvaluationResult(this.value, List<AnalysisError> errors) { |
| 123 this.value = value; | |
| 124 this._errors = errors; | 123 this._errors = errors; |
| 125 } | 124 } |
| 126 | 125 |
| 127 /** | 126 /** |
| 128 * Return an array containing the errors that should be reported for the expre
ssion(s) that were | 127 * Return an array containing the errors that should be reported for the expre
ssion(s) that were |
| 129 * evaluated. If there are no such errors, the array will be empty. The array
can be empty even if | 128 * evaluated. If there are no such errors, the array will be empty. The array
can be empty even if |
| 130 * the expression is not a valid compile time constant if the errors would hav
e been reported by | 129 * the expression is not a valid compile time constant if the errors would hav
e been reported by |
| 131 * other parts of the analysis engine. | 130 * other parts of the analysis engine. |
| 132 */ | 131 */ |
| 133 List<AnalysisError> get errors => _errors == null ? AnalysisError.NO_ERRORS :
_errors; | 132 List<AnalysisError> get errors => _errors == null ? AnalysisError.NO_ERRORS :
_errors; |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 } | 731 } |
| 733 | 732 |
| 734 /** | 733 /** |
| 735 * Instances of the class `ErrorResult` represent the result of evaluating an ex
pression that | 734 * Instances of the class `ErrorResult` represent the result of evaluating an ex
pression that |
| 736 * is not a valid compile time constant. | 735 * is not a valid compile time constant. |
| 737 */ | 736 */ |
| 738 class ErrorResult extends EvaluationResultImpl { | 737 class ErrorResult extends EvaluationResultImpl { |
| 739 /** | 738 /** |
| 740 * The errors that prevent the expression from being a valid compile time cons
tant. | 739 * The errors that prevent the expression from being a valid compile time cons
tant. |
| 741 */ | 740 */ |
| 742 final List<ErrorResult_ErrorData> errorData = new List<ErrorResult_ErrorData>(
); | 741 List<ErrorResult_ErrorData> _errors = new List<ErrorResult_ErrorData>(); |
| 743 | 742 |
| 744 /** | 743 /** |
| 745 * Initialize a newly created result representing the error with the given cod
e reported against | 744 * Initialize a newly created result representing the error with the given cod
e reported against |
| 746 * the given node. | 745 * the given node. |
| 747 * | 746 * |
| 748 * @param node the node against which the error should be reported | 747 * @param node the node against which the error should be reported |
| 749 * @param errorCode the error code for the error to be generated | 748 * @param errorCode the error code for the error to be generated |
| 750 */ | 749 */ |
| 751 ErrorResult.con1(ASTNode node, ErrorCode errorCode) { | 750 ErrorResult.con1(ASTNode node, ErrorCode errorCode) { |
| 752 errorData.add(new ErrorResult_ErrorData(node, errorCode)); | 751 _errors.add(new ErrorResult_ErrorData(node, errorCode)); |
| 753 } | 752 } |
| 754 | 753 |
| 755 /** | 754 /** |
| 756 * Initialize a newly created result to represent the union of the errors in t
he given result | 755 * Initialize a newly created result to represent the union of the errors in t
he given result |
| 757 * objects. | 756 * objects. |
| 758 * | 757 * |
| 759 * @param firstResult the first set of results being merged | 758 * @param firstResult the first set of results being merged |
| 760 * @param secondResult the second set of results being merged | 759 * @param secondResult the second set of results being merged |
| 761 */ | 760 */ |
| 762 ErrorResult.con2(ErrorResult firstResult, ErrorResult secondResult) { | 761 ErrorResult.con2(ErrorResult firstResult, ErrorResult secondResult) { |
| 763 errorData.addAll(firstResult.errorData); | 762 _errors.addAll(firstResult._errors); |
| 764 errorData.addAll(secondResult.errorData); | 763 _errors.addAll(secondResult._errors); |
| 765 } | 764 } |
| 766 | 765 |
| 767 EvaluationResultImpl add(BinaryExpression node, EvaluationResultImpl rightOper
and) => rightOperand.addToError(node, this); | 766 EvaluationResultImpl add(BinaryExpression node, EvaluationResultImpl rightOper
and) => rightOperand.addToError(node, this); |
| 768 | 767 |
| 769 EvaluationResultImpl applyBooleanConversion(ASTNode node) => this; | 768 EvaluationResultImpl applyBooleanConversion(ASTNode node) => this; |
| 770 | 769 |
| 771 EvaluationResultImpl bitAnd(BinaryExpression node, EvaluationResultImpl rightO
perand) => rightOperand.bitAndError(node, this); | 770 EvaluationResultImpl bitAnd(BinaryExpression node, EvaluationResultImpl rightO
perand) => rightOperand.bitAndError(node, this); |
| 772 | 771 |
| 773 EvaluationResultImpl bitNot(Expression node) => this; | 772 EvaluationResultImpl bitNot(Expression node) => this; |
| 774 | 773 |
| 775 EvaluationResultImpl bitOr(BinaryExpression node, EvaluationResultImpl rightOp
erand) => rightOperand.bitOrError(node, this); | 774 EvaluationResultImpl bitOr(BinaryExpression node, EvaluationResultImpl rightOp
erand) => rightOperand.bitOrError(node, this); |
| 776 | 775 |
| 777 EvaluationResultImpl bitXor(BinaryExpression node, EvaluationResultImpl rightO
perand) => rightOperand.bitXorError(node, this); | 776 EvaluationResultImpl bitXor(BinaryExpression node, EvaluationResultImpl rightO
perand) => rightOperand.bitXorError(node, this); |
| 778 | 777 |
| 779 EvaluationResultImpl concatenate(Expression node, EvaluationResultImpl rightOp
erand) => rightOperand.concatenateError(node, this); | 778 EvaluationResultImpl concatenate(Expression node, EvaluationResultImpl rightOp
erand) => rightOperand.concatenateError(node, this); |
| 780 | 779 |
| 781 EvaluationResultImpl divide(BinaryExpression node, EvaluationResultImpl rightO
perand) => rightOperand.divideError(node, this); | 780 EvaluationResultImpl divide(BinaryExpression node, EvaluationResultImpl rightO
perand) => rightOperand.divideError(node, this); |
| 782 | 781 |
| 783 EvaluationResultImpl equalEqual(Expression node, EvaluationResultImpl rightOpe
rand) => rightOperand.equalEqualError(node, this); | 782 EvaluationResultImpl equalEqual(Expression node, EvaluationResultImpl rightOpe
rand) => rightOperand.equalEqualError(node, this); |
| 784 | 783 |
| 785 bool equalValues(EvaluationResultImpl result) => false; | 784 bool equalValues(EvaluationResultImpl result) => false; |
| 786 | 785 |
| 786 List<ErrorResult_ErrorData> get errorData => _errors; |
| 787 |
| 787 EvaluationResultImpl greaterThan(BinaryExpression node, EvaluationResultImpl r
ightOperand) => rightOperand.greaterThanError(node, this); | 788 EvaluationResultImpl greaterThan(BinaryExpression node, EvaluationResultImpl r
ightOperand) => rightOperand.greaterThanError(node, this); |
| 788 | 789 |
| 789 EvaluationResultImpl greaterThanOrEqual(BinaryExpression node, EvaluationResul
tImpl rightOperand) => rightOperand.greaterThanOrEqualError(node, this); | 790 EvaluationResultImpl greaterThanOrEqual(BinaryExpression node, EvaluationResul
tImpl rightOperand) => rightOperand.greaterThanOrEqualError(node, this); |
| 790 | 791 |
| 791 EvaluationResultImpl integerDivide(BinaryExpression node, EvaluationResultImpl
rightOperand) => rightOperand.integerDivideError(node, this); | 792 EvaluationResultImpl integerDivide(BinaryExpression node, EvaluationResultImpl
rightOperand) => rightOperand.integerDivideError(node, this); |
| 792 | 793 |
| 793 EvaluationResultImpl integerDivideValid(BinaryExpression node, ValidResult lef
tOperand) => this; | 794 EvaluationResultImpl integerDivideValid(BinaryExpression node, ValidResult lef
tOperand) => this; |
| 794 | 795 |
| 795 EvaluationResultImpl lessThan(BinaryExpression node, EvaluationResultImpl righ
tOperand) => rightOperand.lessThanError(node, this); | 796 EvaluationResultImpl lessThan(BinaryExpression node, EvaluationResultImpl righ
tOperand) => rightOperand.lessThanError(node, this); |
| 796 | 797 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 | 895 |
| 895 EvaluationResultImpl timesError(BinaryExpression node, ErrorResult leftOperand
) => new ErrorResult.con2(this, leftOperand); | 896 EvaluationResultImpl timesError(BinaryExpression node, ErrorResult leftOperand
) => new ErrorResult.con2(this, leftOperand); |
| 896 | 897 |
| 897 EvaluationResultImpl timesValid(BinaryExpression node, ValidResult leftOperand
) => this; | 898 EvaluationResultImpl timesValid(BinaryExpression node, ValidResult leftOperand
) => this; |
| 898 } | 899 } |
| 899 | 900 |
| 900 class ErrorResult_ErrorData { | 901 class ErrorResult_ErrorData { |
| 901 /** | 902 /** |
| 902 * The node against which the error should be reported. | 903 * The node against which the error should be reported. |
| 903 */ | 904 */ |
| 904 ASTNode node; | 905 final ASTNode node; |
| 905 | 906 |
| 906 /** | 907 /** |
| 907 * The error code for the error to be generated. | 908 * The error code for the error to be generated. |
| 908 */ | 909 */ |
| 909 ErrorCode errorCode; | 910 final ErrorCode errorCode; |
| 910 | 911 |
| 911 /** | 912 /** |
| 912 * Initialize a newly created data holder to represent the error with the give
n code reported | 913 * Initialize a newly created data holder to represent the error with the give
n code reported |
| 913 * against the given node. | 914 * against the given node. |
| 914 * | 915 * |
| 915 * @param node the node against which the error should be reported | 916 * @param node the node against which the error should be reported |
| 916 * @param errorCode the error code for the error to be generated | 917 * @param errorCode the error code for the error to be generated |
| 917 */ | 918 */ |
| 918 ErrorResult_ErrorData(ASTNode node, ErrorCode errorCode) { | 919 ErrorResult_ErrorData(this.node, this.errorCode); |
| 919 this.node = node; | |
| 920 this.errorCode = errorCode; | |
| 921 } | |
| 922 } | 920 } |
| 923 | 921 |
| 924 /** | 922 /** |
| 925 * Instances of the class `InternalResult` represent the result of attempting to
evaluate a | 923 * Instances of the class `InternalResult` represent the result of attempting to
evaluate a |
| 926 * expression. | 924 * expression. |
| 927 */ | 925 */ |
| 928 abstract class EvaluationResultImpl { | 926 abstract class EvaluationResultImpl { |
| 929 EvaluationResultImpl add(BinaryExpression node, EvaluationResultImpl rightOper
and); | 927 EvaluationResultImpl add(BinaryExpression node, EvaluationResultImpl rightOper
and); |
| 930 | 928 |
| 931 /** | 929 /** |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1167 static ValidResult RESULT_STRING = new ValidResult("<string>"); | 1165 static ValidResult RESULT_STRING = new ValidResult("<string>"); |
| 1168 | 1166 |
| 1169 /** | 1167 /** |
| 1170 * A result object representing the value 'true'. | 1168 * A result object representing the value 'true'. |
| 1171 */ | 1169 */ |
| 1172 static ValidResult RESULT_TRUE = new ValidResult(true); | 1170 static ValidResult RESULT_TRUE = new ValidResult(true); |
| 1173 | 1171 |
| 1174 /** | 1172 /** |
| 1175 * The value of the expression. | 1173 * The value of the expression. |
| 1176 */ | 1174 */ |
| 1177 Object value; | 1175 final Object value; |
| 1178 | 1176 |
| 1179 /** | 1177 /** |
| 1180 * Initialize a newly created result to represent the given value. | 1178 * Initialize a newly created result to represent the given value. |
| 1181 * | 1179 * |
| 1182 * @param value the value of the expression | 1180 * @param value the value of the expression |
| 1183 */ | 1181 */ |
| 1184 ValidResult(Object value) { | 1182 ValidResult(this.value); |
| 1185 this.value = value; | |
| 1186 } | |
| 1187 | 1183 |
| 1188 EvaluationResultImpl add(BinaryExpression node, EvaluationResultImpl rightOper
and) => rightOperand.addToValid(node, this); | 1184 EvaluationResultImpl add(BinaryExpression node, EvaluationResultImpl rightOper
and) => rightOperand.addToValid(node, this); |
| 1189 | 1185 |
| 1190 /** | 1186 /** |
| 1191 * Return the result of applying boolean conversion to this result. | 1187 * Return the result of applying boolean conversion to this result. |
| 1192 * | 1188 * |
| 1193 * @param node the node against which errors should be reported | 1189 * @param node the node against which errors should be reported |
| 1194 * @return the result of applying boolean conversion to the given value | 1190 * @return the result of applying boolean conversion to the given value |
| 1195 */ | 1191 */ |
| 1196 EvaluationResultImpl applyBooleanConversion(ASTNode node) => booleanConversion
(node, value); | 1192 EvaluationResultImpl applyBooleanConversion(ASTNode node) => booleanConversion
(node, value); |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1969 ValidResult valueOf3(double value) => new ValidResult(value); | 1965 ValidResult valueOf3(double value) => new ValidResult(value); |
| 1970 | 1966 |
| 1971 /** | 1967 /** |
| 1972 * Return a result object representing the given value. | 1968 * Return a result object representing the given value. |
| 1973 * | 1969 * |
| 1974 * @param value the value to be represented as a result object | 1970 * @param value the value to be represented as a result object |
| 1975 * @return a result object representing the given value | 1971 * @return a result object representing the given value |
| 1976 */ | 1972 */ |
| 1977 ValidResult valueOf4(String value) => new ValidResult(value); | 1973 ValidResult valueOf4(String value) => new ValidResult(value); |
| 1978 } | 1974 } |
| OLD | NEW |