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 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 newInForInit: false, newAtStatementBegin: false); | 994 newInForInit: false, newAtStatementBegin: false); |
995 // We can skip the trailing "," for the last element (since it's not | 995 // We can skip the trailing "," for the last element (since it's not |
996 // an array hole). | 996 // an array hole). |
997 if (i != elements.length - 1) out(","); | 997 if (i != elements.length - 1) out(","); |
998 } | 998 } |
999 out("]"); | 999 out("]"); |
1000 } | 1000 } |
1001 | 1001 |
1002 @override | 1002 @override |
1003 void visitArrayHole(ArrayHole node) { | 1003 void visitArrayHole(ArrayHole node) { |
1004 throw "Unreachable"; | 1004 context.error("Unreachable"); |
1005 } | 1005 } |
1006 | 1006 |
1007 @override | 1007 @override |
1008 void visitObjectInitializer(ObjectInitializer node) { | 1008 void visitObjectInitializer(ObjectInitializer node) { |
1009 // Print all the properties on one line until we see a function-valued | 1009 // Print all the properties on one line until we see a function-valued |
1010 // property. Ideally, we would use a proper pretty-printer to make the | 1010 // property. Ideally, we would use a proper pretty-printer to make the |
1011 // decision based on layout. | 1011 // decision based on layout. |
1012 List<Property> properties = node.properties; | 1012 List<Property> properties = node.properties; |
1013 out("{"); | 1013 out("{"); |
1014 indentMore(); | 1014 indentMore(); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 } | 1413 } |
1414 } | 1414 } |
1415 | 1415 |
1416 EnterExitNode exitNode(JavaScriptPrintingContext context, int position) { | 1416 EnterExitNode exitNode(JavaScriptPrintingContext context, int position) { |
1417 // Enter must happen before exit. | 1417 // Enter must happen before exit. |
1418 addToNode(context, position); | 1418 addToNode(context, position); |
1419 context.exitNode(node, startPosition, position, closingPosition); | 1419 context.exitNode(node, startPosition, position, closingPosition); |
1420 return parent; | 1420 return parent; |
1421 } | 1421 } |
1422 } | 1422 } |
OLD | NEW |