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

Side by Side Diff: pkg/dev_compiler/lib/src/compiler/js_metalet.dart

Issue 2559883002: fixes #28032, await in cascade (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/dev_compiler/test/codegen/language/await_in_cascade_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // TODO(jmesserly): import from its own package 5 // TODO(jmesserly): import from its own package
6 import '../js_ast/js_ast.dart'; 6 import '../js_ast/js_ast.dart';
7 import '../js_ast/precedence.dart'; 7 import '../js_ast/precedence.dart';
8 8
9 import 'js_names.dart' show TemporaryId; 9 import 'js_names.dart' show TemporaryId;
10 10
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 @override 326 @override
327 visitNode(Node node) { 327 visitNode(Node node) {
328 if (!found) super.visitNode(node); 328 if (!found) super.visitNode(node);
329 } 329 }
330 } 330 }
331 331
332 class _YieldFinder extends BaseVisitor { 332 class _YieldFinder extends BaseVisitor {
333 bool hasYield = false; 333 bool hasYield = false;
334 bool hasThis = false; 334 bool hasThis = false;
335 bool _nestedFunction = false; 335 bool _nestedFunction = false;
336
336 @override 337 @override
337 visitThis(This node) { 338 visitThis(This node) {
338 hasThis = true; 339 hasThis = true;
339 } 340 }
340 341
341 @override 342 @override
342 visitFunctionExpression(FunctionExpression node) { 343 visitFunctionExpression(FunctionExpression node) {
343 var savedNested = _nestedFunction; 344 var savedNested = _nestedFunction;
344 _nestedFunction = true; 345 _nestedFunction = true;
345 super.visitFunctionExpression(node); 346 super.visitFunctionExpression(node);
346 _nestedFunction = savedNested; 347 _nestedFunction = savedNested;
347 } 348 }
348 349
349 @override 350 @override
350 visitYield(Yield node) { 351 visitYield(Yield node) {
351 if (!_nestedFunction) hasYield = true; 352 if (!_nestedFunction) hasYield = true;
352 } 353 }
353 354
354 @override 355 @override
355 visitNode(Node node) { 356 visitNode(Node node) {
356 if (!hasYield) super.visitNode(node); 357 if (hasYield && hasThis) return; // found both, nothing more to do.
Jennifer Messerly 2016/12/07 21:57:20 DOH!
358 super.visitNode(node);
357 } 359 }
358 } 360 }
OLDNEW
« no previous file with comments | « no previous file | pkg/dev_compiler/test/codegen/language/await_in_cascade_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698