aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/compiler/CodeGen.java
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2005-08-25 05:08:05 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2005-08-25 05:08:05 +0000
commit9366fe08625ceb75692b53cdb9be19dff2ad56c6 (patch)
tree2333f5caf415378b259986177e39078616fc12e0 /src/main/javassist/compiler/CodeGen.java
parent2d60b1690e44dd33553e28618c7c0b25e4b34d9f (diff)
downloadjavassist-9366fe08625ceb75692b53cdb9be19dff2ad56c6.tar.gz
javassist-9366fe08625ceb75692b53cdb9be19dff2ad56c6.zip
Array initializer supports and better annotation supports.
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@196 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/compiler/CodeGen.java')
-rw-r--r--src/main/javassist/compiler/CodeGen.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/javassist/compiler/CodeGen.java b/src/main/javassist/compiler/CodeGen.java
index 9b401804..6739c17a 100644
--- a/src/main/javassist/compiler/CodeGen.java
+++ b/src/main/javassist/compiler/CodeGen.java
@@ -709,13 +709,15 @@ public abstract class CodeGen extends Visitor implements Opcode, TokenId {
*/
ASTree init = d.getInitializer();
if (init != null) {
- doTypeCheck(init);
+ doTypeCheck(init);
atVariableAssign(null, '=', null, d, init, false);
}
}
public abstract void atNewExpr(NewExpr n) throws CompileError;
+ public abstract void atArrayInit(ArrayInit init) throws CompileError;
+
public void atAssignExpr(AssignExpr expr) throws CompileError {
atAssignExpr(expr, true);
}
@@ -770,7 +772,11 @@ public abstract class CodeGen extends Visitor implements Opcode, TokenId {
if (op != '=')
atVariable(var);
- atAssignCore(expr, op, right, varType, varArray, varClass);
+ // expr is null if the caller is atDeclarator().
+ if (expr == null && right instanceof ArrayInit)
+ atArrayVariableAssign((ArrayInit)right, varType, varArray, varClass);
+ else
+ atAssignCore(expr, op, right, varType, varArray, varClass);
if (doDup)
if (is2word(varType, varArray))
@@ -796,6 +802,9 @@ public abstract class CodeGen extends Visitor implements Opcode, TokenId {
className = varClass;
}
+ protected abstract void atArrayVariableAssign(ArrayInit init,
+ int varType, int varArray, String varClass) throws CompileError;
+
private void atArrayAssign(Expr expr, int op, Expr array,
ASTree right, boolean doDup) throws CompileError
{