]> Nishi Git Mirror - gwion.git/commitdiff
:art: '::' as an operator
authorfennecdjay <astor.jeremie@wanadoo.fr>
Tue, 26 Mar 2019 15:20:21 +0000 (16:20 +0100)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Tue, 26 Mar 2019 15:20:21 +0000 (16:20 +0100)
ast
include/parse.h
src/emit/emit.c
src/lib/prim.c
src/parse/check.c
src/parse/scan1.c
src/parse/scan2.c
util

diff --git a/ast b/ast
index d5bb42177b8cc84c6fa225c93a79b84cb9c75840..aad27af27cd58925dfde26a7c9d6cfad3a9594b3 160000 (submodule)
--- a/ast
+++ b/ast
@@ -1 +1 @@
-Subproject commit d5bb42177b8cc84c6fa225c93a79b84cb9c75840
+Subproject commit aad27af27cd58925dfde26a7c9d6cfad3a9594b3
index 245d483f270d7a2de4a5310459ea3463d713d515..28a2d1ae1d388de8fb432f2f6e7b03b4b6acb364 100644 (file)
@@ -22,7 +22,7 @@ static const _exp_func exp_func[] = {
   (_exp_func)prefix##_exp_decl,    (_exp_func)prefix##_exp_binary, (_exp_func)prefix##_exp_unary, \
   (_exp_func)prefix##_exp_primary, (_exp_func)prefix##_exp_cast,   (_exp_func)prefix##_exp_post,  \
   (_exp_func)prefix##_exp_call,    (_exp_func)prefix##_exp_array,  (_exp_func)prefix##_exp_if,    \
-  (_exp_func)prefix##_exp_dot,     (_exp_func)prefix##_exp_dur,    (_exp_func)prefix##_exp_lambda \
+  (_exp_func)prefix##_exp_dot,     (_exp_func)prefix##_exp_lambda                                 \
 };
 
 #define DECL_SECTION_FUNC(prefix)                                                                 \
index 72abcc8415f54f9cb3966de7897fa078ce0c4ade..eeac008dd6b85244994b4926fccaee7c6c38bb7b 100644 (file)
@@ -694,13 +694,6 @@ ANN static m_bool emit_exp_post(const Emitter emit, const Exp_Postfix* post) { G
   return op_emit(emit, &opi);
 }
 
-ANN static m_bool emit_exp_dur(const Emitter emit, const Exp_Dur* dur) { GWDEBUG_EXE
-  CHECK_BB(emit_exp(emit, dur->base, 0))
-  CHECK_BB(emit_exp(emit, dur->unit, 0))
-  emit_add_instr(emit, FloatTimes);
-  return GW_OK;
-}
-
 ANN static m_bool is_special(const Type t) {
   if(isa(t, t_complex) > 0 || isa(t, t_polar) > 0 ||
      isa(t, t_vec3)    > 0 || isa(t, t_vec4)  > 0  ||
index 15f1764c915a4c99fc18a1d684f001bb34b253c9..155ba89c88ad29ec7f9ef3a75071b9fc2debce95 100644 (file)
@@ -272,6 +272,10 @@ static GWION_IMPORT(float) {
   CHECK_FF(not, unary_meta, not)
   CHECK_BB(gwi_oper_ini(gwi, NULL,   "dur", "int"))
   CHECK_FF(not, unary_meta, not)
+  CHECK_BB(gwi_oper_ini(gwi, "int", "dur", "dur"))
+  CHECK_BB(gwi_oper_end(gwi, op_coloncolon,         int_float_mul))
+  CHECK_BB(gwi_oper_ini(gwi, "float", "dur", "dur"))
+  CHECK_BB(gwi_oper_end(gwi, op_coloncolon,         FloatTimes))
   return GW_OK;
 }
 
index e2308522c441398fc92b1e07d8bf0b526cb145cc..cd74ccf133e4eca033541289bb9d9afc5ca86b6d 100644 (file)
@@ -635,22 +635,6 @@ ANN static Type check_exp_post(const Env env, const Exp_Postfix* post) { GWDEBUG
   OP_RET(post, "postfix");
 }
 
-ANN static Type check_exp_dur(const Env env, const Exp_Dur* exp) { GWDEBUG_EXE
-  CHECK_OO(check_exp(env, exp->base))
-  CHECK_OO(check_exp(env, exp->unit))
-  if(isa(exp->base->type, t_float) < 0) {
-    if(isa(exp->base->type, t_int) > 0)
-      exp->base->cast_to = t_float;
-    else
-      ERR_O(exp->base->pos, "invalid type '%s' in prefix of dur expression...\n"
-          "    (must be of type 'int' or 'float')", exp->base->type->name)
-  }
-  if(isa(exp->unit->type, t_dur) < 0)
-    ERR_O(exp->unit->pos, "invalid type '%s' in postfix of dur expression...\n"
-          "    (must be of type 'dur')", exp->base->type->name)
-  return exp->unit->type;
-}
-
 ANN static Type check_exp_call(const Env env, Exp_Call* exp) { GWDEBUG_EXE
   if(exp->tmpl) {
     CHECK_OO(check_exp(env, exp->func))
@@ -737,7 +721,7 @@ static const _type_func exp_func[] = {
   (_type_func)check_exp_decl,    (_type_func)check_exp_binary, (_type_func)check_exp_unary,
   (_type_func)check_exp_primary, (_type_func)check_exp_cast,   (_type_func)check_exp_post,
   (_type_func)check_exp_call,    (_type_func)check_exp_array,  (_type_func)check_exp_if,
-  (_type_func)check_exp_dot,     (_type_func)check_exp_dur, (_type_func)check_exp_lambda
+  (_type_func)check_exp_dot,     (_type_func)check_exp_lambda
 };
 
 ANN static inline Type check_exp(const Env env, const Exp exp) { GWDEBUG_EXE
index c5b4ed7f3c1692e5d973aecdfaad0ef3bf100dea..344f61806ce4e23da39d38d3b675c5b32b8c9685 100644 (file)
@@ -117,11 +117,6 @@ ANN static m_bool scan1_exp_post(const Env env, const Exp_Postfix* post) { GWDEB
           " on non-mutable data-type...", op2str(post->op));
 }
 
-ANN static inline m_bool scan1_exp_dur(const Env env, const Exp_Dur* dur) { GWDEBUG_EXE
-  CHECK_BB(scan1_exp(env, dur->base))
-  return scan1_exp(env, dur->unit);
-}
-
 ANN static m_bool scan1_exp_call(const Env env, const Exp_Call* exp_call) { GWDEBUG_EXE
   if(exp_call->tmpl)
     return GW_OK;
index 67fb1f48d01fc2d3095d528d899217cc9013a4c8..c4818740f844a6f9b671b31447e3ac5ed789de0d 100644 (file)
@@ -184,11 +184,6 @@ ANN static inline m_bool scan2_exp_post(const Env env, const Exp_Postfix* post)
   return scan2_exp(env, post->exp);
 }
 
-ANN static inline m_bool scan2_exp_dur(const Env env, const Exp_Dur* dur) { GWDEBUG_EXE
-  CHECK_BB(scan2_exp(env, dur->base))
-  return scan2_exp(env, dur->unit);
-}
-
 ANN2(1,2) static inline m_bool scan2_exp_call1(const Env env, const restrict Exp func,
     const restrict Exp args) { GWDEBUG_EXE
   CHECK_BB(scan2_exp(env, func))
diff --git a/util b/util
index a25a0c0e88bfdf69041c658ff14f7992d78ddcb4..1e9a605aeb73cef2853972984b90e6dc43324d84 160000 (submodule)
--- a/util
+++ b/util
@@ -1 +1 @@
-Subproject commit a25a0c0e88bfdf69041c658ff14f7992d78ddcb4
+Subproject commit 1e9a605aeb73cef2853972984b90e6dc43324d84