Operator overload found!
This commit is contained in:
@@ -1,24 +1,14 @@
|
||||
|
||||
/*
|
||||
@todo: Add function overloading
|
||||
Current plan:
|
||||
* allow insert_into_scope to insert multiple lambdas
|
||||
* change resolve_name and search_for_decl to something
|
||||
that can seek multiple lambda declarations
|
||||
resolve them and return a match to hash or type
|
||||
* change the order of lambda call resolution, probably would have to
|
||||
hash the arguments first to match the lambda call
|
||||
Vec3 :: struct;; x: F32; y: F32; z: F32
|
||||
"+" :: (a: Vec3, b: Vec3): Vec3 ;; return Vec3{a.x+b.x, a.y+b.y, a.z+b.z}
|
||||
|
||||
*/
|
||||
// Add :: (a: int, b: int): int ;; return a + b
|
||||
// Add :: (a: F32, b: F32): F32 ;; return a + b
|
||||
|
||||
main :: (): int
|
||||
a: F32 = 3
|
||||
b: F32 = 2
|
||||
c: int = 4
|
||||
d: int = 10
|
||||
// e := Add(a, b)
|
||||
// f := Add(c, d)
|
||||
a := Vec3{1,1,1}
|
||||
b := Vec3{2,3,4}
|
||||
c := a + b
|
||||
Assert(a.x == 3)
|
||||
Assert(a.y == 4)
|
||||
Assert(a.z == 5)
|
||||
|
||||
return 0
|
||||
Reference in New Issue
Block a user