Fixed issue in parsing typed objects in multiple iterations and added test case.
This commit is contained in:
@@ -34,7 +34,7 @@ void parseAndAddConstantDeclarations(Context &context, ast::Domain &domain, ast:
|
||||
tokenizer.skipWhiteSpace();
|
||||
|
||||
// Index on the first element of the current inheritance list
|
||||
size_t inheritanceIndex = 0;
|
||||
size_t inheritanceIndex = constantDeclarations.size();
|
||||
|
||||
while (tokenizer.currentCharacter() != ')')
|
||||
{
|
||||
|
@@ -45,6 +45,7 @@ void parseAndAddPrimitiveTypeDeclarations(Context &context, ast::Domain &domain)
|
||||
tokenizer.skipWhiteSpace();
|
||||
|
||||
const auto position = tokenizer.position();
|
||||
const auto typeStartIndex = domain.types.size();
|
||||
|
||||
// First pass: collect all primitive types
|
||||
while (tokenizer.currentCharacter() != ')')
|
||||
@@ -64,8 +65,9 @@ void parseAndAddPrimitiveTypeDeclarations(Context &context, ast::Domain &domain)
|
||||
|
||||
// Second pass: link parent types correctly
|
||||
// Index on the first element of the current inheritance list
|
||||
size_t inheritanceIndex = 0;
|
||||
size_t i = 0;
|
||||
// TODO: test correct implementation of offset if this function is called multiple times
|
||||
size_t inheritanceIndex = typeStartIndex;
|
||||
size_t i = typeStartIndex;
|
||||
|
||||
while (tokenizer.currentCharacter() != ')')
|
||||
{
|
||||
|
@@ -35,7 +35,7 @@ void parseAndAddVariableDeclarations(Context &context, ast::Domain &domain, ast:
|
||||
tokenizer.skipWhiteSpace();
|
||||
|
||||
// Index on the first element of the current inheritance list
|
||||
size_t inheritanceIndex = 0;
|
||||
size_t inheritanceIndex = variableDeclarations.size();
|
||||
|
||||
while (tokenizer.currentCharacter() != ')')
|
||||
{
|
||||
|
Reference in New Issue
Block a user