diff options
Diffstat (limited to 'src/main/javassist')
-rw-r--r-- | src/main/javassist/compiler/CodeGen.java | 24 | ||||
-rw-r--r-- | src/main/javassist/compiler/Javac.java | 2 |
2 files changed, 14 insertions, 12 deletions
diff --git a/src/main/javassist/compiler/CodeGen.java b/src/main/javassist/compiler/CodeGen.java index e0b2dfa4..35ca2605 100644 --- a/src/main/javassist/compiler/CodeGen.java +++ b/src/main/javassist/compiler/CodeGen.java @@ -267,18 +267,18 @@ public abstract class CodeGen extends Visitor implements Opcode, TokenId { } } - private boolean needsSuperCall(Stmnt body) { - if (body.getOperator() == BLOCK) { - Stmnt first = (Stmnt)body.head(); - if (first != null && first.getOperator() == EXPR) { - ASTree expr = first.head(); - if (expr != null && expr instanceof Expr - && ((Expr)expr).getOperator() == CALL) { - ASTree target = ((Expr)expr).head(); - if (target instanceof Keyword) { - int token = ((Keyword)target).get(); - return token != THIS && token != SUPER; - } + private boolean needsSuperCall(Stmnt body) throws CompileError { + if (body.getOperator() == BLOCK) + body = (Stmnt)body.head(); + + if (body != null && body.getOperator() == EXPR) { + ASTree expr = body.head(); + if (expr != null && expr instanceof Expr + && ((Expr)expr).getOperator() == CALL) { + ASTree target = ((Expr)expr).head(); + if (target instanceof Keyword) { + int token = ((Keyword)target).get(); + return token != THIS && token != SUPER; } } } diff --git a/src/main/javassist/compiler/Javac.java b/src/main/javassist/compiler/Javac.java index 9ff801ef..de322cdf 100644 --- a/src/main/javassist/compiler/Javac.java +++ b/src/main/javassist/compiler/Javac.java @@ -170,6 +170,8 @@ public class Javac { /** * Compiles a method (or constructor) body. + * + * @src a single statement or a block. */ public Bytecode compileBody(CtBehavior method, String src) throws CompileError |