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

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

Issue 2915123002: Improve position information. (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/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 60a7609745060e92c5337669d4d5f134f1f71c62..ed6c955825d767e9fc9e00a86392e28175f9eccf 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -577,7 +577,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
arguments[i] = new NamedExpression(
"#$i",
buildCompileTimeError(
- "Expected named argument.", arguments[i].fileOffset));
+ "Expected named argument.", arguments[i].fileOffset))
+ ..fileOffset = beginToken.charOffset;
}
}
}
@@ -586,9 +587,10 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
arguments.getRange(0, firstNamedArgumentIndex));
List<NamedExpression> named = new List<NamedExpression>.from(
arguments.getRange(firstNamedArgumentIndex, arguments.length));
- push(new KernelArguments(positional, named: named));
+ push(new KernelArguments(positional, named: named)
+ ..fileOffset = beginToken.charOffset);
} else {
- push(new KernelArguments(arguments));
+ push(new KernelArguments(arguments)..fileOffset = beginToken.charOffset);
}
}
@@ -738,14 +740,14 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
/// Handle `a?.b(...)`.
void doIfNotNull(Token token) {
IncompleteSend send = pop();
- push(send.withReceiver(pop(), isNullAware: true));
+ push(send.withReceiver(pop(), token.charOffset, isNullAware: true));
}
void doDotOrCascadeExpression(Token token) {
// TODO(ahe): Handle null-aware.
IncompleteSend send = pop();
Object receiver = optional(".", token) ? pop() : popForValue();
- push(send.withReceiver(receiver));
+ push(send.withReceiver(receiver, token.charOffset));
}
@override
@@ -755,9 +757,12 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
if (target is Procedure) {
if (!target.isAccessor) {
if (areArgumentsCompatible(target.function, node.arguments)) {
- // TODO(ahe): Use [DirectMethodInvocation] when possible.
Expression result = new KernelDirectMethodInvocation(
- new ThisExpression(), target, node.arguments);
+ new ThisExpression()..fileOffset = node.fileOffset,
+ target,
+ node.arguments);
+ // TODO(ahe): Use [DirectMethodInvocation] when possible, that is,
+ // remove the next line:
result =
new KernelSuperMethodInvocation(node.name, node.arguments, null);
return result;
@@ -771,9 +776,10 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
node.name.name, node.arguments, node.fileOffset,
isSuper: true);
}
- // TODO(ahe): Use [DirectPropertyGet] when possible.
- Expression receiver =
- new KernelDirectPropertyGet(new ThisExpression(), target);
+ Expression receiver = new KernelDirectPropertyGet(
+ new ThisExpression()..fileOffset = node.fileOffset, target);
+ // TODO(ahe): Use [DirectPropertyGet] when possible, that is, remove the
+ // next line:
receiver = new KernelSuperPropertyGet(node.name, target);
return buildMethodInvocation(
receiver, callName, node.arguments, node.fileOffset);
@@ -2101,7 +2107,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
debugEvent("NamedArgument");
Expression value = popForValue();
Identifier identifier = pop();
- push(new NamedExpression(identifier.name, value));
+ push(new NamedExpression(identifier.name, value)
+ ..fileOffset = offsetForToken(identifier.token));
}
@override
« no previous file with comments | « pkg/front_end/lib/src/fasta/builder/prefix_builder.dart ('k') | pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698