mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Lambdas on the top level were not exported by default. #2428
This commit is contained in:
@@ -61,6 +61,7 @@
|
||||
- `Socket.get_option` didn't properly call `getsockopt`, and `getsockopt` had an invalid signature.
|
||||
- Taking the address of a label would cause a crash. #2430
|
||||
- `@tag` was not allowed to repeat.
|
||||
- Lambdas on the top level were not exported by default. #2428
|
||||
|
||||
### Stdlib changes
|
||||
- Add `==` to `Pair`, `Triple` and TzDateTime. Add print to `Pair` and `Triple`.
|
||||
|
||||
@@ -44,10 +44,6 @@ void llvm_value_set(BEValue *value, LLVMValueRef llvm_value, Type *type)
|
||||
|
||||
void llvm_value_set_address(GenContext *c, BEValue *value, LLVMValueRef llvm_value, Type *type, AlignSize alignment)
|
||||
{
|
||||
if (alignment == 0)
|
||||
{
|
||||
puts("TODO");
|
||||
}
|
||||
ASSERT(alignment > 0);
|
||||
if (LLVMIsAGlobalVariable(llvm_value) && LLVMIsThreadLocal(llvm_value))
|
||||
{
|
||||
|
||||
@@ -10218,6 +10218,7 @@ static inline bool sema_expr_analyse_lambda(SemaContext *context, Type *target_t
|
||||
{
|
||||
decl->var.is_read = true;
|
||||
}
|
||||
decl->is_external_visible = true;
|
||||
vec_add(unit->module->lambdas_to_evaluate, decl);
|
||||
}
|
||||
else
|
||||
|
||||
19
test/test_suite/enumerations/lambda_in_enum.c3t
Normal file
19
test/test_suite/enumerations/lambda_in_enum.c3t
Normal file
@@ -0,0 +1,19 @@
|
||||
// #target: macos-x64
|
||||
module test;
|
||||
alias SomethingFn = fn void();
|
||||
enum TestEnum : char (SomethingFn f)
|
||||
{
|
||||
FOO = fn () {}
|
||||
}
|
||||
|
||||
/* #expect: test.ll
|
||||
|
||||
@.enum.FOO = internal constant [4 x i8] c"FOO\00", align 1
|
||||
@"$ct.char" = linkonce global %.introspect { i8 3, i64 0, ptr null, i64 1, i64 0, i64 0, [0 x i64] zeroinitializer }, align 8
|
||||
@"$ct.test.TestEnum" = linkonce global { i8, i64, ptr, i64, i64, i64, [1 x %"char[]"] } { i8 8, i64 0, ptr null, i64 1, i64 ptrtoint (ptr @"$ct.char" to i64), i64 1, [1 x %"char[]"] [%"char[]" { ptr @.enum.FOO, i64 3 }] }, align 8
|
||||
@"test.TestEnum$f" = linkonce constant [1 x ptr] [ptr @"test.$global$lambda1"], align 8
|
||||
|
||||
define void @"test.$global$lambda1"() #0 {
|
||||
entry:
|
||||
ret void
|
||||
}
|
||||
Reference in New Issue
Block a user