CodeAnalyzer merged into MethodAnalyzer

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@909 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 6caafb3940
commit 3523ea6b64
  1. 21
      jode/jode/expr/PutFieldOperator.java

@ -21,26 +21,26 @@ package jode.expr;
import jode.type.Type; import jode.type.Type;
import jode.type.NullType; import jode.type.NullType;
import jode.bytecode.Reference; import jode.bytecode.Reference;
import jode.decompiler.CodeAnalyzer; import jode.decompiler.MethodAnalyzer;
import jode.decompiler.FieldAnalyzer; import jode.decompiler.FieldAnalyzer;
import jode.decompiler.TabbedPrintWriter; import jode.decompiler.TabbedPrintWriter;
import jode.decompiler.Scope; import jode.decompiler.Scope;
public class PutFieldOperator extends LValueExpression { public class PutFieldOperator extends LValueExpression {
CodeAnalyzer codeAnalyzer; MethodAnalyzer methodAnalyzer;
boolean staticFlag; boolean staticFlag;
Reference ref; Reference ref;
Type classType; Type classType;
public PutFieldOperator(CodeAnalyzer codeAnalyzer, boolean staticFlag, public PutFieldOperator(MethodAnalyzer methodAnalyzer, boolean staticFlag,
Reference ref) { Reference ref) {
super(Type.tType(ref.getType())); super(Type.tType(ref.getType()));
this.codeAnalyzer = codeAnalyzer; this.methodAnalyzer = methodAnalyzer;
this.staticFlag = staticFlag; this.staticFlag = staticFlag;
this.ref = ref; this.ref = ref;
this.classType = Type.tType(ref.getClazz()); this.classType = Type.tType(ref.getClazz());
if (staticFlag) if (staticFlag)
codeAnalyzer.useType(classType); methodAnalyzer.useType(classType);
initOperands(staticFlag ? 0 : 1); initOperands(staticFlag ? 0 : 1);
} }
@ -54,13 +54,13 @@ public class PutFieldOperator extends LValueExpression {
* allow super class * allow super class
*/ */
public boolean isThis() { public boolean isThis() {
return (classType.equals(Type.tClass(codeAnalyzer.getClazz()))); return (classType.equals(Type.tClass(methodAnalyzer.getClazz())));
} }
public FieldAnalyzer getField() { public FieldAnalyzer getField() {
if (!isThis()) if (!isThis())
return null; return null;
return codeAnalyzer.getClassAnalyzer() return methodAnalyzer.getClassAnalyzer()
.getField(ref.getName(), Type.tType(ref.getType())); .getField(ref.getName(), Type.tType(ref.getType()));
} }
@ -96,13 +96,14 @@ public class PutFieldOperator extends LValueExpression {
&& subExpressions[0] instanceof ThisOperator; && subExpressions[0] instanceof ThisOperator;
String fieldName = ref.getName(); String fieldName = ref.getName();
if (staticFlag) { if (staticFlag) {
if (!classType.equals(Type.tClass(codeAnalyzer.getClazz())) if (!classType.equals(Type.tClass(methodAnalyzer.getClazz()))
|| codeAnalyzer.findLocal(fieldName) != null) { || methodAnalyzer.findLocal(fieldName) != null) {
writer.printType(classType); writer.printType(classType);
writer.print("."); writer.print(".");
} }
writer.print(fieldName); writer.print(fieldName);
} else if (subExpressions[0].getType() instanceof NullType) { } else if (subExpressions[0].getType().getCanonic()
instanceof NullType) {
writer.print("(("); writer.print("((");
writer.printType(classType); writer.printType(classType);
writer.print(") "); writer.print(") ");

Loading…
Cancel
Save