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

Unified Diff: pkg/compiler/lib/src/parser/partial_elements.dart

Issue 2917653002: 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 | « pkg/compiler/lib/src/parser/parser_task.dart ('k') | pkg/compiler/lib/src/resolution/class_members.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/parser/partial_elements.dart
diff --git a/pkg/compiler/lib/src/parser/partial_elements.dart b/pkg/compiler/lib/src/parser/partial_elements.dart
index 40b266aa8f614eaf86bd8297a071316b89aa6fbb..899f686a3a0239bb9e1285974d2294798440ef54 100644
--- a/pkg/compiler/lib/src/parser/partial_elements.dart
+++ b/pkg/compiler/lib/src/parser/partial_elements.dart
@@ -85,8 +85,8 @@ abstract class PartialFunctionMixin implements BaseFunctionElementX {
bool get hasNode => cachedNode != null;
FunctionExpression get node {
- assert(invariant(this, cachedNode != null,
- message: "Node has not been computed for $this."));
+ assert(cachedNode != null,
+ failedAt(this, "Node has not been computed for $this."));
return cachedNode;
}
@@ -341,7 +341,7 @@ class PartialMetadataAnnotation extends MetadataAnnotationX
bool get hasNode => cachedNode != null;
Node get node {
- assert(invariant(this, hasNode));
+ assert(hasNode, failedAt(this));
return cachedNode;
}
}
@@ -371,8 +371,8 @@ class PartialClassElement extends ClassElementX with PartialElement {
bool get hasNode => cachedNode != null;
ClassNode get node {
- assert(invariant(this, cachedNode != null,
- message: "Node has not been computed for $this."));
+ assert(cachedNode != null,
+ failedAt(this, "Node has not been computed for $this."));
return cachedNode;
}
@@ -388,9 +388,10 @@ class PartialClassElement extends ClassElementX with PartialElement {
Token token = parser.parseTopLevelDeclaration(beginToken);
assert(identical(token, endToken.next));
cachedNode = listener.popNode();
- assert(invariant(
- reporter.spanFromToken(beginToken), listener.nodes.isEmpty,
- message: "Non-empty listener stack: ${listener.nodes}"));
+ assert(
+ listener.nodes.isEmpty,
+ failedAt(reporter.spanFromToken(beginToken),
+ "Non-empty listener stack: ${listener.nodes}"));
} on ParserError {
// TODO(ahe): Often, a ParserError is thrown while parsing the class
// body. This means that the stack actually contains most of the
« no previous file with comments | « pkg/compiler/lib/src/parser/parser_task.dart ('k') | pkg/compiler/lib/src/resolution/class_members.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698