Skip to content

Commit

Permalink
Compare identifers in traits.d only by their toString thereby enablin…
Browse files Browse the repository at this point in the history
…g use of switch statements
  • Loading branch information
nordlow committed Aug 19, 2024
1 parent c5496ff commit da7b823
Show file tree
Hide file tree
Showing 2 changed files with 1,422 additions and 1,401 deletions.
8 changes: 7 additions & 1 deletion compiler/src/dmd/identifier.d
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ nothrow:

extern (D) private this(const(char)[] name, int value, bool isAnonymous) @safe
{
//printf("Identifier('%.*s', %d, %d)\n", cast(int)name.length, name.ptr, value, isAnonymous);
// () @trusted { printf("Identifier('%.*s', %d, %d, %p)\n", cast(int)name.length, name.ptr, value, isAnonymous, this); }();
this.name = name;
this.value = value;
isAnonymous_ = isAnonymous;
Expand Down Expand Up @@ -409,4 +409,10 @@ nothrow:
{
stringtable._init(28_000);
}

version (none)
bool opEquals(const scope typeof(this) rhs) const scope @safe pure nothrow @nogc
{
return value == rhs.value && isAnonymous_ == rhs.isAnonymous_ && name is rhs.name;
}
}
Loading

0 comments on commit da7b823

Please sign in to comment.