Skip to content

Commit

Permalink
Update MetadataCodegen.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
LPeter1997 committed Nov 7, 2024
1 parent b10833e commit 8d7c65b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/Draco.Compiler/Internal/Codegen/MetadataCodegen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,9 @@ Symbol GetContainingSymbol()
{
// We can't have nested functions represented in metadata directly, so we'll climb up the parent chain
// To find the first non-function container
var current = func.ContainingSymbol;
while (current is FunctionSymbol func)
{
current = func.ContainingSymbol;
}
return current!;
return func.AncestorChain
.Skip(1)
.First(s => s is not FunctionSymbol);
}

if (func.ContainingSymbol is not TypeSymbol type) return func.ContainingSymbol!;
Expand Down

0 comments on commit 8d7c65b

Please sign in to comment.