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

Unified Diff: pkg/compiler/lib/src/types/type_mask.dart

Issue 2898333002: Use failedAt in more places (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/types/type_mask.dart
diff --git a/pkg/compiler/lib/src/types/type_mask.dart b/pkg/compiler/lib/src/types/type_mask.dart
index 90bb9113ad11e7ac478dc92db17be383d0d892db..c855f89c12d1f0ec836b94d8076475fccafab93f 100644
--- a/pkg/compiler/lib/src/types/type_mask.dart
+++ b/pkg/compiler/lib/src/types/type_mask.dart
@@ -85,8 +85,11 @@ abstract class TypeMask implements ReceiverConstraint, AbstractValue {
const factory TypeMask.empty() = FlatTypeMask.empty;
factory TypeMask.exact(ClassEntity base, ClosedWorld closedWorld) {
- assert(invariant(base, closedWorld.isInstantiated(base),
- message: () => "Cannot create exact type mask for uninstantiated "
+ assert(
+ closedWorld.isInstantiated(base),
+ failedAt(
+ base,
+ "Cannot create exact type mask for uninstantiated "
"class $base.\n${closedWorld.dump(base)}"));
return new FlatTypeMask.exact(base);
}
@@ -97,8 +100,11 @@ abstract class TypeMask implements ReceiverConstraint, AbstractValue {
}
factory TypeMask.subclass(ClassEntity base, ClosedWorld closedWorld) {
- assert(invariant(base, closedWorld.isInstantiated(base),
- message: () => "Cannot create subclass type mask for uninstantiated "
+ assert(
+ closedWorld.isInstantiated(base),
+ failedAt(
+ base,
+ "Cannot create subclass type mask for uninstantiated "
"class $base.\n${closedWorld.dump(base)}"));
ClassEntity topmost = closedWorld.getLubOfInstantiatedSubclasses(base);
if (topmost == null) {
@@ -128,8 +134,11 @@ abstract class TypeMask implements ReceiverConstraint, AbstractValue {
const factory TypeMask.nonNullEmpty() = FlatTypeMask.nonNullEmpty;
factory TypeMask.nonNullExact(ClassEntity base, ClosedWorld closedWorld) {
- assert(invariant(base, closedWorld.isInstantiated(base),
- message: () => "Cannot create exact type mask for uninstantiated "
+ assert(
+ closedWorld.isInstantiated(base),
+ failedAt(
+ base,
+ "Cannot create exact type mask for uninstantiated "
"class $base.\n${closedWorld.dump(base)}"));
return new FlatTypeMask.nonNullExact(base);
}
@@ -143,8 +152,11 @@ abstract class TypeMask implements ReceiverConstraint, AbstractValue {
}
factory TypeMask.nonNullSubclass(ClassEntity base, ClosedWorld closedWorld) {
- assert(invariant(base, closedWorld.isInstantiated(base),
- message: () => "Cannot create subclass type mask for uninstantiated "
+ assert(
+ closedWorld.isInstantiated(base),
+ failedAt(
+ base,
+ "Cannot create subclass type mask for uninstantiated "
"class $base.\n${closedWorld.dump(base)}"));
ClassEntity topmost = closedWorld.getLubOfInstantiatedSubclasses(base);
if (topmost == null) {
@@ -195,8 +207,9 @@ abstract class TypeMask implements ReceiverConstraint, AbstractValue {
*/
static bool assertIsNormalized(TypeMask mask, ClosedWorld closedWorld) {
String reason = getNotNormalizedReason(mask, closedWorld);
- return invariant(NO_LOCATION_SPANNABLE, reason == null,
- message: () => '$mask is not normalized: $reason');
+ assert(reason == null,
+ failedAt(NO_LOCATION_SPANNABLE, '$mask is not normalized: $reason'));
+ return true;
}
static String getNotNormalizedReason(TypeMask mask, ClosedWorld closedWorld) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698