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

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

Issue 689173004: Properly implement identical() test in analyzer constant evaluation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/all_the_rest.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 StringState convertToString() { 67 StringState convertToString() {
68 if (value == null) { 68 if (value == null) {
69 return StringState.UNKNOWN_VALUE; 69 return StringState.UNKNOWN_VALUE;
70 } 70 }
71 return new StringState(value ? "true" : "false"); 71 return new StringState(value ? "true" : "false");
72 } 72 }
73 73
74 @override 74 @override
75 BoolState equalEqual(InstanceState rightOperand) { 75 BoolState equalEqual(InstanceState rightOperand) {
76 assertBoolNumStringOrNull(rightOperand); 76 assertBoolNumStringOrNull(rightOperand);
77 return isIdentical(rightOperand);
78 }
79
80 @override
81 BoolState isIdentical(InstanceState rightOperand) {
77 if (value == null) { 82 if (value == null) {
78 return UNKNOWN_VALUE; 83 return UNKNOWN_VALUE;
79 } 84 }
80 if (rightOperand is BoolState) { 85 if (rightOperand is BoolState) {
81 bool rightValue = rightOperand.value; 86 bool rightValue = rightOperand.value;
82 if (rightValue == null) { 87 if (rightValue == null) {
83 return UNKNOWN_VALUE; 88 return UNKNOWN_VALUE;
84 } 89 }
85 return BoolState.from(identical(value, rightValue)); 90 return BoolState.from(identical(value, rightValue));
86 } else if (rightOperand is DynamicState) { 91 } else if (rightOperand is DynamicState) {
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 FunctionElement function = element; 1251 FunctionElement function = element;
1247 if (function.name == "identical") { 1252 if (function.name == "identical") {
1248 NodeList<Expression> arguments = node.argumentList.arguments; 1253 NodeList<Expression> arguments = node.argumentList.arguments;
1249 if (arguments.length == 2) { 1254 if (arguments.length == 2) {
1250 Element enclosingElement = function.enclosingElement; 1255 Element enclosingElement = function.enclosingElement;
1251 if (enclosingElement is CompilationUnitElement) { 1256 if (enclosingElement is CompilationUnitElement) {
1252 LibraryElement library = enclosingElement.library; 1257 LibraryElement library = enclosingElement.library;
1253 if (library.isDartCore) { 1258 if (library.isDartCore) {
1254 DartObjectImpl leftArgument = arguments[0].accept(this); 1259 DartObjectImpl leftArgument = arguments[0].accept(this);
1255 DartObjectImpl rightArgument = arguments[1].accept(this); 1260 DartObjectImpl rightArgument = arguments[1].accept(this);
1256 return _dartObjectComputer.equalEqual(node, leftArgument, rightArg ument); 1261 return _dartObjectComputer.isIdentical(node, leftArgument,
1262 rightArgument);
1257 } 1263 }
1258 } 1264 }
1259 } 1265 }
1260 } 1266 }
1261 } 1267 }
1262 // TODO(brianwilkerson) Figure out which error to report. 1268 // TODO(brianwilkerson) Figure out which error to report.
1263 _error(node, null); 1269 _error(node, null);
1264 return null; 1270 return null;
1265 } 1271 }
1266 1272
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 if (leftOperand != null && rightOperand != null) { 1726 if (leftOperand != null && rightOperand != null) {
1721 try { 1727 try {
1722 return leftOperand.integerDivide(_typeProvider, rightOperand); 1728 return leftOperand.integerDivide(_typeProvider, rightOperand);
1723 } on EvaluationException catch (exception) { 1729 } on EvaluationException catch (exception) {
1724 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1730 _errorReporter.reportErrorForNode(exception.errorCode, node, []);
1725 } 1731 }
1726 } 1732 }
1727 return null; 1733 return null;
1728 } 1734 }
1729 1735
1736 DartObjectImpl isIdentical(Expression node, DartObjectImpl leftOperand,
1737 DartObjectImpl rightOperand) {
1738 if (leftOperand != null && rightOperand != null) {
1739 try {
1740 return leftOperand.isIdentical(_typeProvider, rightOperand);
1741 } on EvaluationException catch (exception) {
1742 _errorReporter.reportErrorForNode(exception.errorCode, node, []);
1743 }
1744 }
1745 return null;
1746 }
1747
1730 DartObjectImpl lessThan(BinaryExpression node, DartObjectImpl leftOperand, Dar tObjectImpl rightOperand) { 1748 DartObjectImpl lessThan(BinaryExpression node, DartObjectImpl leftOperand, Dar tObjectImpl rightOperand) {
1731 if (leftOperand != null && rightOperand != null) { 1749 if (leftOperand != null && rightOperand != null) {
1732 try { 1750 try {
1733 return leftOperand.lessThan(_typeProvider, rightOperand); 1751 return leftOperand.lessThan(_typeProvider, rightOperand);
1734 } on EvaluationException catch (exception) { 1752 } on EvaluationException catch (exception) {
1735 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1753 _errorReporter.reportErrorForNode(exception.errorCode, node, []);
1736 } 1754 }
1737 } 1755 }
1738 return null; 1756 return null;
1739 } 1757 }
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
2112 * Return the result of invoking the '~/' operator on this object with the giv en argument. 2130 * Return the result of invoking the '~/' operator on this object with the giv en argument.
2113 * 2131 *
2114 * @param typeProvider the type provider used to find known types 2132 * @param typeProvider the type provider used to find known types
2115 * @param rightOperand the right-hand operand of the operation 2133 * @param rightOperand the right-hand operand of the operation
2116 * @return the result of invoking the '~/' operator on this object with the gi ven argument 2134 * @return the result of invoking the '~/' operator on this object with the gi ven argument
2117 * @throws EvaluationException if the operator is not appropriate for an objec t of this kind 2135 * @throws EvaluationException if the operator is not appropriate for an objec t of this kind
2118 */ 2136 */
2119 DartObjectImpl integerDivide(TypeProvider typeProvider, DartObjectImpl rightOp erand) => new DartObjectImpl(typeProvider.intType, _state.integerDivide(rightOpe rand._state)); 2137 DartObjectImpl integerDivide(TypeProvider typeProvider, DartObjectImpl rightOp erand) => new DartObjectImpl(typeProvider.intType, _state.integerDivide(rightOpe rand._state));
2120 2138
2121 /** 2139 /**
2140 * Return the result of invoking the identical function on this object with
2141 * the given argument.
2142 *
2143 * @param typeProvider the type provider used to find known types
2144 * @param rightOperand the right-hand operand of the operation
2145 * @return the result of invoking the identical function on this object with
2146 * the given argument
2147 */
2148 DartObjectImpl isIdentical(TypeProvider typeProvider,
2149 DartObjectImpl rightOperand) {
2150 return new DartObjectImpl(typeProvider.boolType,
2151 _state.isIdentical(rightOperand._state));
2152 }
2153
2154 /**
2122 * Return `true` if this object represents an object whose type is 'bool'. 2155 * Return `true` if this object represents an object whose type is 'bool'.
2123 * 2156 *
2124 * @return `true` if this object represents a boolean value 2157 * @return `true` if this object represents a boolean value
2125 */ 2158 */
2126 bool get isBool => _state.isBool; 2159 bool get isBool => _state.isBool;
2127 2160
2128 /** 2161 /**
2129 * Return `true` if this object represents an object whose type is either 'boo l', 'num', 2162 * Return `true` if this object represents an object whose type is either 'boo l', 'num',
2130 * 'String', or 'Null'. 2163 * 'String', or 'Null'.
2131 * 2164 *
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
2510 return new DoubleState(value / rightValue); 2543 return new DoubleState(value / rightValue);
2511 } else if (rightOperand is DynamicState || rightOperand is NumState) { 2544 } else if (rightOperand is DynamicState || rightOperand is NumState) {
2512 return UNKNOWN_VALUE; 2545 return UNKNOWN_VALUE;
2513 } 2546 }
2514 throw new EvaluationException(CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTI ON); 2547 throw new EvaluationException(CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTI ON);
2515 } 2548 }
2516 2549
2517 @override 2550 @override
2518 BoolState equalEqual(InstanceState rightOperand) { 2551 BoolState equalEqual(InstanceState rightOperand) {
2519 assertBoolNumStringOrNull(rightOperand); 2552 assertBoolNumStringOrNull(rightOperand);
2553 return isIdentical(rightOperand);
2554 }
2555
2556 @override
2557 BoolState isIdentical(InstanceState rightOperand) {
2520 if (value == null) { 2558 if (value == null) {
2521 return BoolState.UNKNOWN_VALUE; 2559 return BoolState.UNKNOWN_VALUE;
2522 } 2560 }
2523 if (rightOperand is DoubleState) { 2561 if (rightOperand is DoubleState) {
2524 double rightValue = rightOperand.value; 2562 double rightValue = rightOperand.value;
2525 if (rightValue == null) { 2563 if (rightValue == null) {
2526 return BoolState.UNKNOWN_VALUE; 2564 return BoolState.UNKNOWN_VALUE;
2527 } 2565 }
2528 return BoolState.from(value == rightValue); 2566 return BoolState.from(value == rightValue);
2529 } else if (rightOperand is IntState) { 2567 } else if (rightOperand is IntState) {
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
2817 return _unknownNum(rightOperand); 2855 return _unknownNum(rightOperand);
2818 } 2856 }
2819 2857
2820 @override 2858 @override
2821 BoolState equalEqual(InstanceState rightOperand) { 2859 BoolState equalEqual(InstanceState rightOperand) {
2822 assertBoolNumStringOrNull(rightOperand); 2860 assertBoolNumStringOrNull(rightOperand);
2823 return BoolState.UNKNOWN_VALUE; 2861 return BoolState.UNKNOWN_VALUE;
2824 } 2862 }
2825 2863
2826 @override 2864 @override
2865 BoolState isIdentical(InstanceState rightOperand) {
2866 return BoolState.UNKNOWN_VALUE;
2867 }
2868
2869 @override
2827 String get typeName => "dynamic"; 2870 String get typeName => "dynamic";
2828 2871
2829 @override 2872 @override
2830 BoolState greaterThan(InstanceState rightOperand) { 2873 BoolState greaterThan(InstanceState rightOperand) {
2831 assertNumOrNull(rightOperand); 2874 assertNumOrNull(rightOperand);
2832 return BoolState.UNKNOWN_VALUE; 2875 return BoolState.UNKNOWN_VALUE;
2833 } 2876 }
2834 2877
2835 @override 2878 @override
2836 BoolState greaterThanOrEqual(InstanceState rightOperand) { 2879 BoolState greaterThanOrEqual(InstanceState rightOperand) {
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
3073 return StringState.UNKNOWN_VALUE; 3116 return StringState.UNKNOWN_VALUE;
3074 } 3117 }
3075 return new StringState(_element.name); 3118 return new StringState(_element.name);
3076 } 3119 }
3077 3120
3078 @override 3121 @override
3079 bool operator ==(Object object) => object is FunctionState && (_element == obj ect._element); 3122 bool operator ==(Object object) => object is FunctionState && (_element == obj ect._element);
3080 3123
3081 @override 3124 @override
3082 BoolState equalEqual(InstanceState rightOperand) { 3125 BoolState equalEqual(InstanceState rightOperand) {
3126 return isIdentical(rightOperand);
3127 }
3128
3129 @override
3130 BoolState isIdentical(InstanceState rightOperand) {
3083 if (_element == null) { 3131 if (_element == null) {
3084 return BoolState.UNKNOWN_VALUE; 3132 return BoolState.UNKNOWN_VALUE;
3085 } 3133 }
3086 if (rightOperand is FunctionState) { 3134 if (rightOperand is FunctionState) {
3087 ExecutableElement rightElement = rightOperand._element; 3135 ExecutableElement rightElement = rightOperand._element;
3088 if (rightElement == null) { 3136 if (rightElement == null) {
3089 return BoolState.UNKNOWN_VALUE; 3137 return BoolState.UNKNOWN_VALUE;
3090 } 3138 }
3091 return BoolState.from(_element == rightElement); 3139 return BoolState.from(_element == rightElement);
3092 } else if (rightOperand is DynamicState) { 3140 } else if (rightOperand is DynamicState) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
3131 * @param fieldMap the values of the fields of this instance 3179 * @param fieldMap the values of the fields of this instance
3132 */ 3180 */
3133 GenericState(this._fieldMap); 3181 GenericState(this._fieldMap);
3134 3182
3135 @override 3183 @override
3136 StringState convertToString() => StringState.UNKNOWN_VALUE; 3184 StringState convertToString() => StringState.UNKNOWN_VALUE;
3137 3185
3138 @override 3186 @override
3139 BoolState equalEqual(InstanceState rightOperand) { 3187 BoolState equalEqual(InstanceState rightOperand) {
3140 assertBoolNumStringOrNull(rightOperand); 3188 assertBoolNumStringOrNull(rightOperand);
3189 return isIdentical(rightOperand);
3190 }
3191
3192 @override
3193 BoolState isIdentical(InstanceState rightOperand) {
3141 if (rightOperand is DynamicState) { 3194 if (rightOperand is DynamicState) {
3142 return BoolState.UNKNOWN_VALUE; 3195 return BoolState.UNKNOWN_VALUE;
3143 } 3196 }
3144 return BoolState.from(this == rightOperand); 3197 return BoolState.from(this == rightOperand);
3145 } 3198 }
3146 3199
3147 @override 3200 @override
3148 bool operator ==(Object object) { 3201 bool operator ==(Object object) {
3149 if (object is! GenericState) { 3202 if (object is! GenericState) {
3150 return false; 3203 return false;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
3369 * @return the result of invoking the '~/' operator on this object with the gi ven argument 3422 * @return the result of invoking the '~/' operator on this object with the gi ven argument
3370 * @throws EvaluationException if the operator is not appropriate for an objec t of this kind 3423 * @throws EvaluationException if the operator is not appropriate for an objec t of this kind
3371 */ 3424 */
3372 IntState integerDivide(InstanceState rightOperand) { 3425 IntState integerDivide(InstanceState rightOperand) {
3373 assertNumOrNull(this); 3426 assertNumOrNull(this);
3374 assertNumOrNull(rightOperand); 3427 assertNumOrNull(rightOperand);
3375 throw new EvaluationException(CompileTimeErrorCode.INVALID_CONSTANT); 3428 throw new EvaluationException(CompileTimeErrorCode.INVALID_CONSTANT);
3376 } 3429 }
3377 3430
3378 /** 3431 /**
3432 * Return the result of invoking the identical function on this object with
3433 * the given argument.
3434 *
3435 * @param rightOperand the right-hand operand of the operation
3436 * @return the result of invoking the identical function on this object with
3437 * the given argument
3438 */
3439 BoolState isIdentical(InstanceState rightOperand);
3440
3441 /**
3379 * Return `true` if this object represents an object whose type is 'bool'. 3442 * Return `true` if this object represents an object whose type is 'bool'.
3380 * 3443 *
3381 * @return `true` if this object represents a boolean value 3444 * @return `true` if this object represents a boolean value
3382 */ 3445 */
3383 bool get isBool => false; 3446 bool get isBool => false;
3384 3447
3385 /** 3448 /**
3386 * Return `true` if this object represents an object whose type is either 'boo l', 'num', 3449 * Return `true` if this object represents an object whose type is either 'boo l', 'num',
3387 * 'String', or 'Null'. 3450 * 'String', or 'Null'.
3388 * 3451 *
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
3753 return new DoubleState(value.toDouble() / rightValue); 3816 return new DoubleState(value.toDouble() / rightValue);
3754 } else if (rightOperand is DynamicState || rightOperand is NumState) { 3817 } else if (rightOperand is DynamicState || rightOperand is NumState) {
3755 return UNKNOWN_VALUE; 3818 return UNKNOWN_VALUE;
3756 } 3819 }
3757 throw new EvaluationException(CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTI ON); 3820 throw new EvaluationException(CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTI ON);
3758 } 3821 }
3759 3822
3760 @override 3823 @override
3761 BoolState equalEqual(InstanceState rightOperand) { 3824 BoolState equalEqual(InstanceState rightOperand) {
3762 assertBoolNumStringOrNull(rightOperand); 3825 assertBoolNumStringOrNull(rightOperand);
3826 return isIdentical(rightOperand);
3827 }
3828
3829 @override
3830 BoolState isIdentical(InstanceState rightOperand) {
3763 if (value == null) { 3831 if (value == null) {
3764 return BoolState.UNKNOWN_VALUE; 3832 return BoolState.UNKNOWN_VALUE;
3765 } 3833 }
3766 if (rightOperand is IntState) { 3834 if (rightOperand is IntState) {
3767 int rightValue = rightOperand.value; 3835 int rightValue = rightOperand.value;
3768 if (rightValue == null) { 3836 if (rightValue == null) {
3769 return BoolState.UNKNOWN_VALUE; 3837 return BoolState.UNKNOWN_VALUE;
3770 } 3838 }
3771 return BoolState.from(value == rightValue); 3839 return BoolState.from(value == rightValue);
3772 } else if (rightOperand is DoubleState) { 3840 } else if (rightOperand is DoubleState) {
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
4073 * @param elements the elements of the list 4141 * @param elements the elements of the list
4074 */ 4142 */
4075 ListState(this._elements); 4143 ListState(this._elements);
4076 4144
4077 @override 4145 @override
4078 StringState convertToString() => StringState.UNKNOWN_VALUE; 4146 StringState convertToString() => StringState.UNKNOWN_VALUE;
4079 4147
4080 @override 4148 @override
4081 BoolState equalEqual(InstanceState rightOperand) { 4149 BoolState equalEqual(InstanceState rightOperand) {
4082 assertBoolNumStringOrNull(rightOperand); 4150 assertBoolNumStringOrNull(rightOperand);
4151 return isIdentical(rightOperand);
4152 }
4153
4154 @override
4155 BoolState isIdentical(InstanceState rightOperand) {
4083 if (rightOperand is DynamicState) { 4156 if (rightOperand is DynamicState) {
4084 return BoolState.UNKNOWN_VALUE; 4157 return BoolState.UNKNOWN_VALUE;
4085 } 4158 }
4086 return BoolState.from(this == rightOperand); 4159 return BoolState.from(this == rightOperand);
4087 } 4160 }
4088 4161
4089 @override 4162 @override
4090 bool operator ==(Object object) { 4163 bool operator ==(Object object) {
4091 if (object is! ListState) { 4164 if (object is! ListState) {
4092 return false; 4165 return false;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
4161 * @param entries the entries in the map 4234 * @param entries the entries in the map
4162 */ 4235 */
4163 MapState(this._entries); 4236 MapState(this._entries);
4164 4237
4165 @override 4238 @override
4166 StringState convertToString() => StringState.UNKNOWN_VALUE; 4239 StringState convertToString() => StringState.UNKNOWN_VALUE;
4167 4240
4168 @override 4241 @override
4169 BoolState equalEqual(InstanceState rightOperand) { 4242 BoolState equalEqual(InstanceState rightOperand) {
4170 assertBoolNumStringOrNull(rightOperand); 4243 assertBoolNumStringOrNull(rightOperand);
4244 return isIdentical(rightOperand);
4245 }
4246
4247 @override
4248 BoolState isIdentical(InstanceState rightOperand) {
4171 if (rightOperand is DynamicState) { 4249 if (rightOperand is DynamicState) {
4172 return BoolState.UNKNOWN_VALUE; 4250 return BoolState.UNKNOWN_VALUE;
4173 } 4251 }
4174 return BoolState.from(this == rightOperand); 4252 return BoolState.from(this == rightOperand);
4175 } 4253 }
4176 4254
4177 @override 4255 @override
4178 bool operator ==(Object object) { 4256 bool operator ==(Object object) {
4179 if (object is! MapState) { 4257 if (object is! MapState) {
4180 return false; 4258 return false;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
4245 BoolState convertToBool() { 4323 BoolState convertToBool() {
4246 throw new EvaluationException(CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTI ON); 4324 throw new EvaluationException(CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTI ON);
4247 } 4325 }
4248 4326
4249 @override 4327 @override
4250 StringState convertToString() => new StringState("null"); 4328 StringState convertToString() => new StringState("null");
4251 4329
4252 @override 4330 @override
4253 BoolState equalEqual(InstanceState rightOperand) { 4331 BoolState equalEqual(InstanceState rightOperand) {
4254 assertBoolNumStringOrNull(rightOperand); 4332 assertBoolNumStringOrNull(rightOperand);
4333 return isIdentical(rightOperand);
4334 }
4335
4336 @override
4337 BoolState isIdentical(InstanceState rightOperand) {
4255 if (rightOperand is DynamicState) { 4338 if (rightOperand is DynamicState) {
4256 return BoolState.UNKNOWN_VALUE; 4339 return BoolState.UNKNOWN_VALUE;
4257 } 4340 }
4258 return BoolState.from(rightOperand is NullState); 4341 return BoolState.from(rightOperand is NullState);
4259 } 4342 }
4260 4343
4261 @override 4344 @override
4262 bool operator ==(Object object) => object is NullState; 4345 bool operator ==(Object object) => object is NullState;
4263 4346
4264 @override 4347 @override
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
4307 return UNKNOWN_VALUE; 4390 return UNKNOWN_VALUE;
4308 } 4391 }
4309 4392
4310 @override 4393 @override
4311 BoolState equalEqual(InstanceState rightOperand) { 4394 BoolState equalEqual(InstanceState rightOperand) {
4312 assertBoolNumStringOrNull(rightOperand); 4395 assertBoolNumStringOrNull(rightOperand);
4313 return BoolState.UNKNOWN_VALUE; 4396 return BoolState.UNKNOWN_VALUE;
4314 } 4397 }
4315 4398
4316 @override 4399 @override
4400 BoolState isIdentical(InstanceState rightOperand) {
4401 return BoolState.UNKNOWN_VALUE;
4402 }
4403
4404 @override
4317 bool operator ==(Object object) => object is NumState; 4405 bool operator ==(Object object) => object is NumState;
4318 4406
4319 @override 4407 @override
4320 String get typeName => "num"; 4408 String get typeName => "num";
4321 4409
4322 @override 4410 @override
4323 BoolState greaterThan(InstanceState rightOperand) { 4411 BoolState greaterThan(InstanceState rightOperand) {
4324 assertNumOrNull(rightOperand); 4412 assertNumOrNull(rightOperand);
4325 return BoolState.UNKNOWN_VALUE; 4413 return BoolState.UNKNOWN_VALUE;
4326 } 4414 }
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
4532 } 4620 }
4533 return super.concatenate(rightOperand); 4621 return super.concatenate(rightOperand);
4534 } 4622 }
4535 4623
4536 @override 4624 @override
4537 StringState convertToString() => this; 4625 StringState convertToString() => this;
4538 4626
4539 @override 4627 @override
4540 BoolState equalEqual(InstanceState rightOperand) { 4628 BoolState equalEqual(InstanceState rightOperand) {
4541 assertBoolNumStringOrNull(rightOperand); 4629 assertBoolNumStringOrNull(rightOperand);
4630 return isIdentical(rightOperand);
4631 }
4632
4633 @override
4634 BoolState isIdentical(InstanceState rightOperand) {
4542 if (value == null) { 4635 if (value == null) {
4543 return BoolState.UNKNOWN_VALUE; 4636 return BoolState.UNKNOWN_VALUE;
4544 } 4637 }
4545 if (rightOperand is StringState) { 4638 if (rightOperand is StringState) {
4546 String rightValue = rightOperand.value; 4639 String rightValue = rightOperand.value;
4547 if (rightValue == null) { 4640 if (rightValue == null) {
4548 return BoolState.UNKNOWN_VALUE; 4641 return BoolState.UNKNOWN_VALUE;
4549 } 4642 }
4550 return BoolState.from(value == rightValue); 4643 return BoolState.from(value == rightValue);
4551 } else if (rightOperand is DynamicState) { 4644 } else if (rightOperand is DynamicState) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
4605 StringState convertToString() { 4698 StringState convertToString() {
4606 if (value == null) { 4699 if (value == null) {
4607 return StringState.UNKNOWN_VALUE; 4700 return StringState.UNKNOWN_VALUE;
4608 } 4701 }
4609 return new StringState(value); 4702 return new StringState(value);
4610 } 4703 }
4611 4704
4612 @override 4705 @override
4613 BoolState equalEqual(InstanceState rightOperand) { 4706 BoolState equalEqual(InstanceState rightOperand) {
4614 assertBoolNumStringOrNull(rightOperand); 4707 assertBoolNumStringOrNull(rightOperand);
4708 return isIdentical(rightOperand);
4709 }
4710
4711 @override
4712 BoolState isIdentical(InstanceState rightOperand) {
4615 if (value == null) { 4713 if (value == null) {
4616 return BoolState.UNKNOWN_VALUE; 4714 return BoolState.UNKNOWN_VALUE;
4617 } 4715 }
4618 if (rightOperand is SymbolState) { 4716 if (rightOperand is SymbolState) {
4619 String rightValue = rightOperand.value; 4717 String rightValue = rightOperand.value;
4620 if (rightValue == null) { 4718 if (rightValue == null) {
4621 return BoolState.UNKNOWN_VALUE; 4719 return BoolState.UNKNOWN_VALUE;
4622 } 4720 }
4623 return BoolState.from(value == rightValue); 4721 return BoolState.from(value == rightValue);
4624 } else if (rightOperand is DynamicState) { 4722 } else if (rightOperand is DynamicState) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
4666 } 4764 }
4667 return new StringState(_element.name); 4765 return new StringState(_element.name);
4668 } 4766 }
4669 4767
4670 @override 4768 @override
4671 bool operator ==(Object object) => object is TypeState && (_element == object. _element); 4769 bool operator ==(Object object) => object is TypeState && (_element == object. _element);
4672 4770
4673 @override 4771 @override
4674 BoolState equalEqual(InstanceState rightOperand) { 4772 BoolState equalEqual(InstanceState rightOperand) {
4675 assertBoolNumStringOrNull(rightOperand); 4773 assertBoolNumStringOrNull(rightOperand);
4774 return isIdentical(rightOperand);
4775 }
4776
4777 @override
4778 BoolState isIdentical(InstanceState rightOperand) {
4676 if (_element == null) { 4779 if (_element == null) {
4677 return BoolState.UNKNOWN_VALUE; 4780 return BoolState.UNKNOWN_VALUE;
4678 } 4781 }
4679 if (rightOperand is TypeState) { 4782 if (rightOperand is TypeState) {
4680 Element rightElement = rightOperand._element; 4783 Element rightElement = rightOperand._element;
4681 if (rightElement == null) { 4784 if (rightElement == null) {
4682 return BoolState.UNKNOWN_VALUE; 4785 return BoolState.UNKNOWN_VALUE;
4683 } 4786 }
4684 return BoolState.from(_element == rightElement); 4787 return BoolState.from(_element == rightElement);
4685 } else if (rightOperand is DynamicState) { 4788 } else if (rightOperand is DynamicState) {
4686 return BoolState.UNKNOWN_VALUE; 4789 return BoolState.UNKNOWN_VALUE;
4687 } 4790 }
4688 return BoolState.FALSE_STATE; 4791 return BoolState.FALSE_STATE;
4689 } 4792 }
4690 4793
4691 @override 4794 @override
4692 String get typeName => "Type"; 4795 String get typeName => "Type";
4693 4796
4694 @override 4797 @override
4695 int get hashCode => _element == null ? 0 : _element.hashCode; 4798 int get hashCode => _element == null ? 0 : _element.hashCode;
4696 4799
4697 @override 4800 @override
4698 String toString() => _element == null ? "-unknown-" : _element.name; 4801 String toString() => _element == null ? "-unknown-" : _element.name;
4699 } 4802 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/all_the_rest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698