diff options
author | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2004-09-01 07:45:32 +0000 |
---|---|---|
committer | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2004-09-01 07:45:32 +0000 |
commit | 9b3b5570519634919030492e4dd9562cdd64d9a4 (patch) | |
tree | 3018b61fb489b3cc8e92f99267db49ab35cc600f /src/main/javassist/compiler/MemberCodeGen.java | |
parent | 4fda748aa5e0fcc4d0207169209062399fe2aa81 (diff) | |
download | javassist-9b3b5570519634919030492e4dd9562cdd64d9a4.tar.gz javassist-9b3b5570519634919030492e4dd9562cdd64d9a4.zip |
modified the code generator to compute constant expressions at compile time.
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@130 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/compiler/MemberCodeGen.java')
-rw-r--r-- | src/main/javassist/compiler/MemberCodeGen.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/javassist/compiler/MemberCodeGen.java b/src/main/javassist/compiler/MemberCodeGen.java index a4e69f59..14e14438 100644 --- a/src/main/javassist/compiler/MemberCodeGen.java +++ b/src/main/javassist/compiler/MemberCodeGen.java @@ -627,7 +627,13 @@ public class MemberCodeGen extends CodeGen { { CtField f = fieldAccess(expr); boolean is_static = resultStatic; - atFieldRead(f, is_static); + ASTree cexpr = TypeChecker.getConstantFieldValue(f); + if (cexpr == null) + atFieldRead(f, is_static); + else { + cexpr.accept(this); + setFieldType(f.getFieldInfo2()); + } } /** |