com.dragome.compiler.ast.ExceptionHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dragome-bytecode-js-compiler Show documentation
Show all versions of dragome-bytecode-js-compiler Show documentation
Dragome SDK module: bytecode to javascript compiler
package com.dragome.compiler.ast;
import org.apache.bcel.Constants;
import org.apache.bcel.classfile.CodeException;
import org.apache.bcel.classfile.ConstantPool;
import org.apache.bcel.generic.Type;
public class ExceptionHandler extends ASTNode
{
private CodeException codeException;
public ExceptionHandler(CodeException theCodeException)
{
codeException= theCodeException;
}
public int getStartPC()
{
return codeException.getStartPC();
}
public int getEndPC()
{
return codeException.getEndPC();
}
public int getHandlerPC()
{
return codeException.getHandlerPC();
}
public Type getCatchType(ConstantPool cp)
{
if (codeException.getCatchType() == 0)
return null;
String signature= cp.getConstantString(codeException.getCatchType(), Constants.CONSTANT_Class);
return Type.getType("L" + signature + ";");
}
public boolean isDefault()
{
return codeException.getCatchType() == 0;
}
}