Files
bux-lang/_test_funcptr/src/Main.bux
T
dimgigov 2e536488e6 feat(bootstrap): function pointer types + C emission
- Add tekFunc AST node and parser support for func(Params) -> Ret
- Add tkFunc type resolution in sema and hir_lower
- Add &FuncName address-taking yielding tkMutRef(tkFunc)
- Fix C emission: function pointer params use Ret (*name)(Params) syntax
  via cParamDecl helper that embeds the name inside (*)
- Fix forward declarations and temp declarations for function pointers
- Add funcPtrTypes table in C backend so &Fn temps get proper type
- Add _test_funcptr integration test
2026-06-08 22:31:32 +03:00

18 lines
251 B
Plaintext

module Main {
func Apply(x: int, op: func(int) -> int) -> int {
return op(x);
}
func Double(n: int) -> int {
return n * 2;
}
func main() -> int {
let result: int = Apply(5, &Double);
if result != 10 { return 1; }
return 0;
}
}