Fixed highlighting calculating sizes wrongly
This commit is contained in:
parent
00cf8ecb18
commit
761522a540
@ -139,7 +139,7 @@ namespace hex {
|
|||||||
|
|
||||||
s32 ViewPattern::highlightUsingDecls(std::vector<lang::ASTNode*> &ast, lang::ASTNodeTypeDecl* currTypeDeclNode, lang::ASTNodeVariableDecl* currVarDecl, u64 offset) {
|
s32 ViewPattern::highlightUsingDecls(std::vector<lang::ASTNode*> &ast, lang::ASTNodeTypeDecl* currTypeDeclNode, lang::ASTNodeVariableDecl* currVarDecl, u64 offset) {
|
||||||
if (currTypeDeclNode->getAssignedType() != lang::Token::TypeToken::Type::CustomType) {
|
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());
|
this->setHighlight(offset, size, currVarDecl->getVariableName());
|
||||||
offset += size;
|
offset += size;
|
||||||
@ -191,19 +191,22 @@ namespace hex {
|
|||||||
offset += size;
|
offset += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
offset += size;
|
|
||||||
foundType = true;
|
foundType = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &typeDeclNode : findNodes<lang::ASTNodeTypeDecl>(lang::ASTNode::Type::TypeDecl, ast))
|
for (auto &typeDeclNode : findNodes<lang::ASTNodeTypeDecl>(lang::ASTNode::Type::TypeDecl, ast))
|
||||||
if (typeDeclNode->getTypeName() == var->getCustomVariableTypeName()) {
|
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)
|
if (size == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
offset = size;
|
offset += size;
|
||||||
|
}
|
||||||
|
|
||||||
foundType = true;
|
foundType = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user