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

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

Issue 2856893002: Create NullLiteral using AstFactory in BodyBuilder. (Closed)
Patch Set: Created 3 years, 8 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 | no next file » | 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 bce8224077f569f37547c9fc951c795466bcfec5..1e16985c67c2ed34dc7b241c8bad2cf3c7401275 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -474,7 +474,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
bool hasMore = formalBuilders.moveNext();
assert(hasMore);
VariableDeclaration realParameter = formalBuilders.current.target;
- Expression initializer = parameter.initializer ?? new NullLiteral();
+ Expression initializer =
+ parameter.initializer ?? astFactory.nullLiteral(null);
realParameter.initializer = initializer..parent = realParameter;
}
}
@@ -777,13 +778,13 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
return new Throw(new ConstructorInvocation(
constructor,
new Arguments(<Expression>[
- new NullLiteral(),
+ astFactory.nullLiteral(null),
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()
+ astFactory.nullLiteral(null)
])));
}
@@ -865,7 +866,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
library.uri.path == "_builtin" &&
member?.name == "_getMainClosure") {
// TODO(ahe): https://github.com/dart-lang/sdk/issues/28989
- return new NullLiteral()..fileOffset = offsetForToken(token);
+ return astFactory.nullLiteral(token);
} else {
return new UnresolvedAccessor(this, n, token);
}
@@ -1118,7 +1119,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
addCompileTimeError(
token.charOffset, "const field must have initializer.");
// Creating a null value to prevent the Dart VM from crashing.
- push(new NullLiteral()..fileOffset = token.charOffset);
+ push(astFactory.nullLiteral(token));
} else {
push(NullValue.FieldInitializer);
}
@@ -1308,7 +1309,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
@override
void handleLiteralNull(Token token) {
debugEvent("LiteralNull");
- push(new NullLiteral()..fileOffset = token.charOffset);
+ push(astFactory.nullLiteral(token));
}
@override
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698