Fix computing struct layouts
This commit is contained in:
parent
041513f33e
commit
79101ff3bd
1 changed files with 6 additions and 3 deletions
|
|
@ -858,6 +858,12 @@ namespace pslang::ast
|
||||||
void apply(statement_list & node)
|
void apply(statement_list & node)
|
||||||
{
|
{
|
||||||
populate_globals(lcontext, node);
|
populate_globals(lcontext, node);
|
||||||
|
|
||||||
|
// TODO: compute layouts only in the current scope
|
||||||
|
// Otherwise we're needlessly iterating over all already visited structs
|
||||||
|
for (auto & struct_data : lcontext.structs)
|
||||||
|
compute_layout(lcontext, struct_data.first, struct_data.second);
|
||||||
|
|
||||||
for (auto & statement : node.statements)
|
for (auto & statement : node.statements)
|
||||||
apply(*statement);
|
apply(*statement);
|
||||||
}
|
}
|
||||||
|
|
@ -917,9 +923,6 @@ namespace pslang::ast
|
||||||
local_context lcontext;
|
local_context lcontext;
|
||||||
check_visitor visitor{{}, {}, lcontext};
|
check_visitor visitor{{}, {}, lcontext};
|
||||||
visitor.apply(*root);
|
visitor.apply(*root);
|
||||||
|
|
||||||
for (auto & struct_data : lcontext.structs)
|
|
||||||
compute_layout(lcontext, struct_data.first, struct_data.second);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue