Skip to content

Commit

Permalink
Naming fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
LPeter1997 committed Nov 19, 2024
1 parent bf23220 commit 670c6d4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Draco.Compiler/Internal/Codegen/MetadataCodegen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/Draco.Compiler/Internal/Symbols/FunctionSymbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Symbol> Members => this.Parameters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ namespace Draco.Compiler.Internal.Symbols.Synthetized;
/// </summary>
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;
}

0 comments on commit 670c6d4

Please sign in to comment.