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

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

Issue 2940453002: Add offsets to the `== null` calls inserted by null-aware desugaring. (Closed)
Patch Set: 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
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 59578cedf592ed68c0ea720ce38745bfcbb6d7c6..802486a83232a761e8d2baa5f85d7becec0e0125 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -797,8 +797,10 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
VariableDeclaration variable = new VariableDeclaration.forValue(a);
push(makeLet(
variable,
- new KernelConditionalExpression(buildIsNull(new VariableGet(variable)),
- b, new VariableGet(variable))));
+ new KernelConditionalExpression(
+ buildIsNull(new VariableGet(variable), offsetForToken(token)),
+ b,
+ new VariableGet(variable))));
}
/// Handle `a?.b(...)`.
@@ -3081,7 +3083,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
return makeLet(
variable,
new KernelConditionalExpression(
- buildIsNull(new VariableGet(variable)),
+ buildIsNull(new VariableGet(variable), offset),
new NullLiteral(),
new MethodInvocation(new VariableGet(variable), name, arguments)
..fileOffset = offset));
@@ -3169,7 +3171,8 @@ abstract class ContextAccessor extends FastaAccessor {
return makeInvalidWrite(value);
}
- Expression buildNullAwareAssignment(Expression value, DartType type,
+ Expression buildNullAwareAssignment(
+ Expression value, DartType type, int offset,
{bool voidContext: false}) {
return makeInvalidWrite(value);
}
@@ -3254,7 +3257,8 @@ class DelayedAssignment extends ContextAccessor {
return accessor.buildCompoundAssignment(rightShiftName, value,
offset: offsetForToken(token), voidContext: voidContext);
} else if (identical("??=", assignmentOperator)) {
- return accessor.buildNullAwareAssignment(value, const DynamicType(),
+ return accessor.buildNullAwareAssignment(
+ value, const DynamicType(), offsetForToken(token),
voidContext: voidContext);
} else if (identical("^=", assignmentOperator)) {
return accessor.buildCompoundAssignment(caretName, value,

Powered by Google App Engine
This is Rietveld 408576698