diff --git a/src/Draco.Compiler/Internal/Codegen/MetadataCodegen.cs b/src/Draco.Compiler/Internal/Codegen/MetadataCodegen.cs
index e7a61045e..06c064c03 100644
--- a/src/Draco.Compiler/Internal/Codegen/MetadataCodegen.cs
+++ b/src/Draco.Compiler/Internal/Codegen/MetadataCodegen.cs
@@ -522,7 +522,7 @@ private void EncodeModule(IModule module, TypeDefinitionHandle? parent, ref int
++procIndex;
// We encode every class
- foreach (var @class in module.Types.Values)
+ foreach (var @class in module.Classes.Values)
{
this.EncodeClass(@class, parent: createdModule, fieldIndex: ref fieldIndex, procIndex: ref procIndex);
}
diff --git a/src/Draco.Compiler/Internal/OptimizingIr/Model/IClass.cs b/src/Draco.Compiler/Internal/OptimizingIr/Model/IClass.cs
index f2849551d..018425cde 100644
--- a/src/Draco.Compiler/Internal/OptimizingIr/Model/IClass.cs
+++ b/src/Draco.Compiler/Internal/OptimizingIr/Model/IClass.cs
@@ -3,6 +3,9 @@
namespace Draco.Compiler.Internal.OptimizingIr.Model;
+///
+/// Read-only interface if a
+///
internal interface IClass
{
///
diff --git a/src/Draco.Compiler/Internal/OptimizingIr/Model/IModule.cs b/src/Draco.Compiler/Internal/OptimizingIr/Model/IModule.cs
index 73539fd4b..8831d2d7e 100644
--- a/src/Draco.Compiler/Internal/OptimizingIr/Model/IModule.cs
+++ b/src/Draco.Compiler/Internal/OptimizingIr/Model/IModule.cs
@@ -49,9 +49,9 @@ internal interface IModule
public IReadOnlyDictionary Procedures { get; }
///
- /// The compiled types within this module.
+ /// The compiled classes within this module.
///
- public IReadOnlyDictionary Types { get; }
+ public IReadOnlyDictionary Classes { get; }
///
/// The procedure performing global initialization.
diff --git a/src/Draco.Compiler/Internal/OptimizingIr/Model/Module.cs b/src/Draco.Compiler/Internal/OptimizingIr/Model/Module.cs
index 747ef3bce..a314f43ea 100644
--- a/src/Draco.Compiler/Internal/OptimizingIr/Model/Module.cs
+++ b/src/Draco.Compiler/Internal/OptimizingIr/Model/Module.cs
@@ -19,7 +19,7 @@ internal sealed class Module : IModule
IReadOnlyDictionary IModule.Submodules => this.submodules;
public IDictionary Types => this.types;
- IReadOnlyDictionary IModule.Types => this.types;
+ IReadOnlyDictionary IModule.Classes => this.types;
public IReadOnlySet Fields => this.fields;
public IReadOnlySet Properties => this.properties;
diff --git a/src/Draco.Compiler/Internal/OptimizingIr/Model/Procedure.cs b/src/Draco.Compiler/Internal/OptimizingIr/Model/Procedure.cs
index d9a0ca311..da4e14c54 100644
--- a/src/Draco.Compiler/Internal/OptimizingIr/Model/Procedure.cs
+++ b/src/Draco.Compiler/Internal/OptimizingIr/Model/Procedure.cs
@@ -50,11 +50,10 @@ public Procedure(Module declaringModule, Class? declaringType, FunctionSymbol sy
public int GetParameterIndex(ParameterSymbol symbol)
{
- if (symbol is SourceThisParameterSymbol) return 0;
- var isStaticMethod = symbol.ContainingSymbol.IsStatic;
+ if (symbol.IsThis) return 0;
var idx = this.Symbol.Parameters.IndexOf(symbol);
if (idx == -1) throw new System.ArgumentOutOfRangeException(nameof(symbol));
- return isStaticMethod ? idx : idx + 1;
+ return symbol.ContainingSymbol.IsStatic ? idx : idx + 1;
}
public BasicBlock DefineBasicBlock(LabelSymbol symbol)
diff --git a/src/Draco.Compiler/Internal/Symbols/Error/ErrorThisParameterSymbol.cs b/src/Draco.Compiler/Internal/Symbols/Error/ErrorThisParameterSymbol.cs
index f38453e3f..caa5aa23b 100644
--- a/src/Draco.Compiler/Internal/Symbols/Error/ErrorThisParameterSymbol.cs
+++ b/src/Draco.Compiler/Internal/Symbols/Error/ErrorThisParameterSymbol.cs
@@ -1,6 +1,11 @@
namespace Draco.Compiler.Internal.Symbols.Error;
-internal class ErrorThisParameterSymbol(TypeSymbol type, FunctionSymbol containingSymbol) : ParameterSymbol
+///
+/// An error this parameter symbol.
+///
+///
+///
+internal sealed class ErrorThisParameterSymbol(TypeSymbol type, FunctionSymbol containingSymbol) : ParameterSymbol
{
public override TypeSymbol Type { get; } = type;
public override FunctionSymbol ContainingSymbol { get; } = containingSymbol;
diff --git a/src/Draco.Compiler/Internal/Symbols/FunctionSymbol.cs b/src/Draco.Compiler/Internal/Symbols/FunctionSymbol.cs
index af71c2e64..77ebd1a0c 100644
--- a/src/Draco.Compiler/Internal/Symbols/FunctionSymbol.cs
+++ b/src/Draco.Compiler/Internal/Symbols/FunctionSymbol.cs
@@ -78,7 +78,7 @@ public delegate IOperand CodegenDelegate(
///
/// The receiver of this function, if it has one.
///
- public TypeSymbol? Receiver => this.IsStatic
+ public TypeSymbol? ReceiverType => this.IsStatic
? null
: this.ContainingSymbol as TypeSymbol;
diff --git a/src/Draco.Compiler/Internal/Symbols/ParameterSymbol.cs b/src/Draco.Compiler/Internal/Symbols/ParameterSymbol.cs
index 95f4846ab..d2968d14b 100644
--- a/src/Draco.Compiler/Internal/Symbols/ParameterSymbol.cs
+++ b/src/Draco.Compiler/Internal/Symbols/ParameterSymbol.cs
@@ -18,6 +18,8 @@ internal abstract partial class ParameterSymbol : LocalSymbol
public virtual bool IsVariadic => false;
public override bool IsMutable => false;
+
+ public virtual bool IsThis => false;
// NOTE: Override for covariant return type
public override ParameterSymbol? GenericDefinition => null;
public override SymbolKind Kind => SymbolKind.Parameter;
diff --git a/src/Draco.Compiler/Internal/Symbols/Source/SourceThisParameterSymbol.cs b/src/Draco.Compiler/Internal/Symbols/Source/SourceThisParameterSymbol.cs
index 5c11995ef..b2494a41f 100644
--- a/src/Draco.Compiler/Internal/Symbols/Source/SourceThisParameterSymbol.cs
+++ b/src/Draco.Compiler/Internal/Symbols/Source/SourceThisParameterSymbol.cs
@@ -9,6 +9,7 @@ internal sealed class SourceThisParameterSymbol(FunctionSymbol containingSymbol,
public override string Name => "this";
public override FunctionSymbol ContainingSymbol { get; } = containingSymbol;
public override bool IsVariadic => false;
+ public override bool IsThis => true;
public override ThisParameterSyntax DeclaringSyntax { get; } = syntax;
public override ImmutableArray Attributes => [];