| Index: pkg/analyzer/lib/src/generated/constant.dart
|
| diff --git a/pkg/analyzer/lib/src/generated/constant.dart b/pkg/analyzer/lib/src/generated/constant.dart
|
| index ee68be8a0774711002b3eba9fab811a7009d9de6..21f12f63f89b169ba6dade6d7ebd6077df4031f5 100644
|
| --- a/pkg/analyzer/lib/src/generated/constant.dart
|
| +++ b/pkg/analyzer/lib/src/generated/constant.dart
|
| @@ -74,6 +74,11 @@ class BoolState extends InstanceState {
|
| @override
|
| BoolState equalEqual(InstanceState rightOperand) {
|
| assertBoolNumStringOrNull(rightOperand);
|
| + return isIdentical(rightOperand);
|
| + }
|
| +
|
| + @override
|
| + BoolState isIdentical(InstanceState rightOperand) {
|
| if (value == null) {
|
| return UNKNOWN_VALUE;
|
| }
|
| @@ -1253,7 +1258,8 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
|
| if (library.isDartCore) {
|
| DartObjectImpl leftArgument = arguments[0].accept(this);
|
| DartObjectImpl rightArgument = arguments[1].accept(this);
|
| - return _dartObjectComputer.equalEqual(node, leftArgument, rightArgument);
|
| + return _dartObjectComputer.isIdentical(node, leftArgument,
|
| + rightArgument);
|
| }
|
| }
|
| }
|
| @@ -1727,6 +1733,18 @@ class DartObjectComputer {
|
| return null;
|
| }
|
|
|
| + DartObjectImpl isIdentical(Expression node, DartObjectImpl leftOperand,
|
| + DartObjectImpl rightOperand) {
|
| + if (leftOperand != null && rightOperand != null) {
|
| + try {
|
| + return leftOperand.isIdentical(_typeProvider, rightOperand);
|
| + } on EvaluationException catch (exception) {
|
| + _errorReporter.reportErrorForNode(exception.errorCode, node, []);
|
| + }
|
| + }
|
| + return null;
|
| + }
|
| +
|
| DartObjectImpl lessThan(BinaryExpression node, DartObjectImpl leftOperand, DartObjectImpl rightOperand) {
|
| if (leftOperand != null && rightOperand != null) {
|
| try {
|
| @@ -2119,6 +2137,21 @@ class DartObjectImpl implements DartObject {
|
| DartObjectImpl integerDivide(TypeProvider typeProvider, DartObjectImpl rightOperand) => new DartObjectImpl(typeProvider.intType, _state.integerDivide(rightOperand._state));
|
|
|
| /**
|
| + * Return the result of invoking the identical function on this object with
|
| + * the given argument.
|
| + *
|
| + * @param typeProvider the type provider used to find known types
|
| + * @param rightOperand the right-hand operand of the operation
|
| + * @return the result of invoking the identical function on this object with
|
| + * the given argument
|
| + */
|
| + DartObjectImpl isIdentical(TypeProvider typeProvider,
|
| + DartObjectImpl rightOperand) {
|
| + return new DartObjectImpl(typeProvider.boolType,
|
| + _state.isIdentical(rightOperand._state));
|
| + }
|
| +
|
| + /**
|
| * Return `true` if this object represents an object whose type is 'bool'.
|
| *
|
| * @return `true` if this object represents a boolean value
|
| @@ -2517,6 +2550,11 @@ class DoubleState extends NumState {
|
| @override
|
| BoolState equalEqual(InstanceState rightOperand) {
|
| assertBoolNumStringOrNull(rightOperand);
|
| + return isIdentical(rightOperand);
|
| + }
|
| +
|
| + @override
|
| + BoolState isIdentical(InstanceState rightOperand) {
|
| if (value == null) {
|
| return BoolState.UNKNOWN_VALUE;
|
| }
|
| @@ -2824,6 +2862,11 @@ class DynamicState extends InstanceState {
|
| }
|
|
|
| @override
|
| + BoolState isIdentical(InstanceState rightOperand) {
|
| + return BoolState.UNKNOWN_VALUE;
|
| + }
|
| +
|
| + @override
|
| String get typeName => "dynamic";
|
|
|
| @override
|
| @@ -3080,6 +3123,11 @@ class FunctionState extends InstanceState {
|
|
|
| @override
|
| BoolState equalEqual(InstanceState rightOperand) {
|
| + return isIdentical(rightOperand);
|
| + }
|
| +
|
| + @override
|
| + BoolState isIdentical(InstanceState rightOperand) {
|
| if (_element == null) {
|
| return BoolState.UNKNOWN_VALUE;
|
| }
|
| @@ -3138,6 +3186,11 @@ class GenericState extends InstanceState {
|
| @override
|
| BoolState equalEqual(InstanceState rightOperand) {
|
| assertBoolNumStringOrNull(rightOperand);
|
| + return isIdentical(rightOperand);
|
| + }
|
| +
|
| + @override
|
| + BoolState isIdentical(InstanceState rightOperand) {
|
| if (rightOperand is DynamicState) {
|
| return BoolState.UNKNOWN_VALUE;
|
| }
|
| @@ -3376,6 +3429,16 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| + * Return the result of invoking the identical function on this object with
|
| + * the given argument.
|
| + *
|
| + * @param rightOperand the right-hand operand of the operation
|
| + * @return the result of invoking the identical function on this object with
|
| + * the given argument
|
| + */
|
| + BoolState isIdentical(InstanceState rightOperand);
|
| +
|
| + /**
|
| * Return `true` if this object represents an object whose type is 'bool'.
|
| *
|
| * @return `true` if this object represents a boolean value
|
| @@ -3760,6 +3823,11 @@ class IntState extends NumState {
|
| @override
|
| BoolState equalEqual(InstanceState rightOperand) {
|
| assertBoolNumStringOrNull(rightOperand);
|
| + return isIdentical(rightOperand);
|
| + }
|
| +
|
| + @override
|
| + BoolState isIdentical(InstanceState rightOperand) {
|
| if (value == null) {
|
| return BoolState.UNKNOWN_VALUE;
|
| }
|
| @@ -4080,6 +4148,11 @@ class ListState extends InstanceState {
|
| @override
|
| BoolState equalEqual(InstanceState rightOperand) {
|
| assertBoolNumStringOrNull(rightOperand);
|
| + return isIdentical(rightOperand);
|
| + }
|
| +
|
| + @override
|
| + BoolState isIdentical(InstanceState rightOperand) {
|
| if (rightOperand is DynamicState) {
|
| return BoolState.UNKNOWN_VALUE;
|
| }
|
| @@ -4168,6 +4241,11 @@ class MapState extends InstanceState {
|
| @override
|
| BoolState equalEqual(InstanceState rightOperand) {
|
| assertBoolNumStringOrNull(rightOperand);
|
| + return isIdentical(rightOperand);
|
| + }
|
| +
|
| + @override
|
| + BoolState isIdentical(InstanceState rightOperand) {
|
| if (rightOperand is DynamicState) {
|
| return BoolState.UNKNOWN_VALUE;
|
| }
|
| @@ -4252,6 +4330,11 @@ class NullState extends InstanceState {
|
| @override
|
| BoolState equalEqual(InstanceState rightOperand) {
|
| assertBoolNumStringOrNull(rightOperand);
|
| + return isIdentical(rightOperand);
|
| + }
|
| +
|
| + @override
|
| + BoolState isIdentical(InstanceState rightOperand) {
|
| if (rightOperand is DynamicState) {
|
| return BoolState.UNKNOWN_VALUE;
|
| }
|
| @@ -4314,6 +4397,11 @@ class NumState extends InstanceState {
|
| }
|
|
|
| @override
|
| + BoolState isIdentical(InstanceState rightOperand) {
|
| + return BoolState.UNKNOWN_VALUE;
|
| + }
|
| +
|
| + @override
|
| bool operator ==(Object object) => object is NumState;
|
|
|
| @override
|
| @@ -4539,6 +4627,11 @@ class StringState extends InstanceState {
|
| @override
|
| BoolState equalEqual(InstanceState rightOperand) {
|
| assertBoolNumStringOrNull(rightOperand);
|
| + return isIdentical(rightOperand);
|
| + }
|
| +
|
| + @override
|
| + BoolState isIdentical(InstanceState rightOperand) {
|
| if (value == null) {
|
| return BoolState.UNKNOWN_VALUE;
|
| }
|
| @@ -4612,6 +4705,11 @@ class SymbolState extends InstanceState {
|
| @override
|
| BoolState equalEqual(InstanceState rightOperand) {
|
| assertBoolNumStringOrNull(rightOperand);
|
| + return isIdentical(rightOperand);
|
| + }
|
| +
|
| + @override
|
| + BoolState isIdentical(InstanceState rightOperand) {
|
| if (value == null) {
|
| return BoolState.UNKNOWN_VALUE;
|
| }
|
| @@ -4673,6 +4771,11 @@ class TypeState extends InstanceState {
|
| @override
|
| BoolState equalEqual(InstanceState rightOperand) {
|
| assertBoolNumStringOrNull(rightOperand);
|
| + return isIdentical(rightOperand);
|
| + }
|
| +
|
| + @override
|
| + BoolState isIdentical(InstanceState rightOperand) {
|
| if (_element == null) {
|
| return BoolState.UNKNOWN_VALUE;
|
| }
|
|
|