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; | 5 part of js; |
6 | 6 |
7 class Printer extends Indentation implements NodeVisitor { | 7 class Printer extends Indentation implements NodeVisitor { |
8 final bool shouldCompressOutput; | 8 final bool shouldCompressOutput; |
9 leg.DiagnosticListener diagnosticListener; | 9 leg.DiagnosticListener diagnosticListener; |
10 CodeBuffer outBuffer; | 10 CodeBuffer outBuffer; |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 outIndent("return"); | 348 outIndent("return"); |
349 } else { | 349 } else { |
350 outIndent("return"); | 350 outIndent("return"); |
351 pendingSpace = true; | 351 pendingSpace = true; |
352 visitNestedExpression(node.value, EXPRESSION, | 352 visitNestedExpression(node.value, EXPRESSION, |
353 newInForInit: false, newAtStatementBegin: false); | 353 newInForInit: false, newAtStatementBegin: false); |
354 } | 354 } |
355 outSemicolonLn(); | 355 outSemicolonLn(); |
356 } | 356 } |
357 | 357 |
| 358 visitYield(Yield node) { |
| 359 if (node.hasStar) { |
| 360 outIndent("yield*"); |
| 361 } else { |
| 362 outIndent("yield"); |
| 363 } |
| 364 pendingSpace = true; |
| 365 visitNestedExpression(node.expression, EXPRESSION, |
| 366 newInForInit: false, newAtStatementBegin: false); |
| 367 outSemicolonLn(); |
| 368 } |
| 369 |
| 370 |
358 visitThrow(Throw node) { | 371 visitThrow(Throw node) { |
359 outIndent("throw"); | 372 outIndent("throw"); |
360 pendingSpace = true; | 373 pendingSpace = true; |
361 visitNestedExpression(node.expression, EXPRESSION, | 374 visitNestedExpression(node.expression, EXPRESSION, |
362 newInForInit: false, newAtStatementBegin: false); | 375 newInForInit: false, newAtStatementBegin: false); |
363 outSemicolonLn(); | 376 outSemicolonLn(); |
364 } | 377 } |
365 | 378 |
366 visitTry(Try node) { | 379 visitTry(Try node) { |
367 outIndent("try"); | 380 outIndent("try"); |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS)); | 1202 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS)); |
1190 } | 1203 } |
1191 codes.add(charCodes.$0 + digit); | 1204 codes.add(charCodes.$0 + digit); |
1192 newName = new String.fromCharCodes(codes); | 1205 newName = new String.fromCharCodes(codes); |
1193 } | 1206 } |
1194 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName)); | 1207 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName)); |
1195 maps.last[oldName] = newName; | 1208 maps.last[oldName] = newName; |
1196 return newName; | 1209 return newName; |
1197 } | 1210 } |
1198 } | 1211 } |
OLD | NEW |