TypeChecker

- Fixed the `Function` `Container` resolution for the `ReturnStmt` to now find the nearest `parent` in its parenthood tree which is a `Function`, extract the `Function`'s name and then use that where needed
This commit is contained in:
Tristan B. Velloza Kildaire 2023-07-12 09:55:59 +02:00
parent 3e101ac5f8
commit 4c99b56677
1 changed files with 2 additions and 1 deletions

View File

@ -1674,7 +1674,8 @@ public final class TypeChecker
else if(cast(ReturnStmt)statement)
{
ReturnStmt returnStatement = cast(ReturnStmt)statement;
Function funcContainer = cast(Function)statement.parentOf();
Function funcContainer = cast(Function)resolver.findContainerOfType(Function.classinfo, returnStatement);
assert(funcContainer);
string functionName = resolver.generateName(funcContainer.parentOf(), funcContainer);
/* Generated return instruction */