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

Unified Diff: pkg/compiler/lib/src/constants/evaluation.dart

Issue 2900263002: Use failedAt in more places (constants, universe) (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
Index: pkg/compiler/lib/src/constants/evaluation.dart
diff --git a/pkg/compiler/lib/src/constants/evaluation.dart b/pkg/compiler/lib/src/constants/evaluation.dart
index a799d17254aca5d2e5a8fede04e928872b2ee029..d94e5528b6e010e8c7ae446aa523fcba94dc139f 100644
--- a/pkg/compiler/lib/src/constants/evaluation.dart
+++ b/pkg/compiler/lib/src/constants/evaluation.dart
@@ -48,14 +48,18 @@ class NormalizedArguments {
int index = callStructure.namedArguments.indexOf(name);
if (index == -1) {
// The named argument is not provided.
- invariant(CURRENT_ELEMENT_SPANNABLE, defaultValues[name] != null,
- message: "No default value for named argument '$name' in $this.");
+ assert(
+ defaultValues[name] != null,
+ failedAt(CURRENT_ELEMENT_SPANNABLE,
+ "No default value for named argument '$name' in $this."));
return defaultValues[name];
}
ConstantExpression value =
arguments[index + callStructure.positionalArgumentCount];
- invariant(CURRENT_ELEMENT_SPANNABLE, value != null,
- message: "No value for named argument '$name' in $this.");
+ assert(
+ value != null,
+ failedAt(CURRENT_ELEMENT_SPANNABLE,
+ "No value for named argument '$name' in $this."));
return value;
}
@@ -63,13 +67,17 @@ class NormalizedArguments {
ConstantExpression getPositionalArgument(int index) {
if (index >= callStructure.positionalArgumentCount) {
// The positional argument is not provided.
- invariant(CURRENT_ELEMENT_SPANNABLE, defaultValues[index] != null,
- message: "No default value for positional argument $index in $this.");
+ assert(
+ defaultValues[index] != null,
+ failedAt(CURRENT_ELEMENT_SPANNABLE,
+ "No default value for positional argument $index in $this."));
return defaultValues[index];
}
ConstantExpression value = arguments[index];
- invariant(CURRENT_ELEMENT_SPANNABLE, value != null,
- message: "No value for positional argument $index in $this.");
+ assert(
+ value != null,
+ failedAt(CURRENT_ELEMENT_SPANNABLE,
+ "No value for positional argument $index in $this."));
return value;
}

Powered by Google App Engine
This is Rietveld 408576698