CatchTreeImpl.java revision 1739:4a6a1fd3d3dd
14Srgrimes/* 21690Sdg * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. 31690Sdg * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41690Sdg * 54Srgrimes * This code is free software; you can redistribute it and/or modify it 64Srgrimes * under the terms of the GNU General Public License version 2 only, as 74Srgrimes * published by the Free Software Foundation. Oracle designates this 84Srgrimes * particular file as subject to the "Classpath" exception as provided 94Srgrimes * by Oracle in the LICENSE file that accompanied this code. 104Srgrimes * 114Srgrimes * This code is distributed in the hope that it will be useful, but WITHOUT 124Srgrimes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 134Srgrimes * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 144Srgrimes * version 2 for more details (a copy is included in the LICENSE file that 154Srgrimes * accompanied this code). 164Srgrimes * 174Srgrimes * You should have received a copy of the GNU General Public License version 184Srgrimes * 2 along with this work; if not, write to the Free Software Foundation, 194Srgrimes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 204Srgrimes * 214Srgrimes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 224Srgrimes * or visit www.oracle.com if you need additional information or have any 234Srgrimes * questions. 244Srgrimes */ 254Srgrimes 264Srgrimespackage jdk.nashorn.api.tree; 274Srgrimes 284Srgrimesimport jdk.nashorn.internal.ir.CatchNode; 294Srgrimes 304Srgrimesfinal class CatchTreeImpl extends TreeImpl implements CatchTree { 314Srgrimes private final ExpressionTree param; 324Srgrimes private final BlockTree block; 334Srgrimes private final ExpressionTree condition; 344Srgrimes 354Srgrimes CatchTreeImpl(final CatchNode node, 364Srgrimes final ExpressionTree param, 37608Srgrimes final BlockTree block, 384Srgrimes final ExpressionTree condition) { 394Srgrimes super(node); 40115683Sobrien this.param = param; 41115683Sobrien this.block = block; 42115683Sobrien this.condition = condition; 434Srgrimes } 441704Sdg 454Srgrimes @Override 464Srgrimes public Kind getKind() { 4771257Speter return Kind.CATCH; 4831544Sjmg } 49147565Speter 5071785Speter @Override 51147674Speter public ExpressionTree getParameter() { 52179277Sjb return param; 5371257Speter } 5432925Seivind 5513203Swollman @Override 561549Srgrimes public BlockTree getBlock() { 5765557Sjasone return block; 581549Srgrimes } 591549Srgrimes 6031564Ssef @Override 61120937Srobert public ExpressionTree getCondition() { 62131936Smarcel return condition; 631549Srgrimes } 6465557Sjasone 6584811Sjhb @Override 6667365Sjhb public <R,D> R accept(final TreeVisitor<R,D> visitor, final D data) { 6731389Sbde return visitor.visitCatch(this, data); 6831389Sbde } 691549Srgrimes} 7064294Sps