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

Side by Side Diff: pkg/compiler/lib/src/js/nodes.dart

Issue 949753004: Avoid printing braces for one-statement blocks in js-printer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix whitespace Created 5 years, 10 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 | Annotate | Revision Log
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 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 class EmptyStatement extends Statement { 253 class EmptyStatement extends Statement {
254 EmptyStatement(); 254 EmptyStatement();
255 255
256 accept(NodeVisitor visitor) => visitor.visitEmptyStatement(this); 256 accept(NodeVisitor visitor) => visitor.visitEmptyStatement(this);
257 void visitChildren(NodeVisitor visitor) {} 257 void visitChildren(NodeVisitor visitor) {}
258 EmptyStatement _clone() => new EmptyStatement(); 258 EmptyStatement _clone() => new EmptyStatement();
259 } 259 }
260 260
261 class If extends Statement { 261 class If extends Statement {
262 final Expression condition; 262 final Expression condition;
263 final Node then; 263 final Statement then;
264 final Node otherwise; 264 final Statement otherwise;
265 265
266 If(this.condition, this.then, this.otherwise); 266 If(this.condition, this.then, this.otherwise);
267 If.noElse(this.condition, this.then) : this.otherwise = new EmptyStatement(); 267 If.noElse(this.condition, this.then) : this.otherwise = new EmptyStatement();
268 268
269 bool get hasElse => otherwise is !EmptyStatement; 269 bool get hasElse => otherwise is !EmptyStatement;
270 270
271 accept(NodeVisitor visitor) => visitor.visitIf(this); 271 accept(NodeVisitor visitor) => visitor.visitIf(this);
272 272
273 void visitChildren(NodeVisitor visitor) { 273 void visitChildren(NodeVisitor visitor) {
274 condition.accept(visitor); 274 condition.accept(visitor);
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 class Comment extends Statement { 1167 class Comment extends Statement {
1168 final String comment; 1168 final String comment;
1169 1169
1170 Comment(this.comment); 1170 Comment(this.comment);
1171 1171
1172 accept(NodeVisitor visitor) => visitor.visitComment(this); 1172 accept(NodeVisitor visitor) => visitor.visitComment(this);
1173 Comment _clone() => new Comment(comment); 1173 Comment _clone() => new Comment(comment);
1174 1174
1175 void visitChildren(NodeVisitor visitor) {} 1175 void visitChildren(NodeVisitor visitor) {}
1176 } 1176 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js/printer.dart » ('j') | pkg/compiler/lib/src/js/printer.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698