]> Nishi Git Mirror - gwion.git/commitdiff
:art: Indexed jumps
authorJérémie Astor <fennecdjay@gmail.com>
Fri, 18 Dec 2020 01:24:21 +0000 (02:24 +0100)
committerJérémie Astor <fennecdjay@gmail.com>
Fri, 18 Dec 2020 01:24:21 +0000 (02:24 +0100)
15 files changed:
ast
include/env/context.h
include/env/env.h
tests/error/label_defined.gw [deleted file]
tests/error/label_defined_not_used.gw [deleted file]
tests/error/label_not_defined1.gw [deleted file]
tests/error/label_not_defined2.gw [deleted file]
tests/error/upper_label.gw [deleted file]
tests/jump_index/break_idx0.gw [new file with mode: 0644]
tests/jump_index/break_idx1.gw [new file with mode: 0644]
tests/jump_index/break_idx_fail.gw [new file with mode: 0644]
tests/jump_index/break_many.gw [new file with mode: 0644]
tests/tree/class_goto.gw [deleted file]
tests/tree/cpy_ast.gw
tests/tree/goto.gw [deleted file]

diff --git a/ast b/ast
index 126d1ee5c16fca467fddec3f463fc3d1865722ea..b6efc8376c611d9c86e662ad4c348b64baebd523 160000 (submodule)
--- a/ast
+++ b/ast
@@ -1 +1 @@
-Subproject commit 126d1ee5c16fca467fddec3f463fc3d1865722ea
+Subproject commit b6efc8376c611d9c86e662ad4c348b64baebd523
index 0fea1b748e7eb163eef6d035cb83f0f21b7a6505..ca74c1976018702494c5b3319799fe870131dcc5 100644 (file)
@@ -5,7 +5,6 @@ struct Context_ {
   m_str       name;
   Ast         tree;
   Nspc        nspc;
-  struct Map_ lbls;
   m_bool error;
   m_bool global;
   uint16_t ref;
index 9d73be4894415df1c90b999187e7ef62e18eb812..823ab45d386f2843236878ca628b34e07f2dce8b 100644 (file)
@@ -32,7 +32,6 @@ ANN void free_env(Env);
 ANN2(1,3) m_uint env_push(const Env, const Type, const Nspc);
 ANN static inline m_uint env_push_global(const Env env) { return env_push(env, NULL, env->global_nspc); }
 ANN void env_pop(const Env, const m_uint);
-ANN Map env_label(const Env);
 ANN Type scan_type(const Env, const Type, Type_Decl*);
 ANN Value mk_class(const Env env, const Type base);
 ANN m_bool compat_func(const __restrict__ Func_Def, const __restrict__ Func_Def);
diff --git a/tests/error/label_defined.gw b/tests/error/label_defined.gw
deleted file mode 100644 (file)
index 51e6b43..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#! [contains] already defined
- test:
-test:
-;
diff --git a/tests/error/label_defined_not_used.gw b/tests/error/label_defined_not_used.gw
deleted file mode 100644 (file)
index e308ad0..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#! [contains] defined but not used
-test:
-;
diff --git a/tests/error/label_not_defined1.gw b/tests/error/label_not_defined1.gw
deleted file mode 100644 (file)
index e552ce9..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#! [contains] used but not defined
-goto test;
diff --git a/tests/error/label_not_defined2.gw b/tests/error/label_not_defined2.gw
deleted file mode 100644 (file)
index 37db484..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#! [contains] used but not defined
-goto here;
-here:
-goto test;
diff --git a/tests/error/upper_label.gw b/tests/error/upper_label.gw
deleted file mode 100644 (file)
index e4da9b1..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#! [contains] you are trying to use a upper label
-end:
-goto end;
diff --git a/tests/jump_index/break_idx0.gw b/tests/jump_index/break_idx0.gw
new file mode 100644 (file)
index 0000000..83aa343
--- /dev/null
@@ -0,0 +1,5 @@
+var int i;
+while(i < 2) {
+  <<< i++ >>>;
+  break 0;
+}
diff --git a/tests/jump_index/break_idx1.gw b/tests/jump_index/break_idx1.gw
new file mode 100644 (file)
index 0000000..1cde9a6
--- /dev/null
@@ -0,0 +1,5 @@
+var int i;
+while(i < 2) {
+  <<< i++ >>>;
+  break 1;
+}
diff --git a/tests/jump_index/break_idx_fail.gw b/tests/jump_index/break_idx_fail.gw
new file mode 100644 (file)
index 0000000..e1cf2bf
--- /dev/null
@@ -0,0 +1,5 @@
+var int i;
+while(i < 2) {
+  <<< i++ >>>;
+  break 2;
+}
diff --git a/tests/jump_index/break_many.gw b/tests/jump_index/break_many.gw
new file mode 100644 (file)
index 0000000..c72b74d
--- /dev/null
@@ -0,0 +1,7 @@
+while(true) {
+  while(true) {
+    while(true) {
+      break 3;
+    }
+  }
+}
diff --git a/tests/tree/class_goto.gw b/tests/tree/class_goto.gw
deleted file mode 100644 (file)
index 00e35ee..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-class C {
-       goto here;
-       here:
-       ;
-}
-
index 3ffd53f76d7a95b88945d39e42f109d3eecd33a3..39fd87febdc11db4c977dcaa6920d6a82faa82cf 100644 (file)
@@ -23,10 +23,8 @@ class C:[A] {
   } where var int b;
   enum { zero };
   typedef int Int;
-  goto end;
   new Object;
   spork { <<< __func__ >>>; };
-  end:
   while(0){ <<< __func__ >>>; }
 }
 
diff --git a/tests/tree/goto.gw b/tests/tree/goto.gw
deleted file mode 100644 (file)
index addb0be..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-goto here;
-here:
-;      
-