]> Nishi Git Mirror - gwion.git/commitdiff
:art: more on internal ops
authorfennecdjay <fennecdjay@gmail.com>
Fri, 28 Oct 2022 05:19:30 +0000 (07:19 +0200)
committerfennecdjay <fennecdjay@gmail.com>
Fri, 28 Oct 2022 05:19:30 +0000 (07:19 +0200)
src/parse/scan1.c
tests/internal_op/forbidden_operator.gw [new file with mode: 0644]

index 89ce37987b6d6fde7bba40166262b8f008a9f3f5..1d034d2ace694b12f4ad54948e65ad96e1f4d8b4 100644 (file)
@@ -605,6 +605,13 @@ ANN static m_bool scan_internal(const Env env, const Func_Base *base) {
   if (op == insert_symbol("@conditional") ||
       op == insert_symbol("@unconditional"))
     return scan_internal_int(env, base);
+  if(op == insert_symbol("@array_init") ||
+     op == insert_symbol("@each")       ||
+     op == insert_symbol("@each_idx")   ||
+     op == insert_symbol("@each_init")  ||
+     op == insert_symbol("@each_val")   ||
+     op == insert_symbol("@partial"))
+      ERR_B(base->pos, "operator '%s' not allowed", s_name(op));
   return GW_OK;
 }
 
diff --git a/tests/internal_op/forbidden_operator.gw b/tests/internal_op/forbidden_operator.gw
new file mode 100644 (file)
index 0000000..9c279af
--- /dev/null
@@ -0,0 +1 @@
+operator bool @each(int i, int j) { return true; }