Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(459)

Side by Side Diff: pkg/analyzer_experimental/lib/src/generated/constant.dart

Issue 29313003: Don't evaluate << because of possible overflow. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 library engine.constant; 3 library engine.constant;
4 import 'java_core.dart'; 4 import 'java_core.dart';
5 import 'source.dart' show Source; 5 import 'source.dart' show Source;
6 import 'error.dart' show AnalysisError, ErrorCode, CompileTimeErrorCode; 6 import 'error.dart' show AnalysisError, ErrorCode, CompileTimeErrorCode;
7 import 'scanner.dart' show TokenType; 7 import 'scanner.dart' show TokenType;
8 import 'ast.dart'; 8 import 'ast.dart';
9 import 'element.dart'; 9 import 'element.dart';
10 import 'engine.dart' show AnalysisEngine; 10 import 'engine.dart' show AnalysisEngine;
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 /** 963 /**
964 * A result object representing the an object without specific type on which n o further operations 964 * A result object representing the an object without specific type on which n o further operations
965 * can be performed. 965 * can be performed.
966 */ 966 */
967 static ValidResult RESULT_DYNAMIC = new ValidResult(null); 967 static ValidResult RESULT_DYNAMIC = new ValidResult(null);
968 968
969 /** 969 /**
970 * A result object representing the an arbitrary integer on which no further o perations can be 970 * A result object representing the an arbitrary integer on which no further o perations can be
971 * performed. 971 * performed.
972 */ 972 */
973 static ValidResult RESULT_INT = new ValidResult(null); 973 static ValidResult RESULT_INT = new ValidResult(0);
974 974
975 /** 975 /**
976 * A result object representing the `null` value. 976 * A result object representing the `null` value.
977 */ 977 */
978 static ValidResult RESULT_NULL = new ValidResult(null); 978 static ValidResult RESULT_NULL = new ValidResult(null);
979 979
980 /** 980 /**
981 * A result object representing the an arbitrary numeric on which no further o perations can be 981 * A result object representing the an arbitrary numeric on which no further o perations can be
982 * performed. 982 * performed.
983 */ 983 */
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 if (value == null) { 1089 if (value == null) {
1090 return valueOf4("null"); 1090 return valueOf4("null");
1091 } else if (value is bool) { 1091 } else if (value is bool) {
1092 return valueOf4(((value as bool)).toString()); 1092 return valueOf4(((value as bool)).toString());
1093 } else if (value is int) { 1093 } else if (value is int) {
1094 return valueOf4(((value as int)).toString()); 1094 return valueOf4(((value as int)).toString());
1095 } else if (value is double) { 1095 } else if (value is double) {
1096 return valueOf4(((value as double)).toString()); 1096 return valueOf4(((value as double)).toString());
1097 } else if (value is String) { 1097 } else if (value is String) {
1098 return this; 1098 return this;
1099 } else if (isSomeBool) {
1100 return valueOf4("<some bool>");
1101 } else if (isSomeInt) {
1102 return valueOf4("<some int>");
1103 } else if (isSomeNum) {
1104 return valueOf4("<some num>");
1099 } 1105 }
1100 return error(node); 1106 return error(node);
1101 } 1107 }
1102 EvaluationResultImpl remainder(BinaryExpression node, EvaluationResultImpl rig htOperand) => rightOperand.remainderValid(node, this); 1108 EvaluationResultImpl remainder(BinaryExpression node, EvaluationResultImpl rig htOperand) => rightOperand.remainderValid(node, this);
1103 EvaluationResultImpl shiftLeft(BinaryExpression node, EvaluationResultImpl rig htOperand) => rightOperand.shiftLeftValid(node, this); 1109 EvaluationResultImpl shiftLeft(BinaryExpression node, EvaluationResultImpl rig htOperand) => rightOperand.shiftLeftValid(node, this);
1104 EvaluationResultImpl shiftRight(BinaryExpression node, EvaluationResultImpl ri ghtOperand) => rightOperand.shiftRightValid(node, this); 1110 EvaluationResultImpl shiftRight(BinaryExpression node, EvaluationResultImpl ri ghtOperand) => rightOperand.shiftRightValid(node, this);
1105 EvaluationResultImpl times(BinaryExpression node, EvaluationResultImpl rightOp erand) => rightOperand.timesValid(node, this); 1111 EvaluationResultImpl times(BinaryExpression node, EvaluationResultImpl rightOp erand) => rightOperand.timesValid(node, this);
1106 String toString() { 1112 String toString() {
1107 if (value == null) { 1113 if (value == null) {
1108 return "null"; 1114 return "null";
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 if (isSomeInt || leftOperand.isSomeInt) { 1580 if (isSomeInt || leftOperand.isSomeInt) {
1575 return RESULT_INT; 1581 return RESULT_INT;
1576 } 1582 }
1577 Object leftValue = leftOperand.value; 1583 Object leftValue = leftOperand.value;
1578 if (leftValue == null) { 1584 if (leftValue == null) {
1579 return error(node.leftOperand); 1585 return error(node.leftOperand);
1580 } else if (value == null) { 1586 } else if (value == null) {
1581 return error(node.rightOperand); 1587 return error(node.rightOperand);
1582 } else if (leftValue is int) { 1588 } else if (leftValue is int) {
1583 if (value is int) { 1589 if (value is int) {
1584 return valueOf(((leftValue as int)) << ((value as int))); 1590 return RESULT_INT;
1585 } 1591 }
1586 return error(node.rightOperand); 1592 return error(node.rightOperand);
1587 } 1593 }
1588 if (value is int) { 1594 if (value is int) {
1589 return error(node.leftOperand); 1595 return error(node.leftOperand);
1590 } 1596 }
1591 return union(error(node.leftOperand), error(node.rightOperand)); 1597 return union(error(node.leftOperand), error(node.rightOperand));
1592 } 1598 }
1593 EvaluationResultImpl shiftRightError(BinaryExpression node, ErrorResult leftOp erand) => leftOperand; 1599 EvaluationResultImpl shiftRightError(BinaryExpression node, ErrorResult leftOp erand) => leftOperand;
1594 EvaluationResultImpl shiftRightValid(BinaryExpression node, ValidResult leftOp erand) { 1600 EvaluationResultImpl shiftRightValid(BinaryExpression node, ValidResult leftOp erand) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1744 ValidResult valueOf3(double value) => new ValidResult(value); 1750 ValidResult valueOf3(double value) => new ValidResult(value);
1745 1751
1746 /** 1752 /**
1747 * Return a result object representing the given value. 1753 * Return a result object representing the given value.
1748 * 1754 *
1749 * @param value the value to be represented as a result object 1755 * @param value the value to be represented as a result object
1750 * @return a result object representing the given value 1756 * @return a result object representing the given value
1751 */ 1757 */
1752 ValidResult valueOf4(String value) => new ValidResult(value); 1758 ValidResult valueOf4(String value) => new ValidResult(value);
1753 } 1759 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698