Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 609 newInForInit: false, newAtStatementBegin: false); | 609 newInForInit: false, newAtStatementBegin: false); |
| 610 spaceOut(); | 610 spaceOut(); |
| 611 out(":"); | 611 out(":"); |
| 612 spaceOut(); | 612 spaceOut(); |
| 613 visitNestedExpression(cond.otherwise, ASSIGNMENT, | 613 visitNestedExpression(cond.otherwise, ASSIGNMENT, |
| 614 newInForInit: inForInit, newAtStatementBegin: false); | 614 newInForInit: inForInit, newAtStatementBegin: false); |
| 615 } | 615 } |
| 616 | 616 |
| 617 visitNew(New node) { | 617 visitNew(New node) { |
| 618 out("new "); | 618 out("new "); |
| 619 visitNestedExpression(node.target, CALL, | 619 visitNestedExpression(node.target, ACCESS, |
|
Jennifer Messerly
2015/04/01 00:32:35
this is important in ES6 at least:
`new foo()()`
| |
| 620 newInForInit: inForInit, newAtStatementBegin: false); | 620 newInForInit: inForInit, newAtStatementBegin: false); |
| 621 out("("); | 621 out("("); |
| 622 visitCommaSeparated(node.arguments, ASSIGNMENT, | 622 visitCommaSeparated(node.arguments, ASSIGNMENT, |
| 623 newInForInit: false, newAtStatementBegin: false); | 623 newInForInit: false, newAtStatementBegin: false); |
| 624 out(")"); | 624 out(")"); |
| 625 } | 625 } |
| 626 | 626 |
| 627 visitCall(Call call) { | 627 visitCall(Call call) { |
| 628 visitNestedExpression(call.target, LEFT_HAND_SIDE, | 628 visitNestedExpression(call.target, LEFT_HAND_SIDE, |
| 629 newInForInit: inForInit, | 629 newInForInit: inForInit, |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1365 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS)); | 1365 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS)); |
| 1366 } | 1366 } |
| 1367 codes.add(charCodes.$0 + digit); | 1367 codes.add(charCodes.$0 + digit); |
| 1368 newName = new String.fromCharCodes(codes); | 1368 newName = new String.fromCharCodes(codes); |
| 1369 } | 1369 } |
| 1370 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName)); | 1370 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName)); |
| 1371 maps.last[oldName] = newName; | 1371 maps.last[oldName] = newName; |
| 1372 return newName; | 1372 return newName; |
| 1373 } | 1373 } |
| 1374 } | 1374 } |
| OLD | NEW |