From 19e937ec2f92d6f8036425a86838312e4e526b56 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Fri, 25 Sep 2020 16:18:07 +0200 Subject: [PATCH] :art: Fix operator syntax --- ast | 2 +- examples/class_coverage.gw | 2 +- examples/dtor.gw | 2 +- examples/op.gw | 4 ++-- examples/op2.gw | 10 +++++----- examples/usr_postfix.gw | 2 +- tests/bug/class_doc.gw | 2 +- tests/error/implicit_inside.gw | 2 +- tests/internal_op/conditionnal.gw | 2 +- tests/internal_op/dtor_arg.gw | 2 +- tests/internal_op/dtor_not_void.gw | 2 +- tests/internal_op/dtor_outside_class.gw | 2 +- tests/internal_op/implicit.gw | 2 +- tests/internal_op/internal_gack.gw | 2 +- tests/internal_op/internal_not_int.gw | 2 +- tests/internal_op/unconditionnal.gw | 2 +- tests/match/internal_multi.gw | 2 +- tests/new/dtor.gw | 6 +++--- tests/new/extend_template_union.gw | 2 +- tests/struct/struct_gack.gw | 2 +- tests/tree/member_op.gw | 2 +- tests/tree/reddit.gw | 2 +- tests/tree/usr_unary.gw | 2 +- 23 files changed, 30 insertions(+), 30 deletions(-) diff --git a/ast b/ast index d43d5983..bcd1d80e 160000 --- a/ast +++ b/ast @@ -1 +1 @@ -Subproject commit d43d59831983e1851205c888a493d09910c8d7c8 +Subproject commit bcd1d80e986e043508e8cab4d29356ecaea3fcd8 diff --git a/examples/class_coverage.gw b/examples/class_coverage.gw index 48ff5190..840c5b29 100644 --- a/examples/class_coverage.gw +++ b/examples/class_coverage.gw @@ -2,7 +2,7 @@ class C { var int i; var float f; var Object o; - operator @dtor void () { <<< "dtor" >>>; } + operator void @dtor () { <<< "dtor" >>>; } } var C c; diff --git a/examples/dtor.gw b/examples/dtor.gw index 2eadac09..55266a98 100644 --- a/examples/dtor.gw +++ b/examples/dtor.gw @@ -1,6 +1,6 @@ class C { - operator @dtor void () {<<< 1 >>>;} + operator void @dtor () {<<< 1 >>>;} } var C c; diff --git a/examples/op.gw b/examples/op.gw index 07157aba..6a207eeb 100644 --- a/examples/op.gw +++ b/examples/op.gw @@ -1,6 +1,6 @@ #!! test operator -operator => void (Object o, int i) { +operator void => (Object o, int i) { <<< o, " ", i, " success" >>>; } @@ -9,7 +9,7 @@ class C { } #!! assign object to C.ref -operator => void (Object o, C c) { +operator void => (Object o, C c) { o @=> c.ref_object; <<< "success" >>>; } diff --git a/examples/op2.gw b/examples/op2.gw index 04ff416f..237f96ef 100644 --- a/examples/op2.gw +++ b/examples/op2.gw @@ -3,12 +3,12 @@ class C var float f; } -operator => float (C c, C d){ <<< "float => C: ", c.f => d.f >>>; return 2.0;} -operator => int (int i, C d){ <<< "int => C: ", i => d.f >>>; return 2;} -operator => float (float f, C d){ <<< "float => C: ", f => d.f >>>; return 2.0;} +operator float => (C c, C d){ <<< "float => C: ", c.f => d.f >>>; return 2.0;} +operator int => (int i, C d){ <<< "int => C: ", i => d.f >>>; return 2;} +operator float => (float f, C d){ <<< "float => C: ", f => d.f >>>; return 2.0;} -operator => float (C d, int c){ <<< "int => C: ", c => d.f >>>; return 2.0;} -operator => float (C d, float f){ <<< "C => float: ", f => d.f >>>; return 2.0;} +operator float => (C d, int c){ <<< "int => C: ", c => d.f >>>; return 2.0;} +operator float => (C d, float f){ <<< "C => float: ", f => d.f >>>; return 2.0;} var C c, d; diff --git a/examples/usr_postfix.gw b/examples/usr_postfix.gw index c864f106..4abe01de 100644 --- a/examples/usr_postfix.gw +++ b/examples/usr_postfix.gw @@ -2,7 +2,7 @@ class C { var int i; } -operator ++ int (C c) { +operator int ++ (C c) { <<< "here" >>>; <<< c.i++ >>>; } diff --git a/tests/bug/class_doc.gw b/tests/bug/class_doc.gw index da3b55ff..fb34a6a2 100644 --- a/tests/bug/class_doc.gw +++ b/tests/bug/class_doc.gw @@ -6,7 +6,7 @@ class C #!! a fun fun void test() {} #!! operator - operator => void(C c, C d){ + operator void => (C c, C d){ <<< c, " ", d >>>; } } diff --git a/tests/error/implicit_inside.gw b/tests/error/implicit_inside.gw index c9729f66..d41ff93b 100644 --- a/tests/error/implicit_inside.gw +++ b/tests/error/implicit_inside.gw @@ -2,7 +2,7 @@ class C { 0 => var int i; } -operator @implicit int(C c) { +operator int @implicit (C c) { return c; } diff --git a/tests/internal_op/conditionnal.gw b/tests/internal_op/conditionnal.gw index e4b94b48..f87b6871 100644 --- a/tests/internal_op/conditionnal.gw +++ b/tests/internal_op/conditionnal.gw @@ -3,7 +3,7 @@ class C { 10 => var int i; } -operator @conditionnal int(C c) { +operator int @conditionnal (C c) { <<< __func__ >>>; --c.i; return c.i; diff --git a/tests/internal_op/dtor_arg.gw b/tests/internal_op/dtor_arg.gw index 2f2d7811..9ec6a2ad 100644 --- a/tests/internal_op/dtor_arg.gw +++ b/tests/internal_op/dtor_arg.gw @@ -1,4 +1,4 @@ #! [contains] must not have args class C { - operator @dtor void(int i) {} + operator void @dtor (int i) {} } diff --git a/tests/internal_op/dtor_not_void.gw b/tests/internal_op/dtor_not_void.gw index 71cac937..7102607a 100644 --- a/tests/internal_op/dtor_not_void.gw +++ b/tests/internal_op/dtor_not_void.gw @@ -1,4 +1,4 @@ #! [contains] must return class C { - operator @dtor int() {} + operator int @dtor () {} } diff --git a/tests/internal_op/dtor_outside_class.gw b/tests/internal_op/dtor_outside_class.gw index 15859d05..6d4b7b7f 100644 --- a/tests/internal_op/dtor_outside_class.gw +++ b/tests/internal_op/dtor_outside_class.gw @@ -1,2 +1,2 @@ #! [contains] '@dtor' must be in class def!! -operator @dtor void () {} +operator void @dtor () {} diff --git a/tests/internal_op/implicit.gw b/tests/internal_op/implicit.gw index 3be1be61..57d35676 100644 --- a/tests/internal_op/implicit.gw +++ b/tests/internal_op/implicit.gw @@ -3,7 +3,7 @@ class C { 12 => var int i; } -operator @implicit int (C c) { +operator int @implicit (C c) { return c.i; } diff --git a/tests/internal_op/internal_gack.gw b/tests/internal_op/internal_gack.gw index 97722cf3..fd3781bc 100644 --- a/tests/internal_op/internal_gack.gw +++ b/tests/internal_op/internal_gack.gw @@ -1,5 +1,5 @@ class C { - operator @gack void() { <<< __func__ >>>; } + operator void @gack () { <<< __func__ >>>; } } <<< var C c >>>; <<< c >>>; diff --git a/tests/internal_op/internal_not_int.gw b/tests/internal_op/internal_not_int.gw index ef41b380..78f83bbb 100644 --- a/tests/internal_op/internal_not_int.gw +++ b/tests/internal_op/internal_not_int.gw @@ -1,2 +1,2 @@ #! [contains] must return -operator @conditionnal Object (int i) {} +operator Object @conditionnal (int i) {} diff --git a/tests/internal_op/unconditionnal.gw b/tests/internal_op/unconditionnal.gw index cf90a464..060467b2 100644 --- a/tests/internal_op/unconditionnal.gw +++ b/tests/internal_op/unconditionnal.gw @@ -3,7 +3,7 @@ class C { 10 => var int i; } -operator @unconditionnal int(C c) { +operator int @unconditionnal (C c) { <<< __func__ >>>; --c.i; return !c.i; diff --git a/tests/match/internal_multi.gw b/tests/match/internal_multi.gw index 5aea3237..f5dc8559 100644 --- a/tests/match/internal_multi.gw +++ b/tests/match/internal_multi.gw @@ -1,2 +1,2 @@ #! [contains] must have one -operator @implicit int(int i, int i) {} +operator int @implicit (int i, int i) {} diff --git a/tests/new/dtor.gw b/tests/new/dtor.gw index 2d4afac4..6ae43044 100644 --- a/tests/new/dtor.gw +++ b/tests/new/dtor.gw @@ -1,11 +1,11 @@ class C:[A] { - operator @dtor void () { <<< __func__ >>>; } + operator void @dtor () { <<< __func__ >>>; } } class D:[A] extends C:[A] { - operator @dtor void () { <<< __func__ >>>; } + operator void @dtor () { <<< __func__ >>>; } } class E extends D:[int] { - operator @dtor void () { <<< __func__ >>>; } + operator void @dtor () { <<< __func__ >>>; } } var E e; diff --git a/tests/new/extend_template_union.gw b/tests/new/extend_template_union.gw index 6eb2e8f9..913c181a 100644 --- a/tests/new/extend_template_union.gw +++ b/tests/new/extend_template_union.gw @@ -5,7 +5,7 @@ union U:[A] { class C:[A] extends U:[A] { fun void test() { <<< this >>>; } - operator @dtor void () { <<< __func__ >>>; } + operator void @dtor () { <<< __func__ >>>; } } var C:[float] c; diff --git a/tests/struct/struct_gack.gw b/tests/struct/struct_gack.gw index 0b0488e4..1fae402a 100644 --- a/tests/struct/struct_gack.gw +++ b/tests/struct/struct_gack.gw @@ -1,6 +1,6 @@ struct S { 13 => var int i; - operator @gack void() { <<< "test", i >>>; } + operator void @gack () { <<< "test", i >>>; } <<< this >>>; } diff --git a/tests/tree/member_op.gw b/tests/tree/member_op.gw index a5b14120..615dc07a 100644 --- a/tests/tree/member_op.gw +++ b/tests/tree/member_op.gw @@ -1,6 +1,6 @@ class C { - operator => void(C c, int i){<<< c, " ", i >>>;} + operator void => (C c, int i){<<< c, " ", i >>>;} #! this => this; #!fun void test_op(C c){ this => c; } this => var int i; diff --git a/tests/tree/reddit.gw b/tests/tree/reddit.gw index 9b4fd259..e4d0248e 100644 --- a/tests/tree/reddit.gw +++ b/tests/tree/reddit.gw @@ -3,6 +3,6 @@ <<< 1 + 2 >>>; #! define and operator -operator $@+-*%~<>^&!= void (int i, int j) { <<< i, " ", j >>>; } +operator void $@+-*%~<>^&!= (int i, int j) { <<< i, " ", j >>>; } 1 $@+-*%~<>^&!= 2; diff --git a/tests/tree/usr_unary.gw b/tests/tree/usr_unary.gw index fcc4e01d..de919c15 100644 --- a/tests/tree/usr_unary.gw +++ b/tests/tree/usr_unary.gw @@ -2,7 +2,7 @@ class C { var int i; } -++ operator int (C c) { +operator ++ int (C c) { <<< "test" >>>; <<< c >>>; <<< ++c.i >>>; -- 2.43.0