diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-08-17 15:07:22 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-08-17 15:07:22 -0400 |
| commit | 37669b1734b7cc2daf3b1755c6a3c985adb896f8 (patch) | |
| tree | 35bf0e4cc7b40d5c7435c340114157a5bd7cc85a /structs.c | |
| parent | de31398fe474d4c53bc1f1078077146ab52dd8d8 (diff) | |
Bugfix for Int64$hash() being referenced
Diffstat (limited to 'structs.c')
| -rw-r--r-- | structs.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -148,11 +148,20 @@ void compile_struct_def(env_t *env, ast_t *ast) typeinfo = CORD_all(typeinfo, ".compare=(void*)", type_to_cord(member_t), "$compare, " ".equal=(void*)", type_to_cord(member_t), "$equal, "); goto got_methods; - case TextType: case IntType: + case TextType: typeinfo = CORD_all(typeinfo, ".hash=(void*)", type_to_cord(member_t), "$hash", ", ", ".compare=(void*)", type_to_cord(member_t), "$compare, " ".equal=(void*)", type_to_cord(member_t), "$equal, "); goto got_methods; + case IntType: + if (Match(member_t, IntType)->bits == 0) + typeinfo = CORD_all(typeinfo, ".hash=(void*)Int$hash", ", ", + ".compare=(void*)Int$compare, " + ".equal=(void*)Int$equal, "); + else + typeinfo = CORD_all(typeinfo, ".compare=(void*)", type_to_cord(member_t), "$compare, " + ".equal=(void*)", type_to_cord(member_t), "$equal, "); + goto got_methods; case BoolType: goto got_methods; default: break; } |
