|
|
@ -26,6 +26,7 @@ public class GetFieldOperator extends Operator { |
|
|
|
CodeAnalyzer codeAnalyzer; |
|
|
|
CodeAnalyzer codeAnalyzer; |
|
|
|
String fieldName; |
|
|
|
String fieldName; |
|
|
|
Type classType; |
|
|
|
Type classType; |
|
|
|
|
|
|
|
boolean needCast = false; |
|
|
|
|
|
|
|
|
|
|
|
public GetFieldOperator(CodeAnalyzer codeAnalyzer, boolean staticFlag, |
|
|
|
public GetFieldOperator(CodeAnalyzer codeAnalyzer, boolean staticFlag, |
|
|
|
Type classType, Type type, String fieldName) { |
|
|
|
Type classType, Type type, String fieldName) { |
|
|
@ -55,6 +56,8 @@ public class GetFieldOperator extends Operator { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setOperandType(Type types[]) { |
|
|
|
public void setOperandType(Type types[]) { |
|
|
|
|
|
|
|
if (!staticFlag) |
|
|
|
|
|
|
|
needCast = types[0].getTop().equals(Type.tUnknown); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String toString(String[] operands) { |
|
|
|
public String toString(String[] operands) { |
|
|
@ -63,10 +66,12 @@ public class GetFieldOperator extends Operator { |
|
|
|
&& codeAnalyzer.findLocal(fieldName) == null |
|
|
|
&& codeAnalyzer.findLocal(fieldName) == null |
|
|
|
? fieldName |
|
|
|
? fieldName |
|
|
|
: classType.toString() + "." + fieldName) |
|
|
|
: classType.toString() + "." + fieldName) |
|
|
|
: (operands[0].equals("this") |
|
|
|
: (operands[0].equals("null") |
|
|
|
&& codeAnalyzer.findLocal(fieldName) == null |
|
|
|
? "((" + classType + ") null)." + fieldName |
|
|
|
? fieldName |
|
|
|
: (operands[0].equals("this") |
|
|
|
: operands[0] + "." + fieldName); |
|
|
|
&& codeAnalyzer.findLocal(fieldName) == null |
|
|
|
|
|
|
|
? fieldName |
|
|
|
|
|
|
|
: operands[0] + "." + fieldName)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean equals(Object o) { |
|
|
|
public boolean equals(Object o) { |
|
|
|