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

Unified Diff: lib/src/codegen/js_codegen.dart

Issue 1309383003: fix cascade on ThisExpression (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 3 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 | test/browser/language_tests.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/codegen/js_codegen.dart
diff --git a/lib/src/codegen/js_codegen.dart b/lib/src/codegen/js_codegen.dart
index b048129488f94796f9c0cefa422b6b3a01cc1b5a..ea5531697cf0876c3c4a76fd701f621a8c2fb127 100644
--- a/lib/src/codegen/js_codegen.dart
+++ b/lib/src/codegen/js_codegen.dart
@@ -65,7 +65,10 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ClosureAnnotator {
final HashSet<FieldElement> _fieldsNeedingStorage;
/// The variable for the target of the current `..` cascade expression.
- SimpleIdentifier _cascadeTarget;
+ ///
+ /// Usually a [SimpleIdentifier], but it can also be other expressions
+ /// that are safe to evaluate multiple times, such as `this`.
+ Expression _cascadeTarget;
/// The variable for the current catch clause
SimpleIdentifier _catchParameter;
@@ -2516,8 +2519,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ClosureAnnotator {
var savedCascadeTemp = _cascadeTarget;
var vars = <String, JS.Expression>{};
- _cascadeTarget =
- _bindValue(vars, '_', node.target, context: node) as SimpleIdentifier;
+ _cascadeTarget = _bindValue(vars, '_', node.target, context: node);
var sections = _visitList(node.cascadeSections) as List<JS.Expression>;
sections.add(_visit(_cascadeTarget));
var result = new JS.MetaLet(vars, sections, statelessResult: true);
« no previous file with comments | « no previous file | test/browser/language_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698