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

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

Issue 2764303002: Move throwNoSuchMethodError to BodyBuilder. (Closed)
Patch Set: Created 3 years, 9 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/kernel/builder_accessors.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 97e7af17d8020cc2b7ec5a0481a724cbc67e6da4..e3f51e31854852acb79ad76547c6090afbbfd0c8 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -38,9 +38,6 @@ import 'builder_accessors.dart';
import 'frontend_accessors.dart' show buildIsNull, makeBinary, makeLet;
-import 'builder_accessors.dart' as builder_accessors
- show throwNoSuchMethodError;
-
import '../quote.dart'
show
Quote,
@@ -93,7 +90,6 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
final ClassHierarchy hierarchy;
- @override
final CoreTypes coreTypes;
final bool isInstanceMember;
@@ -680,12 +676,31 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
return true;
}
+ @override
Expression throwNoSuchMethodError(
String name, Arguments arguments, int charOffset,
{bool isSuper: false, isGetter: false, isSetter: false}) {
- return builder_accessors.throwNoSuchMethodError(
- name, arguments, uri, charOffset, coreTypes,
- isSuper: isSuper, isGetter: isGetter, isSetter: isSetter);
+ String errorName = isSuper ? "super.$name" : name;
+ if (isGetter) {
+ warning("Getter not found: '$errorName'.", charOffset);
ahe 2017/03/22 12:23:23 Note: before I used printUnexpected. This would re
+ } else if (isSetter) {
+ warning("Setter not found: '$errorName'.", charOffset);
+ } else {
+ warning("Method not found: '$errorName'.", charOffset);
ahe 2017/03/22 12:23:23 Note: changed to use errorName.
+ }
+ Constructor constructor =
+ coreTypes.getClass("dart:core", "NoSuchMethodError").constructors.first;
+ return new Throw(new ConstructorInvocation(
+ constructor,
+ new Arguments(<Expression>[
+ new NullLiteral(),
+ new SymbolLiteral(name),
+ new ListLiteral(arguments.positional),
+ new MapLiteral(arguments.named.map((arg) {
+ return new MapEntry(new SymbolLiteral(arg.name), arg.value);
+ }).toList()),
+ new NullLiteral()
+ ])));
}
@override
@@ -1105,7 +1120,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
@override
void handleLiteralDouble(Token token) {
debugEvent("LiteralDouble");
- push(new DoubleLiteral(double.parse(token.lexeme))..fileOffset = token.charOffset);
+ push(new DoubleLiteral(double.parse(token.lexeme))
+ ..fileOffset = token.charOffset);
}
@override
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/builder_accessors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698