diff options
author | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2005-03-02 03:42:10 +0000 |
---|---|---|
committer | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2005-03-02 03:42:10 +0000 |
commit | 13ecd1542cc38d7a4699006ad9d7471fa224be0b (patch) | |
tree | b9bd4fa46eb167071e6b457a6f296a0931c87aa6 /src/main/javassist/compiler/Javac.java | |
parent | bf8c6f9ca9884e77b0ea328a7b49a008f7f84c39 (diff) | |
download | javassist-13ecd1542cc38d7a4699006ad9d7471fa224be0b.tar.gz javassist-13ecd1542cc38d7a4699006ad9d7471fa224be0b.zip |
fixed a bug of CtBehavior.insertAt (and a few other minor fixes)
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@162 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/compiler/Javac.java')
-rw-r--r-- | src/main/javassist/compiler/Javac.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main/javassist/compiler/Javac.java b/src/main/javassist/compiler/Javac.java index abeb8290..88ed0ab5 100644 --- a/src/main/javassist/compiler/Javac.java +++ b/src/main/javassist/compiler/Javac.java @@ -201,6 +201,10 @@ public class Javac { Parser p = new Parser(new Lex(src)); SymbolTable stb = new SymbolTable(stable); Stmnt s = p.parseStatement(stb); + if (p.hasMore()) + throw new CompileError( + "the method/constructor body must be surrounded by {}"); + boolean callSuper = false; if (method instanceof CtConstructor) callSuper = !((CtConstructor)method).isClassInitializer(); @@ -311,6 +315,7 @@ public class Javac { * <p>This must be called before calling <code>compileStmnt()</code> and * <code>compileExpr()</code>. The correct value of * <code>isStatic</code> must be recorded before compilation. + * <code>maxLocals</code> is updated to include $0,... */ public int recordParams(CtClass[] params, boolean isStatic) throws CompileError @@ -328,6 +333,7 @@ public class Javac { * <p>This must be called before calling <code>compileStmnt()</code> and * <code>compileExpr()</code>. The correct value of * <code>isStatic</code> must be recorded before compilation. + * <code>maxLocals</code> is updated to include $0,... * * @paaram use0 true if $0 is used. * @param varNo the register number of $0 (use0 is true) @@ -347,6 +353,19 @@ public class Javac { } /** + * Sets <code>maxLocals</code> to <code>max</code>. + * This method tells the compiler the local variables that have been + * allocated for the rest of the code. When the compiler needs + * new local variables, the local variables at the index <code>max</code>, + * <code>max + 1</code>, ... are assigned. + * + * <p>This method is indirectly called by <code>recordParams</code>. + */ + public void setMaxLocals(int max) { + gen.setMaxLocals(max); + } + + /** * Prepares to use cast $r, $w, $_, and $type. * $type is made to represent the specified return type. * It also enables to write a return statement with a return value |