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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Issue 2931423002: Prepare for improved error recovery from compile-time errors. (Closed)
Patch Set: Rebased on 11f82b12d2fb4f2c323cbc5a25de9835cc8e5031 Created 3 years, 6 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 | pkg/front_end/lib/src/fasta/source/source_loader.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/kernel/body_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index d907fb7283b17585114f3648ace5e79a631c2f9b..f4081421980789796dd06d77b6e9363883297c24 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -877,16 +877,21 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
message = "Method not found: '$errorName'.";
}
if (constantExpressionRequired) {
+ // TODO(ahe): Use error below instead of building a compile-time error,
+ // should be:
+ // return library.loader.throwCompileConstantError(error, charOffset);
return buildCompileTimeError(message, charOffset);
+ } else {
+ Expression error = library.loader.instantiateNoSuchMethodError(
+ receiver, name, arguments, charOffset,
+ isMethod: !isGetter && !isSetter,
+ isGetter: isGetter,
+ isSetter: isSetter,
+ isStatic: isStatic,
+ isTopLevel: !isStatic && !isSuper);
+ warning(message, charOffset);
+ return new Throw(error);
}
- warning(message, charOffset);
- return new Throw(library.loader.instantiateNoSuchMethodError(
- receiver, name, arguments, charOffset,
- isMethod: !isGetter && !isSetter,
- isGetter: isGetter,
- isSetter: isSetter,
- isStatic: isStatic,
- isTopLevel: !isStatic && !isSuper));
}
@override
@@ -2883,11 +2888,9 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
// extracted. Similar for statements and initializers. See also [issue
// 29717](https://github.com/dart-lang/sdk/issues/29717)
addCompileTimeError(charOffset, error);
- String message = formatUnexpected(uri, charOffset, error);
- Builder constructor = library.loader.getCompileTimeError();
- return new Throw(buildStaticInvocation(constructor.target,
- new KernelArguments(<Expression>[new StringLiteral(message)]),
- charOffset: charOffset));
+ return library.loader.throwCompileConstantError(library.loader
+ .buildCompileTimeError(
+ formatUnexpected(uri, charOffset, error), charOffset));
}
Expression wrapInCompileTimeError(Expression expression, String message) {
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/source/source_loader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698