| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 package com.google.dart.compiler.backend.js.ast; | |
| 6 | |
| 7 import java.util.ArrayList; | |
| 8 import java.util.List; | |
| 9 | |
| 10 /** | |
| 11 * A JavaScript <code>try</code> statement. | |
| 12 */ | |
| 13 public class JsTry extends JsStatement { | |
| 14 | |
| 15 private final List<JsCatch> catches = new ArrayList<JsCatch>(); | |
| 16 private JsBlock finallyBlock; | |
| 17 private JsBlock tryBlock; | |
| 18 | |
| 19 public JsTry() { | |
| 20 super(); | |
| 21 } | |
| 22 | |
| 23 public List<JsCatch> getCatches() { | |
| 24 return catches; | |
| 25 } | |
| 26 | |
| 27 public JsBlock getFinallyBlock() { | |
| 28 return finallyBlock; | |
| 29 } | |
| 30 | |
| 31 public JsBlock getTryBlock() { | |
| 32 return tryBlock; | |
| 33 } | |
| 34 | |
| 35 public void setFinallyBlock(JsBlock block) { | |
| 36 this.finallyBlock = block; | |
| 37 } | |
| 38 | |
| 39 public void setTryBlock(JsBlock block) { | |
| 40 tryBlock = block; | |
| 41 } | |
| 42 | |
| 43 @Override | |
| 44 public void traverse(JsVisitor v, JsContext ctx) { | |
| 45 if (v.visit(this, ctx)) { | |
| 46 tryBlock = v.accept(tryBlock); | |
| 47 v.acceptWithInsertRemove(catches); | |
| 48 if (finallyBlock != null) { | |
| 49 finallyBlock = v.accept(finallyBlock); | |
| 50 } | |
| 51 } | |
| 52 v.endVisit(this, ctx); | |
| 53 } | |
| 54 | |
| 55 @Override | |
| 56 public NodeKind getKind() { | |
| 57 return NodeKind.TRY; | |
| 58 } | |
| 59 } | |
| OLD | NEW |