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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js/nodes.dart

Issue 80053004: Nicer pretty printing of jsAst object literals. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated tests Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/js/printer.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) 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 abstract class NodeVisitor<T> { 7 abstract class NodeVisitor<T> {
8 T visitProgram(Program node); 8 T visitProgram(Program node);
9 9
10 T visitBlock(Block node); 10 T visitBlock(Block node);
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 918
919 accept(NodeVisitor visitor) => visitor.visitArrayElement(this); 919 accept(NodeVisitor visitor) => visitor.visitArrayElement(this);
920 920
921 void visitChildren(NodeVisitor visitor) { 921 void visitChildren(NodeVisitor visitor) {
922 value.accept(visitor); 922 value.accept(visitor);
923 } 923 }
924 } 924 }
925 925
926 class ObjectInitializer extends Expression { 926 class ObjectInitializer extends Expression {
927 List<Property> properties; 927 List<Property> properties;
928 bool isOneLiner;
928 929
929 ObjectInitializer(this.properties); 930 /**
931 * Constructs a new object-initializer containing the given [properties].
932 *
933 * [isOneLiner] describes the behaviour when pretty-printing (non-minified).
934 * If true print all properties on the same line.
935 * If false print each property on a seperate line.
936 */
937 ObjectInitializer(this.properties, {this.isOneLiner: true});
930 938
931 accept(NodeVisitor visitor) => visitor.visitObjectInitializer(this); 939 accept(NodeVisitor visitor) => visitor.visitObjectInitializer(this);
932 940
933 void visitChildren(NodeVisitor visitor) { 941 void visitChildren(NodeVisitor visitor) {
934 for (Property init in properties) init.accept(visitor); 942 for (Property init in properties) init.accept(visitor);
935 } 943 }
936 944
937 int get precedenceLevel => PRIMARY; 945 int get precedenceLevel => PRIMARY;
938 } 946 }
939 947
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 */ 1016 */
1009 class Comment extends Statement { 1017 class Comment extends Statement {
1010 final String comment; 1018 final String comment;
1011 1019
1012 Comment(this.comment); 1020 Comment(this.comment);
1013 1021
1014 accept(NodeVisitor visitor) => visitor.visitComment(this); 1022 accept(NodeVisitor visitor) => visitor.visitComment(this);
1015 1023
1016 void visitChildren(NodeVisitor visitor) {} 1024 void visitChildren(NodeVisitor visitor) {}
1017 } 1025 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/js/printer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698