aboutsummaryrefslogtreecommitdiff
path: root/test/metamethods.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-06 16:07:23 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-06 16:07:23 -0400
commit6782cc5570e194791ca6cdd695b88897e9145564 (patch)
treea428e9d954aca251212ec1cf15bd35e0badce630 /test/metamethods.tm
parent448e805293989b06e07878a4a87fdd378f7c6e02 (diff)
No more colons for blocks
Diffstat (limited to 'test/metamethods.tm')
-rw-r--r--test/metamethods.tm34
1 files changed, 17 insertions, 17 deletions
diff --git a/test/metamethods.tm b/test/metamethods.tm
index aac37c4b..9399bc9a 100644
--- a/test/metamethods.tm
+++ b/test/metamethods.tm
@@ -1,50 +1,50 @@
-struct Vec2(x,y:Int):
- func plus(a,b:Vec2 -> Vec2; inline):
+struct Vec2(x,y:Int)
+ func plus(a,b:Vec2 -> Vec2; inline)
return Vec2(a.x+b.x, a.y+b.y)
- func minus(a,b:Vec2 -> Vec2; inline):
+ func minus(a,b:Vec2 -> Vec2; inline)
return Vec2(a.x-b.x, a.y-b.y)
- func dot(a,b:Vec2 -> Int; inline):
+ func dot(a,b:Vec2 -> Int; inline)
return a.x*b.x + a.y*b.y
- func scaled_by(a:Vec2, k:Int -> Vec2; inline):
+ func scaled_by(a:Vec2, k:Int -> Vec2; inline)
return Vec2(a.x*k, a.y*k)
- func times(a,b:Vec2 -> Vec2; inline):
+ func times(a,b:Vec2 -> Vec2; inline)
return Vec2(a.x*b.x, a.y*b.y)
- func divided_by(a:Vec2, k:Int -> Vec2; inline):
+ func divided_by(a:Vec2, k:Int -> Vec2; inline)
return Vec2(a.x/k, a.y/k)
- func negative(v:Vec2 -> Vec2; inline):
+ func negative(v:Vec2 -> Vec2; inline)
return Vec2(-v.x, -v.y)
- func negated(v:Vec2 -> Vec2; inline):
+ func negated(v:Vec2 -> Vec2; inline)
return Vec2(not v.x, not v.y)
- func bit_and(a,b:Vec2 -> Vec2; inline):
+ func bit_and(a,b:Vec2 -> Vec2; inline)
return Vec2(a.x and b.x, a.y and b.y)
- func bit_or(a,b:Vec2 -> Vec2; inline):
+ func bit_or(a,b:Vec2 -> Vec2; inline)
return Vec2(a.x or b.x, a.y or b.y)
- func bit_xor(a,b:Vec2 -> Vec2; inline):
+ func bit_xor(a,b:Vec2 -> Vec2; inline)
return Vec2(a.x xor b.x, a.y xor b.y)
- func left_shifted(v:Vec2, bits:Int -> Vec2; inline):
+ func left_shifted(v:Vec2, bits:Int -> Vec2; inline)
return Vec2(v.x >> bits, v.y >> bits)
- func right_shifted(v:Vec2, bits:Int -> Vec2; inline):
+ func right_shifted(v:Vec2, bits:Int -> Vec2; inline)
return Vec2(v.x << bits, v.y << bits)
- func modulo(v:Vec2, modulus:Int -> Vec2; inline):
+ func modulo(v:Vec2, modulus:Int -> Vec2; inline)
return Vec2(v.x mod modulus, v.y mod modulus)
- func modulo1(v:Vec2, modulus:Int -> Vec2; inline):
+ func modulo1(v:Vec2, modulus:Int -> Vec2; inline)
return Vec2(v.x mod1 modulus, v.y mod1 modulus)
-func main():
+func main()
>> x := Vec2(10, 20)
>> y := Vec2(100, 200)
>> x + y