From e6cdef6844c72d5c9bb3b310ae05c1b544082597 Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 3 May 1999 10:56:52 +0000 Subject: [PATCH] Transforms to ThisOperator git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@745 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/expr/LocalLoadOperator.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/jode/jode/expr/LocalLoadOperator.java b/jode/jode/expr/LocalLoadOperator.java index 62c595b..a05e854 100644 --- a/jode/jode/expr/LocalLoadOperator.java +++ b/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 {