Skip to content

Commit

Permalink
Fix properties with getter/setters
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitalita committed Feb 4, 2023
1 parent e162be7 commit 9f1c3b3
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Decompiler/PscCoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,18 +177,18 @@ void Decompiler::PscCoder::writeObject(const Pex::Object &object, const Pex::Bin
writeStructs(object, pex);
}

if (object.getProperties().size()) {
write("");
write(";-- Properties --------------------------------------");
writeProperties(object, pex);
}

if (object.getVariables().size()) {
write("");
write(";-- Variables ---------------------------------------");
writeVariables(object, pex);
}

if (object.getProperties().size()) {
write("");
write(";-- Properties --------------------------------------");
writeProperties(object, pex);
}

writeStates(object, pex);
}

Expand Down Expand Up @@ -339,7 +339,8 @@ void Decompiler::PscCoder::writeProperty(int i, const Pex::Property& prop, const
!prop.isWritable() &&
prop.getReadFunction().getInstructions().size() == 1 &&
prop.getReadFunction().getInstructions()[0].getOpCode() == Pex::OpCode::RETURN &&
prop.getReadFunction().getInstructions()[0].getArgs().size() == 1;
prop.getReadFunction().getInstructions()[0].getArgs().size() == 1 &&
prop.getReadFunction().getInstructions()[0].getArgs()[0].getType() != Pex::ValueType::Identifier;
stream << mapType(prop.getTypeName().asString()) << " Property " << prop.getName().asString();
if (prop.hasAutoVar()) {
auto var = object.getVariables().findByName(prop.getAutoVarName());
Expand Down

0 comments on commit 9f1c3b3

Please sign in to comment.