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

Unified Diff: pkg/kernel/lib/transformations/closure/rewriter.dart

Issue 2716573002: closure conversion: Do not set Context.parent if the value is `null` (Closed)
Patch Set: Created 3 years, 10 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/kernel/testcases/closures/capture_closure.dart.expect » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/transformations/closure/rewriter.dart
diff --git a/pkg/kernel/lib/transformations/closure/rewriter.dart b/pkg/kernel/lib/transformations/closure/rewriter.dart
index 6b962fd7b042b92da805e5857c22348db33e307e..6a73dfa5198e2928489a4435a55f49277179db4d 100644
--- a/pkg/kernel/lib/transformations/closure/rewriter.dart
+++ b/pkg/kernel/lib/transformations/closure/rewriter.dart
@@ -72,10 +72,12 @@ class BlockRewriter extends AstRewriter {
void insertContextDeclaration(Class contextClass, Expression accessParent) {
_createDeclaration(contextClass);
_insertStatement(contextDeclaration);
- _insertStatement(new ExpressionStatement(new PropertySet(
- new VariableGet(contextDeclaration),
- new Name('parent'),
- accessParent)));
+ if (accessParent is! NullLiteral) {
+ _insertStatement(new ExpressionStatement(new PropertySet(
+ new VariableGet(contextDeclaration),
+ new Name('parent'),
+ accessParent)));
+ }
}
void insertExtendContext(Expression accessContext, Arguments arguments) {
« no previous file with comments | « no previous file | pkg/kernel/testcases/closures/capture_closure.dart.expect » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698