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 { struct Ast_Lambda : Ast_Expr {
Array<Ast_Decl *> args; 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. // @cleanup @refactor: return value shouldn't be a array of expressions.
// It should be a single expression. So probably need a special type // It should be a single expression. So probably need a special type
// for that. // for that.

View File

@@ -23,6 +23,10 @@ Array :: struct($T: Type)
len: int len: int
cap: int cap: int
Tuple :: struct($A: Type, $B: Type)
a: A
b: B
make_array :: (a: *int, count: int): Array(int) make_array :: (a: *int, count: int): Array(int)
result := Array(int) { result := Array(int) {
data = a, data = a,
@@ -31,6 +35,12 @@ make_array :: (a: *int, count: int): Array(int)
} }
return result 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 main :: (argc: int, argv: **char): int
buff: *int buff: *int
@@ -40,4 +50,6 @@ main :: (argc: int, argv: **char): int
fourth: Array(F32) fourth: Array(F32)
fifth: Array(F32) fifth: Array(F32)
a,b := multiple_args()
return 0 return 0