mirror of
https://github.com/odin-lang/Odin.git
synced 2026-07-11 02:19:30 +00:00
Merge pull request #6920 from tf2spi/6674-patch-cmp-anonymous-procs
Add ways to diff anon procs with same signature
This commit is contained in:
@@ -12841,6 +12841,12 @@ gb_internal gbString write_expr_to_string(gbString str, Ast *node, bool shorthan
|
||||
} else {
|
||||
str = gb_string_appendc(str, " ---");
|
||||
}
|
||||
// NOTE(tf2spi):
|
||||
// Two proc literals with the same signature output the same expr above
|
||||
// which poses challenges for name canonicalization. Include the below
|
||||
// discriminator with the file ID and offset to help with this.
|
||||
TokenPos pos = ast_token(node).pos;
|
||||
str = gb_string_append_fmt(str, " /* %d!%d */", pos.file_id, pos.offset);
|
||||
case_end;
|
||||
|
||||
case_ast_node(cl, CompoundLit, node);
|
||||
|
||||
@@ -1067,8 +1067,8 @@ gb_internal bool compare_exact_values(TokenKind op, ExactValue x, ExactValue y)
|
||||
|
||||
case ExactValue_Procedure:
|
||||
switch (op) {
|
||||
case Token_CmpEq: return x.value_typeid == y.value_typeid;
|
||||
case Token_NotEq: return x.value_typeid != y.value_typeid;
|
||||
case Token_CmpEq: return x.value_procedure == y.value_procedure;
|
||||
case Token_NotEq: return x.value_procedure != y.value_procedure;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user