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

Unified Diff: pkg/analyzer/lib/src/dart/constant/value.dart

Issue 2188403002: Revert "fix #26141, add support for type arguments to constants" (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/dart/constant/value.dart
diff --git a/pkg/analyzer/lib/src/dart/constant/value.dart b/pkg/analyzer/lib/src/dart/constant/value.dart
index a0d11629d04247eea94cf6941d2ed8186e3c13a4..a26992577fea4e013cc524b7e6ac3fff18a0b632 100644
--- a/pkg/analyzer/lib/src/dart/constant/value.dart
+++ b/pkg/analyzer/lib/src/dart/constant/value.dart
@@ -720,7 +720,10 @@ class DartObjectImpl implements DartObject {
DartType toTypeValue() {
InstanceState state = _state;
if (state is TypeState) {
- return state._type;
+ Element element = state._element;
+ if (element is TypeDefiningElement) {
+ return element.type;
+ }
}
return null;
}
@@ -2768,29 +2771,29 @@ class TypeState extends InstanceState {
/**
* The element representing the type being modeled.
*/
- final DartType _type;
+ final Element _element;
/**
* Initialize a newly created state to represent the given [value].
*/
- TypeState(this._type);
+ TypeState(this._element);
@override
- int get hashCode => _type?.hashCode ?? 0;
+ int get hashCode => _element == null ? 0 : _element.hashCode;
@override
String get typeName => "Type";
@override
bool operator ==(Object object) =>
- object is TypeState && (_type == object._type);
+ object is TypeState && (_element == object._element);
@override
StringState convertToString() {
- if (_type == null) {
+ if (_element == null) {
return StringState.UNKNOWN_VALUE;
}
- return new StringState(_type.displayName);
+ return new StringState(_element.name);
}
@override
@@ -2801,15 +2804,15 @@ class TypeState extends InstanceState {
@override
BoolState isIdentical(InstanceState rightOperand) {
- if (_type == null) {
+ if (_element == null) {
return BoolState.UNKNOWN_VALUE;
}
if (rightOperand is TypeState) {
- DartType rightType = rightOperand._type;
- if (rightType == null) {
+ Element rightElement = rightOperand._element;
+ if (rightElement == null) {
return BoolState.UNKNOWN_VALUE;
}
- return BoolState.from(_type == rightType);
+ return BoolState.from(_element == rightElement);
} else if (rightOperand is DynamicState) {
return BoolState.UNKNOWN_VALUE;
}
@@ -2817,5 +2820,5 @@ class TypeState extends InstanceState {
}
@override
- String toString() => _type?.toString() ?? "-unknown-";
+ String toString() => _element == null ? "-unknown-" : _element.name;
}
« no previous file with comments | « pkg/analyzer/lib/src/dart/constant/evaluation.dart ('k') | pkg/analyzer/lib/src/generated/error_verifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698