diff options
author | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2005-06-23 16:47:14 +0000 |
---|---|---|
committer | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2005-06-23 16:47:14 +0000 |
commit | cb8fe912651b896794f4b4211fe4a74d7781a647 (patch) | |
tree | a4f0ef6cc43c00dbcd8a880bec856cd4e7f38bcf /src/main/javassist/compiler/CodeGen.java | |
parent | aa0900d4cf6479bc598951ea446ea3f5f95a23b6 (diff) | |
download | javassist-cb8fe912651b896794f4b4211fe4a74d7781a647.tar.gz javassist-cb8fe912651b896794f4b4211fe4a74d7781a647.zip |
fixed a bug of the compiler
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@185 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/compiler/CodeGen.java')
-rw-r--r-- | src/main/javassist/compiler/CodeGen.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/javassist/compiler/CodeGen.java b/src/main/javassist/compiler/CodeGen.java index 10def2e6..fe74e281 100644 --- a/src/main/javassist/compiler/CodeGen.java +++ b/src/main/javassist/compiler/CodeGen.java @@ -1077,6 +1077,8 @@ public abstract class CodeGen extends Visitor implements Opcode, TokenId { if (op == EQ) { // ==, !=, ... BinExpr bexpr = (BinExpr)expr; int type1 = compileOprands(bexpr); + // here, arrayDim might represent the array dim. of the left oprand + // if the right oprand is NULL. compareExpr(branchIf, bexpr.getOperator(), type1, bexpr); } else if (op == '!') @@ -1143,8 +1145,11 @@ public abstract class CodeGen extends Visitor implements Opcode, TokenId { int type1 = exprType; int dim1 = arrayDim; expr.oprand2().accept(this); - if (dim1 != arrayDim && type1 != NULL && exprType != NULL) - throw new CompileError("incompatible array types"); + if (dim1 != arrayDim) + if (type1 != NULL && exprType != NULL) + throw new CompileError("incompatible array types"); + else if (exprType == NULL) + arrayDim = dim1; if (type1 == NULL) return exprType; |