Transforms to ThisOperator

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@745 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 93244afa2c
commit e6cdef6844
  1. 17
      jode/jode/expr/LocalLoadOperator.java

@ -20,15 +20,20 @@
package jode.expr;
import jode.GlobalOptions;
import jode.type.Type;
import jode.decompiler.CodeAnalyzer;
import jode.decompiler.ClassAnalyzer;
import jode.decompiler.LocalInfo;
import jode.decompiler.TabbedPrintWriter;
public class LocalLoadOperator extends NoArgOperator
implements LocalVarOperator {
CodeAnalyzer codeAnalyzer;
LocalInfo local;
public LocalLoadOperator(Type type, LocalInfo local) {
public LocalLoadOperator(Type type, CodeAnalyzer codeAnalyzer,
LocalInfo local) {
super(type);
this.codeAnalyzer = codeAnalyzer;
this.local = local;
local.setType(type);
local.setOperator(this);
@ -87,6 +92,16 @@ public class LocalLoadOperator extends NoArgOperator
((LocalLoadOperator) o).local.getSlot() == local.getSlot());
}
public Expression simplify() {
if (local.getName().equals("this") && codeAnalyzer != null)
return new ThisOperator(codeAnalyzer.getClazz(), true).simplify();
if (local.getName().equals("this$-1") && codeAnalyzer != null)
return new ThisOperator
(((ClassAnalyzer)codeAnalyzer.getClassAnalyzer().getParent())
.getClazz()).simplify();
return super.simplify();
}
public void dumpExpression(TabbedPrintWriter writer,
Expression[] operands)
throws java.io.IOException {

Loading…
Cancel
Save