This commit is contained in:
Krzosa Karol
2023-04-01 11:54:52 +02:00
parent 4f80cff8e1
commit 21c9a57d96
2 changed files with 18 additions and 0 deletions

View File

@@ -509,6 +509,12 @@ struct Ast_For : Ast {
struct Ast_Lambda : Ast_Expr {
Array<Ast_Decl *> args;
// :Multiple arguments
// @todo: maybe disallow multiple arguments in current form
// and use polimorphism. Then we could make var unpacking,
// unpack structs making it more powerful
// @cleanup @refactor: return value shouldn't be a array of expressions.
// It should be a single expression. So probably need a special type
// for that.

View File

@@ -23,6 +23,10 @@ Array :: struct($T: Type)
len: int
cap: int
Tuple :: struct($A: Type, $B: Type)
a: A
b: B
make_array :: (a: *int, count: int): Array(int)
result := Array(int) {
data = a,
@@ -31,6 +35,12 @@ make_array :: (a: *int, count: int): Array(int)
}
return result
// :Multiple arguments
// @todo: maybe disallow multiple arguments in current form
// and use polimorphism. Then we could make var unpacking,
// unpack structs making it more powerful
multiple_args :: (): Tuple(int, F32)
return {32, 32}
main :: (argc: int, argv: **char): int
buff: *int
@@ -40,4 +50,6 @@ main :: (argc: int, argv: **char): int
fourth: Array(F32)
fifth: Array(F32)
a,b := multiple_args()
return 0