mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Fix nested hash resolution for access identifiers. Fixes #789
This commit is contained in:
@@ -2824,7 +2824,8 @@ RETRY:
|
||||
{
|
||||
Decl *decl = sema_resolve_symbol(context, child->hash_ident_expr.identifier, NULL, child->span);
|
||||
if (!decl_ok(decl)) return NULL;
|
||||
return sema_expr_resolve_access_child(context, decl->var.init_expr, missing);
|
||||
Expr *expr = copy_expr_single(decl->var.init_expr);
|
||||
return sema_expr_resolve_access_child(decl->var.hash_var.context, expr, missing);
|
||||
}
|
||||
case EXPR_CT_EVAL:
|
||||
{
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define COMPILER_VERSION "0.4.532"
|
||||
#define COMPILER_VERSION "0.4.533"
|
||||
36
test/test_suite/macros/hash_ident_nested.c3t
Normal file
36
test/test_suite/macros/hash_ident_nested.c3t
Normal file
@@ -0,0 +1,36 @@
|
||||
// #target: macos-x64
|
||||
module test;
|
||||
fn void main()
|
||||
{
|
||||
@foo(x);
|
||||
}
|
||||
|
||||
struct Point { float x; float y; }
|
||||
|
||||
macro @foo(#x)
|
||||
{
|
||||
@bar(#x);
|
||||
}
|
||||
|
||||
macro @bar(#x)
|
||||
{
|
||||
Point pt;
|
||||
var z = pt.#x;
|
||||
}
|
||||
|
||||
/* #expect: test.ll
|
||||
|
||||
define void @test.main() #0 {
|
||||
entry:
|
||||
%pt = alloca %Point, align 4
|
||||
%z = alloca float, align 4
|
||||
%0 = getelementptr inbounds %Point, ptr %pt, i32 0, i32 0
|
||||
store float 0.000000e+00, ptr %0, align 4
|
||||
%1 = getelementptr inbounds %Point, ptr %pt, i32 0, i32 1
|
||||
store float 0.000000e+00, ptr %1, align 4
|
||||
%2 = getelementptr inbounds %Point, ptr %pt, i32 0, i32 0
|
||||
%3 = load float, ptr %2, align 4
|
||||
store float %3, ptr %z, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user