Fix evaluating array address in IR compiler
This commit is contained in:
parent
6863cdf567
commit
3ea319f7bf
1 changed files with 2 additions and 4 deletions
|
|
@ -536,9 +536,7 @@ namespace pslang::ir
|
||||||
node_ref base_ptr;
|
node_ref base_ptr;
|
||||||
if (array_type)
|
if (array_type)
|
||||||
{
|
{
|
||||||
auto array = apply(*array_access->array);
|
base_ptr = apply_get_address(array_access->array).value();
|
||||||
mcontext.nodes->emplace_back(cast_operation{array, target_pointer_type}, target_pointer_type);
|
|
||||||
base_ptr = last();
|
|
||||||
}
|
}
|
||||||
else // if (pointer_type)
|
else // if (pointer_type)
|
||||||
{
|
{
|
||||||
|
|
@ -611,7 +609,7 @@ namespace pslang::ir
|
||||||
// Evaluating variable initializer didn't produce any nodes
|
// Evaluating variable initializer didn't produce any nodes
|
||||||
// It must have been just a reference to another variable or smth like that
|
// It must have been just a reference to another variable or smth like that
|
||||||
// Introduce a copy node to prevent accidental variable coalescing
|
// Introduce a copy node to prevent accidental variable coalescing
|
||||||
mcontext.nodes->emplace_back(copy{result});
|
mcontext.nodes->emplace_back(copy{result}, node.inferred_type);
|
||||||
result = last();
|
result = last();
|
||||||
}
|
}
|
||||||
lcontext.variables[&node] = result;
|
lcontext.variables[&node] = result;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue