fixed some bugs for method scoped classes

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1196 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
jochen 25 years ago
parent 761e734973
commit 80e2a7916c
  1. 14
      jode/jode/expr/FieldOperator.java.in
  2. 2
      jode/jode/expr/InvokeOperator.java.in
  3. 19
      jode/jode/flow/TransformConstructors.java

@ -80,15 +80,23 @@ public abstract class FieldOperator extends Operator {
return null;
}
/**
* Returns the field analyzer for the field, if the field is
* declared in the same class or some outer class as the method
* containing this instruction. Otherwise it returns null.
* @return see above.
*/
public FieldAnalyzer getField() {
ClassInfo clazz = getClassInfo();
if (clazz != null) {
ClassAnalyzer ana = methodAnalyzer.getClassAnalyzer();
while (true) {
if (clazz == ana.getClazz()) {
return ana.getField(ana.getFieldIndex
(ref.getName(),
Type.tType(ref.getType())));
int field = ana.getFieldIndex
(ref.getName(), Type.tType(ref.getType()));
if (field >= 0)
return ana.getField(field);
return null;
}
if (ana.getParent() == null)
return null;

@ -825,7 +825,7 @@ public final class InvokeOperator extends Operator
? superClazz : ClassInfo.javaLangObject);
}
outer = getOuterClassInfo(clazz);
if (jikesAnonymousInner
if (jikesAnonymousInner && outer != null
&& outer.outer == null && outer.name != null) {
Expression thisExpr = subExpressions[--length];
if (thisExpr instanceof CheckNullOperator) {

@ -261,7 +261,7 @@ public class TransformConstructors {
/* slot counts from last slot down. */
int start = 1;
if (subExpr.length > 1 && slot > 1) {
if (subExpr.length > 2) {
LocalLoadOperator llop = (LocalLoadOperator) subExpr[1];
if (llop.getLocalInfo().getSlot() == slot) {
@ -344,11 +344,11 @@ public class TransformConstructors {
} else
outerValues.setCount(minOuter);
if (jikesAnon)
outerValues.setJikesAnonymousInner(true);
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_CONSTRS) != 0)
GlobalOptions.err.println(" succeeded: "+outerValues);
if (jikesAnon)
outerValues.setJikesAnonymousInner(true);
cons[0].setAnonymousConstructor(true);
superBlock.removeBlock();
type0Count++;
@ -499,7 +499,9 @@ public class TransformConstructors {
int firstParam = 1;
Expression outer0 = null;
if (maxOuterCount > 0 && outerValues.getCount() > 0) {
if (maxOuterCount > 0
&& methodParams.length > 1
&& outerValues.getCount() > 0) {
/* check if the outerValues[0] param is present.
* we can't be sure if maxOuterCount equals 1, but
* we assume so.
@ -658,6 +660,8 @@ public class TransformConstructors {
int field = clazzAnalyzer.getFieldIndex(pfo.getFieldName(),
pfo.getFieldType());
if (field < 0)
break big_loop;
FieldAnalyzer fieldAna = clazzAnalyzer.getField(field);
/* Don't check for final. Jikes sometimes omits this attribute.
@ -725,10 +729,6 @@ public class TransformConstructors {
public int transformOneField(int lastField, StructuredBlock ib) {
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_CONSTRS) != 0)
GlobalOptions.err.println("fieldInit: "+ib);
if (!(ib instanceof InstructionBlock))
return -1;
@ -770,7 +770,8 @@ public class TransformConstructors {
int field = clazzAnalyzer.getFieldIndex(pfo.getFieldName(),
pfo.getFieldType());
if (field < lastField
// if field does not exists: -1 <= lastField.
if (field <= lastField
|| !(clazzAnalyzer.getField(field).setInitializer(expr))) {
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_CONSTRS) != 0)

Loading…
Cancel
Save