From 670c6d455322dc366dcfaac7efc150732b9c0fc7 Mon Sep 17 00:00:00 2001 From: LPeter1997 Date: Tue, 19 Nov 2024 22:21:21 +0100 Subject: [PATCH] Naming fixes --- src/Draco.Compiler/Internal/Codegen/MetadataCodegen.cs | 3 ++- src/Draco.Compiler/Internal/Symbols/FunctionSymbol.cs | 4 ++++ .../Internal/Symbols/Synthetized/SynthetizedAliasSymbol.cs | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Draco.Compiler/Internal/Codegen/MetadataCodegen.cs b/src/Draco.Compiler/Internal/Codegen/MetadataCodegen.cs index 0491ce61d..4d1130a94 100644 --- a/src/Draco.Compiler/Internal/Codegen/MetadataCodegen.cs +++ b/src/Draco.Compiler/Internal/Codegen/MetadataCodegen.cs @@ -603,7 +603,8 @@ private MethodDefinitionHandle EncodeProcedure(IProcedure procedure, string? spe var definitionHandle = this.MetadataBuilder.AddMethodDefinition( attributes: attributes, implAttributes: MethodImplAttributes.IL, - name: this.GetOrAddString(specialName ?? procedure.Name), + // TODO: Maybe expose metadata name directly? + name: this.GetOrAddString(specialName ?? procedure.Symbol.MetadataName), signature: this.EncodeProcedureSignature(procedure), bodyOffset: methodBodyOffset, parameterList: parameterList); diff --git a/src/Draco.Compiler/Internal/Symbols/FunctionSymbol.cs b/src/Draco.Compiler/Internal/Symbols/FunctionSymbol.cs index c8598c0a7..37e9ddc22 100644 --- a/src/Draco.Compiler/Internal/Symbols/FunctionSymbol.cs +++ b/src/Draco.Compiler/Internal/Symbols/FunctionSymbol.cs @@ -110,6 +110,10 @@ public delegate IOperand CodegenDelegate( public override bool IsSpecialName => this.IsConstructor; + // NOTE: It seems like the backtick is only for types + // TODO: In that case, maybe move this logic out from Symbol and make MetadataName abstract or default to this instead? + public override string MetadataName => this.Name; + // NOTE: We override for covariant return type public override FunctionSymbol? GenericDefinition => null; public override IEnumerable Members => this.Parameters; diff --git a/src/Draco.Compiler/Internal/Symbols/Synthetized/SynthetizedAliasSymbol.cs b/src/Draco.Compiler/Internal/Symbols/Synthetized/SynthetizedAliasSymbol.cs index 85145ea63..dbf78607c 100644 --- a/src/Draco.Compiler/Internal/Symbols/Synthetized/SynthetizedAliasSymbol.cs +++ b/src/Draco.Compiler/Internal/Symbols/Synthetized/SynthetizedAliasSymbol.cs @@ -5,7 +5,8 @@ namespace Draco.Compiler.Internal.Symbols.Synthetized; /// internal sealed class SynthetizedAliasSymbol(string name, Symbol substitution) : AliasSymbol { - public override string Name { get; } = name; + public override string MetadataName => this.Substitution.MetadataName; + public override string Name => name; public override Symbol Substitution { get; } = substitution; public override Api.Semantics.Visibility Visibility => Api.Semantics.Visibility.Public; }