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

Side by Side Diff: lib/src/codegen/js_metalet.dart

Issue 1266483003: format with dart_style 0.2.0-rc.3 (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | lib/src/codegen/js_module_item_order.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 library dev_compiler.src.codegen.js_metalet; 5 library dev_compiler.src.codegen.js_metalet;
6 6
7 // TODO(jmesserly): import from its own package 7 // TODO(jmesserly): import from its own package
8 import 'package:dev_compiler/src/js/js_ast.dart'; 8 import 'package:dev_compiler/src/js/js_ast.dart';
9 import 'package:dev_compiler/src/js/precedence.dart'; 9 import 'package:dev_compiler/src/js/precedence.dart';
10 10
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 } 250 }
251 251
252 class _IdentFinder extends BaseVisitor { 252 class _IdentFinder extends BaseVisitor {
253 final String name; 253 final String name;
254 bool found = false; 254 bool found = false;
255 _IdentFinder(this.name); 255 _IdentFinder(this.name);
256 256
257 @override visitIdentifier(Identifier node) { 257 @override visitIdentifier(Identifier node) {
258 if (node.name == name) found = true; 258 if (node.name == name) found = true;
259 } 259 }
260
260 @override visitNode(Node node) { 261 @override visitNode(Node node) {
261 if (!found) super.visitNode(node); 262 if (!found) super.visitNode(node);
262 } 263 }
263 } 264 }
264 265
265 class _YieldFinder extends BaseVisitor { 266 class _YieldFinder extends BaseVisitor {
266 bool hasYield = false; 267 bool hasYield = false;
267 bool hasThis = false; 268 bool hasThis = false;
268 bool _nestedFunction = false; 269 bool _nestedFunction = false;
269 @override visitThis(This node) { 270 @override visitThis(This node) {
270 hasThis = true; 271 hasThis = true;
271 } 272 }
273
272 @override visitFunctionExpression(FunctionExpression node) { 274 @override visitFunctionExpression(FunctionExpression node) {
273 var savedNested = _nestedFunction; 275 var savedNested = _nestedFunction;
274 _nestedFunction = true; 276 _nestedFunction = true;
275 super.visitFunctionExpression(node); 277 super.visitFunctionExpression(node);
276 _nestedFunction = savedNested; 278 _nestedFunction = savedNested;
277 } 279 }
280
278 @override visitYield(Yield node) { 281 @override visitYield(Yield node) {
279 if (!_nestedFunction) hasYield = true; 282 if (!_nestedFunction) hasYield = true;
280 } 283 }
284
281 @override visitNode(Node node) { 285 @override visitNode(Node node) {
282 if (!hasYield) super.visitNode(node); 286 if (!hasYield) super.visitNode(node);
283 } 287 }
284 } 288 }
OLDNEW
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | lib/src/codegen/js_module_item_order.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698