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

Side by Side Diff: lib/src/js/printer.dart

Issue 1099813006: fixes #146, JS globals were not understood by the renamer (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 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 unified diff | Download patch
« lib/src/codegen/js_names.dart ('K') | « lib/src/codegen/js_names.dart ('k') | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of js_ast; 5 part of js_ast;
6 6
7 7
8 class JavaScriptPrintingOptions { 8 class JavaScriptPrintingOptions {
9 final bool shouldCompressOutput; 9 final bool shouldCompressOutput;
10 final bool minifyLocalVariables; 10 final bool minifyLocalVariables;
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS)); 1378 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS));
1379 } 1379 }
1380 codes.add(charCodes.$0 + digit); 1380 codes.add(charCodes.$0 + digit);
1381 newName = new String.fromCharCodes(codes); 1381 newName = new String.fromCharCodes(codes);
1382 } 1382 }
1383 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName)); 1383 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName));
1384 maps.last[oldName] = newName; 1384 maps.last[oldName] = newName;
1385 return newName; 1385 return newName;
1386 } 1386 }
1387 } 1387 }
1388
1389 /// Like [BaseVisitor], but calls [declare] for [Identifier] declarations, and
1390 /// [visitIdentifier] otherwise.
1391 abstract class VariableDeclarationVisitor<T> extends BaseVisitor<T> {
1392 declare(Identifier node);
1393
1394 visitFunctionExpression(FunctionExpression node) {
1395 for (Identifier param in node.params) declare(param);
1396 node.body.accept(this);
1397 }
1398
1399 visitVariableInitialization(VariableInitialization node) {
1400 declare(node.declaration);
1401 if (node.value != null) node.value.accept(this);
1402 }
1403
1404 visitCatch(Catch node) {
1405 declare(node.declaration);
1406 node.body.accept(this);
1407 }
1408
1409 visitFunctionDeclaration(FunctionDeclaration node) {
1410 declare(node.name);
1411 node.function.accept(this);
1412 }
1413
1414 visitNamedFunction(NamedFunction node) {
1415 declare(node.name);
1416 node.function.accept(this);
1417 }
1418
1419 visitClassExpression(ClassExpression node) {
1420 declare(node.name);
1421 if (node.heritage != null) node.heritage.accept(this);
1422 for (Method element in node.methods) element.accept(this);
1423 }
1424 }
OLDNEW
« lib/src/codegen/js_names.dart ('K') | « lib/src/codegen/js_names.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698