From 9fe9567bff318703073ae239b6affab78ec83768 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sat, 12 Sep 2020 11:25:58 +0200 Subject: [PATCH] :art: Make storage/access flag placement consistent --- ast | 2 +- examples/check.gw | 1 - examples/complex/event2_1.gw | 2 +- examples/decl_object2.gw | 1 - examples/doc.gw | 7 ------- examples/module_coverage.gw | 9 --------- examples/sine.gw | 4 ---- examples/sine2.gw | 3 --- examples/sinosc_extend.gw | 8 -------- examples/static.gw | 6 +++--- examples/trig.gw | 3 --- examples/ugen_connect_no_in.gw | 1 - examples/ugen_disconnect_no_in.gw | 3 --- tests/bug/dot_member_func.gw | 14 -------------- tests/bug/machine_check_trash.gw | 2 -- tests/bug/static_data.gw | 6 +++--- tests/bug/ugen.gw | 21 --------------------- tests/error/invalid_global_class.gw | 2 +- tests/error/invalid_global_file.gw | 2 +- tests/error/not_global.gw | 2 +- tests/error/private.gw | 2 +- tests/error/private_global.gw | 2 +- tests/error/private_other.gw | 2 +- tests/error/static_out.gw | 2 +- tests/fptr/class_ptr2.gw | 2 +- tests/fptr/class_ptr3.gw | 2 +- tests/fptr/class_ptr31.gw | 2 +- tests/new/global_func0.gw | 4 ++-- tests/new/global_var.gw | 2 +- tests/new/test.gw | 2 +- tests/new/test2.gw | 2 +- tests/struct/struct_global0.gw | 2 +- tests/struct/struct_static.gw | 2 +- tests/struct/struct_static_func.gw | 2 +- tests/tree/check_compile_file.gw | 1 - tests/tree/check_invalid_file.gw | 1 - tests/tree/dot.gw | 2 -- tests/tree/func_extend_error.gw | 10 ---------- tests/tree/global_var.gw | 2 +- tests/tree/map.gw | 5 ----- tests/tree/not_global.gw | 2 +- tests/tree/pair.gw | 9 --------- tests/tree/private_access.gw | 2 +- tests/tree/protect.gw | 2 +- tests/tree/static_data_test.gw | 4 ++-- tests/tree/static_template.gw | 2 +- tests/tree/template_typedef.gw | 20 -------------------- 47 files changed, 33 insertions(+), 158 deletions(-) delete mode 100644 examples/check.gw delete mode 100644 examples/decl_object2.gw delete mode 100644 examples/doc.gw delete mode 100644 examples/module_coverage.gw delete mode 100644 examples/sine.gw delete mode 100644 examples/sine2.gw delete mode 100644 examples/sinosc_extend.gw delete mode 100644 examples/trig.gw delete mode 100644 examples/ugen_connect_no_in.gw delete mode 100644 examples/ugen_disconnect_no_in.gw delete mode 100644 tests/bug/dot_member_func.gw delete mode 100644 tests/bug/machine_check_trash.gw delete mode 100644 tests/bug/ugen.gw delete mode 100644 tests/tree/check_compile_file.gw delete mode 100644 tests/tree/check_invalid_file.gw delete mode 100644 tests/tree/dot.gw delete mode 100644 tests/tree/func_extend_error.gw delete mode 100644 tests/tree/map.gw delete mode 100644 tests/tree/pair.gw delete mode 100644 tests/tree/template_typedef.gw diff --git a/ast b/ast index a065796b..c83cc91c 160000 --- a/ast +++ b/ast @@ -1 +1 @@ -Subproject commit a065796b43b43260ef290667711261058467158d +Subproject commit c83cc91cd55f2ee3036bfe5a04fc06cd191b6ded diff --git a/examples/check.gw b/examples/check.gw deleted file mode 100644 index 78160b90..00000000 --- a/examples/check.gw +++ /dev/null @@ -1 +0,0 @@ -<<< Machine.check("SinOsc s => dac; second => now;") >>>; diff --git a/examples/complex/event2_1.gw b/examples/complex/event2_1.gw index 533a4010..80290648 100644 --- a/examples/complex/event2_1.gw +++ b/examples/complex/event2_1.gw @@ -1,5 +1,5 @@ class global TestEvent { - static var Event e; + var static Event e; } second => now; #!second => now; diff --git a/examples/decl_object2.gw b/examples/decl_object2.gw deleted file mode 100644 index 5068eb30..00000000 --- a/examples/decl_object2.gw +++ /dev/null @@ -1 +0,0 @@ -var SinOsc s; diff --git a/examples/doc.gw b/examples/doc.gw deleted file mode 100644 index 5610282a..00000000 --- a/examples/doc.gw +++ /dev/null @@ -1,7 +0,0 @@ -Machine.add("examples/int.gw"); -Machine.compile("int i;<<< 120 >>>;"); -#!Machine.compile("int i[error];"); - -<<< Machine.check("12 => int i; <<< i >>>") >>>; -Machine.check("int i[error];"); -Machine.check(null); diff --git a/examples/module_coverage.gw b/examples/module_coverage.gw deleted file mode 100644 index bd93e1ae..00000000 --- a/examples/module_coverage.gw +++ /dev/null @@ -1,9 +0,0 @@ -var SinOsc s => var Gain g => var HalfRect h => blackhole; -s => var ZeroX z => blackhole; -17 => s.init; -(1024, .17) => s.init; -var Impulse i => var FullRect f => blackhole; -var Step step => blackhole; -second => now; -<<< "end" >>>; -step =< blackhole; diff --git a/examples/sine.gw b/examples/sine.gw deleted file mode 100644 index c5f06ee0..00000000 --- a/examples/sine.gw +++ /dev/null @@ -1,4 +0,0 @@ -var SinOsc sinosc => dac; -1::second => now; -sinosc.freq(220); -1::second => now; diff --git a/examples/sine2.gw b/examples/sine2.gw deleted file mode 100644 index 711dbb20..00000000 --- a/examples/sine2.gw +++ /dev/null @@ -1,3 +0,0 @@ -var SinOsc sinosc => dac; -<<< second >>>; -5::second => now; diff --git a/examples/sinosc_extend.gw b/examples/sinosc_extend.gw deleted file mode 100644 index 33d69057..00000000 --- a/examples/sinosc_extend.gw +++ /dev/null @@ -1,8 +0,0 @@ -class Sine extends SinOsc -{ - fun float freq(float f) { (2 * f) => (this $ SinOsc).freq; } -} - -var Sine s => dac; -220 => s.freq; -second => now; diff --git a/examples/static.gw b/examples/static.gw index 527645f9..1287dbc8 100644 --- a/examples/static.gw +++ b/examples/static.gw @@ -1,8 +1,8 @@ class C { - static var int i; - static var float f; - static var Object o; + var static int i; + var static float f; + var static Object o; fun int m_i() { return i; } fun float m_f() { return f; } diff --git a/examples/trig.gw b/examples/trig.gw deleted file mode 100644 index c8d83f55..00000000 --- a/examples/trig.gw +++ /dev/null @@ -1,3 +0,0 @@ -var SinOsc s :=> var Dtrig dtrig => blackhole; -second => now; -s :=< dtrig; diff --git a/examples/ugen_connect_no_in.gw b/examples/ugen_connect_no_in.gw deleted file mode 100644 index fecd3104..00000000 --- a/examples/ugen_connect_no_in.gw +++ /dev/null @@ -1 +0,0 @@ -var Gain a => var SinOsc s => blackhole; diff --git a/examples/ugen_disconnect_no_in.gw b/examples/ugen_disconnect_no_in.gw deleted file mode 100644 index 2c2a33f8..00000000 --- a/examples/ugen_disconnect_no_in.gw +++ /dev/null @@ -1,3 +0,0 @@ -var Gain a; -var SinOsc s => blackhole; -a =< s; diff --git a/tests/bug/dot_member_func.gw b/tests/bug/dot_member_func.gw deleted file mode 100644 index c18ce7ea..00000000 --- a/tests/bug/dot_member_func.gw +++ /dev/null @@ -1,14 +0,0 @@ -#! thanks to afl-fuzz -ref SinOsc s, t; -var Gain g => dac; -1 => t.freq; -s => g; -t => g; -g.chan(0); -spork { while(true) { Math.rand2f(100, 800) => s.freq; .15::second => now; }}; -for(var int i; i < 5; i++) { - <<< g.op() >>>; - i => g.op; - 2::second => now; -} - diff --git a/tests/bug/machine_check_trash.gw b/tests/bug/machine_check_trash.gw deleted file mode 100644 index 255aac9c..00000000 --- a/tests/bug/machine_check_trash.gw +++ /dev/null @@ -1,2 +0,0 @@ -Machine.compile(null); -Machine.check("jgjl."); diff --git a/tests/bug/static_data.gw b/tests/bug/static_data.gw index de5cabd2..1d67cfa4 100644 --- a/tests/bug/static_data.gw +++ b/tests/bug/static_data.gw @@ -1,8 +1,8 @@ class C { - static var int i; - static var float f; - static var Object o; + var static int i; + var static float f; + var static Object o; } <<< C.i >>>; <<< C.f >>>; diff --git a/tests/bug/ugen.gw b/tests/bug/ugen.gw deleted file mode 100644 index b41e5937..00000000 --- a/tests/bug/ugen.gw +++ /dev/null @@ -1,21 +0,0 @@ -ref UGen u; -#!u.last(); #! should fail => fails. -ref SinOsc s => ref Gain g => dac; -for(-1 => var int i;i < 6; i++) - i => g.op; -samp => now; -s.last(); -#!s.chan(2); -#!dac.chan(1); -samp => now; - - -#! there a bug somewhere. -#! probably deref 'dac' to many mul ... -#!dac => blackhole; -#!dac =< blackhole; -#!dac =< s; -#!dac =< s; -s =< dac; -s =< dac; -#!dac =< s; diff --git a/tests/error/invalid_global_class.gw b/tests/error/invalid_global_class.gw index 38b1bcb5..d9841a82 100644 --- a/tests/error/invalid_global_class.gw +++ b/tests/error/invalid_global_class.gw @@ -1,6 +1,6 @@ #! [contains] 'global' can only be used at class scope class C { { - global var int i; + var global int i; } } diff --git a/tests/error/invalid_global_file.gw b/tests/error/invalid_global_file.gw index 8f3884ac..14981d13 100644 --- a/tests/error/invalid_global_file.gw +++ b/tests/error/invalid_global_file.gw @@ -1,4 +1,4 @@ #! [contains] 'global' can only be used at file scope { -global var int i; +var global int i; } diff --git a/tests/error/not_global.gw b/tests/error/not_global.gw index 12d4beb0..060d405f 100644 --- a/tests/error/not_global.gw +++ b/tests/error/not_global.gw @@ -3,4 +3,4 @@ class C { } -global var C c; +var global C c; diff --git a/tests/error/private.gw b/tests/error/private.gw index ec3add2b..864fed9b 100644 --- a/tests/error/private.gw +++ b/tests/error/private.gw @@ -1,5 +1,5 @@ #! [contains] can't access private -class C { private var int i; } +class C { var private int i; } var C c; <<< c.i >>>; diff --git a/tests/error/private_global.gw b/tests/error/private_global.gw index c473d576..acd64f0b 100644 --- a/tests/error/private_global.gw +++ b/tests/error/private_global.gw @@ -1,2 +1,2 @@ #! [contains] can only be used at class scope -private var int i; +var private int i; diff --git a/tests/error/private_other.gw b/tests/error/private_other.gw index f9be3a75..34cec0f8 100644 --- a/tests/error/private_other.gw +++ b/tests/error/private_other.gw @@ -1,5 +1,5 @@ #! [contains] can't access private -class C { private var int i; } +class C { var private int i; } class D { var C c; diff --git a/tests/error/static_out.gw b/tests/error/static_out.gw index 47b52b38..4b116e27 100644 --- a/tests/error/static_out.gw +++ b/tests/error/static_out.gw @@ -1,2 +1,2 @@ #! [contains] can only be used at class scope -static var int i; +var static int i; diff --git a/tests/fptr/class_ptr2.gw b/tests/fptr/class_ptr2.gw index 3998bb63..96b0c441 100644 --- a/tests/fptr/class_ptr2.gw +++ b/tests/fptr/class_ptr2.gw @@ -1,7 +1,7 @@ class C { fun void test(int i) { <<< "int arg" >>>; } typedef void PtrType(int i); - test @=> static var PtrType p; + test @=> var static PtrType p; p(1); test @=> p; p(1); diff --git a/tests/fptr/class_ptr3.gw b/tests/fptr/class_ptr3.gw index 96b66cfe..0ceb2c65 100644 --- a/tests/fptr/class_ptr3.gw +++ b/tests/fptr/class_ptr3.gw @@ -1,7 +1,7 @@ class C { fun static void test(int i) { <<< "int arg" >>>; } typedef static void PtrType(int i); - test @=> static var PtrType p; + test @=> var static PtrType p; p(1); test @=> p; p(1); diff --git a/tests/fptr/class_ptr31.gw b/tests/fptr/class_ptr31.gw index afaeb1a7..8721a99b 100644 --- a/tests/fptr/class_ptr31.gw +++ b/tests/fptr/class_ptr31.gw @@ -2,7 +2,7 @@ class C { fun void test(int i) { <<< "int arg" >>>; } typedef static void PtrType(int i); - test @=> static var PtrType p; + test @=> var static PtrType p; p(1); test @=> p; p(1); diff --git a/tests/new/global_func0.gw b/tests/new/global_func0.gw index e2493ac1..335ee433 100644 --- a/tests/new/global_func0.gw +++ b/tests/new/global_func0.gw @@ -1,9 +1,9 @@ -123 => global var int global_func_i; +123 => var global int global_func_i; class global GlobalFuncClass { 13 => var int i; } <<< global_func_i >>>; -global var GlobalFuncClass g_c; +var global GlobalFuncClass g_c; <<< g_c, "->i => ", g_c.i >>>; fun global void g_test() { <<< global_func_i >>>; <<< g_c >>>; <<< g_c.i >>>; <<< "test" >>>; } #!fun global void g_test() { <<< "test" >>>; } diff --git a/tests/new/global_var.gw b/tests/new/global_var.gw index 54017c37..207eb08f 100644 --- a/tests/new/global_var.gw +++ b/tests/new/global_var.gw @@ -1 +1 @@ -<<< global var int global_var_i >>>; +<<< var global int global_var_i >>>; diff --git a/tests/new/test.gw b/tests/new/test.gw index f28cf295..1472590d 100644 --- a/tests/new/test.gw +++ b/tests/new/test.gw @@ -1,7 +1,7 @@ class C { typedef static void func_t<~A~>(A a); fun static void myfunc<~A~>(A a) { <<< a >>>; } - myfunc @=> static var func_t ptr; + myfunc @=> var static func_t ptr; ptr(1); } diff --git a/tests/new/test2.gw b/tests/new/test2.gw index c9814482..044dd500 100644 --- a/tests/new/test2.gw +++ b/tests/new/test2.gw @@ -1,7 +1,7 @@ class <~A~>C { typedef static void func_t<~A~>(A a); fun static void myfunc<~A~>(A a) { <<< a >>>; } - myfunc @=> static var func_t ptr; + myfunc @=> var static func_t ptr; ptr(1); } diff --git a/tests/struct/struct_global0.gw b/tests/struct/struct_global0.gw index d9eac97d..bd901ee8 100644 --- a/tests/struct/struct_global0.gw +++ b/tests/struct/struct_global0.gw @@ -10,5 +10,5 @@ struct global GlobalStructWithCtor { var string s; } -global var GlobalStruct global_s; +var global GlobalStruct global_s; var GlobalStructWithCtor sctor; diff --git a/tests/struct/struct_static.gw b/tests/struct/struct_static.gw index 6368b30e..c3269cdd 100644 --- a/tests/struct/struct_static.gw +++ b/tests/struct/struct_static.gw @@ -5,7 +5,7 @@ class C { 13 => var float f; <<< __func__ >>>; } - static var S s; + var static S s; } var C c; diff --git a/tests/struct/struct_static_func.gw b/tests/struct/struct_static_func.gw index 7f809a3c..a69fba1e 100644 --- a/tests/struct/struct_static_func.gw +++ b/tests/struct/struct_static_func.gw @@ -1,7 +1,7 @@ struct S { var int i; var int j; - 12 => static var int si; + 12 => var static int si; fun static void test() { <<< __func__, si >>>; } test(); } diff --git a/tests/tree/check_compile_file.gw b/tests/tree/check_compile_file.gw deleted file mode 100644 index 81cf4f5c..00000000 --- a/tests/tree/check_compile_file.gw +++ /dev/null @@ -1 +0,0 @@ -Machine.compile("int i"); diff --git a/tests/tree/check_invalid_file.gw b/tests/tree/check_invalid_file.gw deleted file mode 100644 index 3f8100ac..00000000 --- a/tests/tree/check_invalid_file.gw +++ /dev/null @@ -1 +0,0 @@ -Machine.check("int i"); diff --git a/tests/tree/dot.gw b/tests/tree/dot.gw deleted file mode 100644 index 5e26e814..00000000 --- a/tests/tree/dot.gw +++ /dev/null @@ -1,2 +0,0 @@ -var int i[]; -Machine.shreds() @=> i; diff --git a/tests/tree/func_extend_error.gw b/tests/tree/func_extend_error.gw deleted file mode 100644 index 3f4d84b4..00000000 --- a/tests/tree/func_extend_error.gw +++ /dev/null @@ -1,10 +0,0 @@ -class Sine extends SinOsc -{ - fun int freq(float f) { - (2 * f) => (this $ SinOsc).freq; - } -} - -var Sine s => dac; -220 => s.freq; -second => now; diff --git a/tests/tree/global_var.gw b/tests/tree/global_var.gw index 9b447a4b..2b5c16b8 100644 --- a/tests/tree/global_var.gw +++ b/tests/tree/global_var.gw @@ -1 +1 @@ -<<< global var int g_i >>>; +<<< var global int g_i >>>; diff --git a/tests/tree/map.gw b/tests/tree/map.gw deleted file mode 100644 index 069c7afc..00000000 --- a/tests/tree/map.gw +++ /dev/null @@ -1,5 +0,0 @@ -var <~int, int~>Map pp; -<<< pp >>>; -<<< pp.size() >>>; -<<< pp.set(1, 2) >>>; -<<< pp.get(1) >>>; diff --git a/tests/tree/not_global.gw b/tests/tree/not_global.gw index 12d4beb0..060d405f 100644 --- a/tests/tree/not_global.gw +++ b/tests/tree/not_global.gw @@ -3,4 +3,4 @@ class C { } -global var C c; +var global C c; diff --git a/tests/tree/pair.gw b/tests/tree/pair.gw deleted file mode 100644 index 4cec49e7..00000000 --- a/tests/tree/pair.gw +++ /dev/null @@ -1,9 +0,0 @@ -var <~float, int~>Pair p; -<<< p >>>; -1 => p.key; -2 => p.val; - -<<< p.key, " ", p.val >>>; - -(2,3) => p.set; -<<< p.key, " ", p.val >>>; diff --git a/tests/tree/private_access.gw b/tests/tree/private_access.gw index 0c4d64e6..41820a75 100644 --- a/tests/tree/private_access.gw +++ b/tests/tree/private_access.gw @@ -1,5 +1,5 @@ class C { - private var int i; + var private int i; <<< i >>>; } diff --git a/tests/tree/protect.gw b/tests/tree/protect.gw index 02f82b72..06085bc2 100644 --- a/tests/tree/protect.gw +++ b/tests/tree/protect.gw @@ -1,5 +1,5 @@ class C { - protect var int i; + var protect int i; <<< ++i >>>; } diff --git a/tests/tree/static_data_test.gw b/tests/tree/static_data_test.gw index 38f9e0c1..46cfbdb2 100644 --- a/tests/tree/static_data_test.gw +++ b/tests/tree/static_data_test.gw @@ -1,7 +1,7 @@ class C { - static var int i; + var static int i; typedef static void Test(); - static var Test test; + var static Test test; } var C c; diff --git a/tests/tree/static_template.gw b/tests/tree/static_template.gw index 046b20d6..784667ef 100644 --- a/tests/tree/static_template.gw +++ b/tests/tree/static_template.gw @@ -3,7 +3,7 @@ class<~A~> C { } class D { - static var <~int~>C c; + var static <~int~>C c; } var D d; diff --git a/tests/tree/template_typedef.gw b/tests/tree/template_typedef.gw deleted file mode 100644 index 747c12e7..00000000 --- a/tests/tree/template_typedef.gw +++ /dev/null @@ -1,20 +0,0 @@ -var <~int, int~>Pair p; -typedef <~int, int~>Pair lol; -var lol t; -<<< t >>>; -<<< t.key >>>; -class C extends lol { var int i;} -var C c; -<<< c.i >>>; -class<~A~> D { - <<< "lol" >>>; - var int i; -} -typedef <~int~>D Lol; -class E extends Lol { - var float f; -} -var E d; -<<< d >>>; -<<< d.i >>>; -<<< d.f >>>; -- 2.43.0