Skip to content

Commit

Permalink
Update ModelExtensions.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
LPeter1997 committed Nov 7, 2024
1 parent 8d7c65b commit f46bb86
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions src/Draco.Compiler/Internal/OptimizingIr/Model/ModelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,6 @@ namespace Draco.Compiler.Internal.OptimizingIr.Model;
/// </summary>
internal static class ModelExtensions
{
/// <summary>
/// Looks up the module in an assembly based on the module symbol.
/// </summary>
/// <param name="assembly">The assembly to lookup in.</param>
/// <param name="module">The module to look up.</param>
/// <returns>The looked up module within <paramref name="assembly"/>.</returns>
public static IModule Lookup(this IAssembly assembly, ModuleSymbol module)
{
if (ReferenceEquals(assembly.RootModule.Symbol, module)) return assembly.RootModule;
if (module.ContainingSymbol is not ModuleSymbol containingModule)
{
throw new KeyNotFoundException("the module could not be resolved based on the symbol");
}
var parentModule = Lookup(assembly, containingModule);
return parentModule.Submodules[module];
}

/// <summary>
/// Retrieves all functions that are statically referenced by a given procedure.
/// </summary>
Expand Down

0 comments on commit f46bb86

Please sign in to comment.