1
0
mirror of synced 2024-11-25 00:00:27 +01:00

Fixed highlighting calculating sizes wrongly

This commit is contained in:
WerWolv 2020-11-13 00:42:29 +01:00
parent 00cf8ecb18
commit 761522a540

View File

@ -139,7 +139,7 @@ namespace hex {
s32 ViewPattern::highlightUsingDecls(std::vector<lang::ASTNode*> &ast, lang::ASTNodeTypeDecl* currTypeDeclNode, lang::ASTNodeVariableDecl* currVarDecl, u64 offset) {
if (currTypeDeclNode->getAssignedType() != lang::Token::TypeToken::Type::CustomType) {
size_t size = (static_cast<u32>(currTypeDeclNode->getAssignedType()) >> 4) * currVarDecl->getArraySize();
size_t size = (static_cast<u32>(currTypeDeclNode->getAssignedType()) >> 4);
this->setHighlight(offset, size, currVarDecl->getVariableName());
offset += size;
@ -191,19 +191,22 @@ namespace hex {
offset += size;
}
offset += size;
foundType = true;
break;
}
for (auto &typeDeclNode : findNodes<lang::ASTNodeTypeDecl>(lang::ASTNode::Type::TypeDecl, ast))
if (typeDeclNode->getTypeName() == var->getCustomVariableTypeName()) {
auto size = this->highlightUsingDecls(ast, typeDeclNode, var, offset);
size_t size = 0;
for (size_t i = 0; i < var->getArraySize(); i++) {
size = this->highlightUsingDecls(ast, typeDeclNode, var, offset);
if (size == -1)
return -1;
offset = size;
offset += size;
}
foundType = true;
break;
}