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

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

Issue 1036333003: Fix try catch crasher bug due to null else case. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | test/codegen/expect/try_catch.js » ('j') | test/codegen/try_catch.dart » ('J')
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_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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 accept(NodeVisitor visitor) => visitor.visitEmptyStatement(this); 268 accept(NodeVisitor visitor) => visitor.visitEmptyStatement(this);
269 void visitChildren(NodeVisitor visitor) {} 269 void visitChildren(NodeVisitor visitor) {}
270 EmptyStatement _clone() => new EmptyStatement(); 270 EmptyStatement _clone() => new EmptyStatement();
271 } 271 }
272 272
273 class If extends Statement { 273 class If extends Statement {
274 final Expression condition; 274 final Expression condition;
275 final Node then; 275 final Node then;
276 final Node otherwise; 276 final Node otherwise;
277 277
278 If(this.condition, this.then, this.otherwise); 278 If(this.condition, this.then, Node otherwise) :
Jacob 2015/03/27 17:04:30 We could alternately make this constructor assert
Jennifer Messerly 2015/03/27 17:15:54 Agreed. Another option would be to just have null
279 otherwise = otherwise != null ? otherwise : new EmptyStatement();
279 If.noElse(this.condition, this.then) : this.otherwise = new EmptyStatement(); 280 If.noElse(this.condition, this.then) : this.otherwise = new EmptyStatement();
280 281
281 bool get hasElse => otherwise is !EmptyStatement; 282 bool get hasElse => otherwise is !EmptyStatement;
282 283
283 accept(NodeVisitor visitor) => visitor.visitIf(this); 284 accept(NodeVisitor visitor) => visitor.visitIf(this);
284 285
285 void visitChildren(NodeVisitor visitor) { 286 void visitChildren(NodeVisitor visitor) {
286 condition.accept(visitor); 287 condition.accept(visitor);
287 then.accept(visitor); 288 then.accept(visitor);
288 otherwise.accept(visitor); 289 otherwise.accept(visitor);
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 final Expression expression; 1341 final Expression expression;
1341 1342
1342 CommentExpression(this.comment, this.expression); 1343 CommentExpression(this.comment, this.expression);
1343 1344
1344 int get precedenceLevel => PRIMARY; 1345 int get precedenceLevel => PRIMARY;
1345 accept(NodeVisitor visitor) => visitor.visitCommentExpression(this); 1346 accept(NodeVisitor visitor) => visitor.visitCommentExpression(this);
1346 CommentExpression _clone() => new CommentExpression(comment, expression); 1347 CommentExpression _clone() => new CommentExpression(comment, expression);
1347 1348
1348 void visitChildren(NodeVisitor visitor) => expression.accept(visitor); 1349 void visitChildren(NodeVisitor visitor) => expression.accept(visitor);
1349 } 1350 }
OLDNEW
« no previous file with comments | « no previous file | test/codegen/expect/try_catch.js » ('j') | test/codegen/try_catch.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698