poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[COMMITTED] libpoke: rename pkl_ast_type_equal to pkl_ast_type_equal_p


From: Jose E. Marchesi
Subject: [COMMITTED] libpoke: rename pkl_ast_type_equal to pkl_ast_type_equal_p
Date: Sun, 08 Nov 2020 20:05:48 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

2020-11-08  Jose E. Marchesi  <jemarch@gnu.org>

        * libpoke/pkl-ast.h: Rename pkl_ast_type_equal to
        pkl_ast_type_equal_p.
        * libpoke/pkl-ast.c (pkl_ast_type_equal_p): Likewise.
        * libpoke/pkl-typify.c: Likewise.
        * libpoke/pkl-promo.c: Likewise.
        * libpoke/pkl-fold.c (pkl_fold_ps_cast): Likewise.
---
 ChangeLog            |  9 +++++++++
 libpoke/pkl-ast.c    | 20 ++++++++++----------
 libpoke/pkl-ast.h    |  2 +-
 libpoke/pkl-fold.c   |  2 +-
 libpoke/pkl-promo.c  | 12 ++++++------
 libpoke/pkl-typify.c | 20 ++++++++++----------
 6 files changed, 37 insertions(+), 28 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ef1cf618..6c8424a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2020-11-08  Jose E. Marchesi  <jemarch@gnu.org>
+
+       * libpoke/pkl-ast.h: Rename pkl_ast_type_equal to
+       pkl_ast_type_equal_p.
+       * libpoke/pkl-ast.c (pkl_ast_type_equal_p): Likewise.
+       * libpoke/pkl-typify.c: Likewise.
+       * libpoke/pkl-promo.c: Likewise.
+       * libpoke/pkl-fold.c (pkl_fold_ps_cast): Likewise.
+
 2020-11-08  Jose E. Marchesi  <jemarch@gnu.org>
 
        * libpoke/pkl-lex.l: Support `lambda'.
diff --git a/libpoke/pkl-ast.c b/libpoke/pkl-ast.c
index 9615adcc..109fafa2 100644
--- a/libpoke/pkl-ast.c
+++ b/libpoke/pkl-ast.c
@@ -744,7 +744,7 @@ pkl_ast_array_type_remove_bounders (pkl_ast_node type)
    the same type.  */
 
 int
-pkl_ast_type_equal (pkl_ast_node a, pkl_ast_node b)
+pkl_ast_type_equal_p (pkl_ast_node a, pkl_ast_node b)
 {
   if (PKL_AST_TYPE_CODE (a) != PKL_AST_TYPE_CODE (b))
     return 0;
@@ -782,8 +782,8 @@ pkl_ast_type_equal (pkl_ast_node a, pkl_ast_node b)
               }
           }
 
-        return pkl_ast_type_equal (PKL_AST_TYPE_A_ETYPE (a),
-                                   PKL_AST_TYPE_A_ETYPE (b));
+        return pkl_ast_type_equal_p (PKL_AST_TYPE_A_ETYPE (a),
+                                     PKL_AST_TYPE_A_ETYPE (b));
         break;
       }
     case PKL_TYPE_STRUCT:
@@ -815,8 +815,8 @@ pkl_ast_type_equal (pkl_ast_node a, pkl_ast_node b)
                 != PKL_AST_FUNC_TYPE_ARG_VARARG (fb))
               return 0;
 
-            if (!pkl_ast_type_equal (PKL_AST_FUNC_TYPE_ARG_TYPE (fa),
-                                     PKL_AST_FUNC_TYPE_ARG_TYPE (fb)))
+            if (!pkl_ast_type_equal_p (PKL_AST_FUNC_TYPE_ARG_TYPE (fa),
+                                       PKL_AST_FUNC_TYPE_ARG_TYPE (fb)))
               return 0;
           }
         break;
@@ -834,8 +834,8 @@ pkl_ast_type_equal (pkl_ast_node a, pkl_ast_node b)
           return 0;
 
         return (PKL_AST_INTEGER_VALUE (a_unit) == PKL_AST_INTEGER_VALUE 
(b_unit)
-                  && pkl_ast_type_equal (PKL_AST_TYPE_O_BASE_TYPE (a),
-                                         PKL_AST_TYPE_O_BASE_TYPE (b)));
+                  && pkl_ast_type_equal_p (PKL_AST_TYPE_O_BASE_TYPE (a),
+                                           PKL_AST_TYPE_O_BASE_TYPE (b)));
       }
       break;
     case PKL_TYPE_STRING:
@@ -848,14 +848,14 @@ pkl_ast_type_equal (pkl_ast_node a, pkl_ast_node b)
 }
 
 /* Return whether the type FT is promoteable to type TT.  Note that,
-   unlike pkl_ast_type_equal above, this operation is not
+   unlike pkl_ast_type_equal_p above, this operation is not
    generally commutative.  */
 
 int
 pkl_ast_type_promoteable (pkl_ast_node ft, pkl_ast_node tt,
                           int promote_array_of_any)
 {
-  if (pkl_ast_type_equal (ft, tt))
+  if (pkl_ast_type_equal_p (ft, tt))
     return 1;
 
   /* Any type is promoteable to ANY.  */
@@ -889,7 +889,7 @@ pkl_ast_type_promoteable (pkl_ast_node ft, pkl_ast_node tt,
       pkl_ast_node ft_etype = PKL_AST_TYPE_A_ETYPE (ft);
       pkl_ast_node tt_etype = PKL_AST_TYPE_A_ETYPE (tt);
 
-      if (!pkl_ast_type_equal (tt_etype, ft_etype))
+      if (!pkl_ast_type_equal_p (tt_etype, ft_etype))
         return 0;
 
       /* Static array types can be handled here.  */
diff --git a/libpoke/pkl-ast.h b/libpoke/pkl-ast.h
index 6a44cfb7..01a380fd 100644
--- a/libpoke/pkl-ast.h
+++ b/libpoke/pkl-ast.h
@@ -980,7 +980,7 @@ pkl_ast_node pkl_ast_make_any_type (pkl_ast);
 
 pkl_ast_node pkl_ast_dup_type (pkl_ast_node type);
 
-int pkl_ast_type_equal (pkl_ast_node t1, pkl_ast_node t2);
+int pkl_ast_type_equal_p (pkl_ast_node t1, pkl_ast_node t2);
 
 int pkl_ast_type_mappable_p (pkl_ast_node type);
 
diff --git a/libpoke/pkl-fold.c b/libpoke/pkl-fold.c
index 11735a1e..687c157f 100644
--- a/libpoke/pkl-fold.c
+++ b/libpoke/pkl-fold.c
@@ -987,7 +987,7 @@ PKL_PHASE_BEGIN_HANDLER (pkl_fold_ps_cast)
 
       /* We may need to create a new magnitude node, if the base type
          is different.  */
-      if (!pkl_ast_type_equal (from_base_type, to_base_type))
+      if (!pkl_ast_type_equal_p (from_base_type, to_base_type))
         {
           magnitude = pkl_ast_make_integer (PKL_PASS_AST,
                                             PKL_AST_INTEGER_VALUE (magnitude));
diff --git a/libpoke/pkl-promo.c b/libpoke/pkl-promo.c
index b0598779..dd21be79 100644
--- a/libpoke/pkl-promo.c
+++ b/libpoke/pkl-promo.c
@@ -953,7 +953,7 @@ PKL_PHASE_BEGIN_HANDLER (pkl_promo_ps_ass_stmt)
      equivalent, then we are done.  Arrays are excluded because of how
      the boundary is ignored in type equivalence.  */
   if (PKL_AST_TYPE_CODE (lvalue_type) != PKL_TYPE_ARRAY
-      && pkl_ast_type_equal (lvalue_type, exp_type))
+      && pkl_ast_type_equal_p (lvalue_type, exp_type))
     PKL_PASS_DONE;
 
   /* A promotion is needed.  */
@@ -1041,7 +1041,7 @@ PKL_PHASE_BEGIN_HANDLER (pkl_promo_ps_funcall)
                  wouldn't have allowed it to pass.  */
 
               /* If both types are equivalent, then we are done.  */
-              if (! pkl_ast_type_equal (fa_type, aa_type))
+              if (! pkl_ast_type_equal_p (fa_type, aa_type))
                 /* A promotion is needed.  */
                 switch (PKL_AST_TYPE_CODE (fa_type))
                   {
@@ -1188,7 +1188,7 @@ PKL_PHASE_BEGIN_HANDLER (pkl_promo_ps_return_stmt)
      equivalent, then we are done.  Arrays are excluded because of how
      the boundary is ignored in type equivalence.  */
   if (PKL_AST_TYPE_CODE (expected_type) != PKL_TYPE_ARRAY
-      && pkl_ast_type_equal (expected_type, returned_type))
+      && pkl_ast_type_equal_p (expected_type, returned_type))
     PKL_PASS_DONE;
 
   if (PKL_AST_TYPE_CODE (expected_type) != PKL_TYPE_VOID)
@@ -1314,7 +1314,7 @@ PKL_PHASE_BEGIN_HANDLER (pkl_promo_ps_func_arg)
          equivalent, then we are done.  Arrays are excluded because of
          how the boundary is ignored in type equivalence.  */
       if (PKL_AST_TYPE_CODE (arg_type) != PKL_TYPE_ARRAY
-          && pkl_ast_type_equal (arg_type, initial_type))
+          && pkl_ast_type_equal_p (arg_type, initial_type))
         PKL_PASS_DONE;
 
       switch (PKL_AST_TYPE_CODE (arg_type))
@@ -1642,7 +1642,7 @@ PKL_PHASE_BEGIN_HANDLER (pkl_promo_ps_op_in)
 
   int restart = 0;
 
-  if (pkl_ast_type_equal (t1, t2))
+  if (pkl_ast_type_equal_p (t1, t2))
     PKL_PASS_DONE;
 
   switch (PKL_AST_TYPE_CODE (t2))
@@ -1729,7 +1729,7 @@ PKL_PHASE_BEGIN_HANDLER (pkl_promo_ps_scons)
                   pkl_ast_node type_elem_type
                     = PKL_AST_STRUCT_TYPE_FIELD_TYPE (type_elem);
 
-                  if (!pkl_ast_type_equal (elem_type, type_elem_type)
+                  if (!pkl_ast_type_equal_p (elem_type, type_elem_type)
                       || (PKL_AST_TYPE_CODE (type_elem_type) == 
PKL_TYPE_ARRAY))
                     {
                       int restart = 0;
diff --git a/libpoke/pkl-typify.c b/libpoke/pkl-typify.c
index 5e190f72..d6795788 100644
--- a/libpoke/pkl-typify.c
+++ b/libpoke/pkl-typify.c
@@ -135,8 +135,8 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_op_rela)
           goto invalid_operands;
 
         /* The arrays must contain the same kind of elements.  */
-        if (!pkl_ast_type_equal (PKL_AST_TYPE_A_ETYPE (op1_type),
-                                 PKL_AST_TYPE_A_ETYPE (op2_type)))
+        if (!pkl_ast_type_equal_p (PKL_AST_TYPE_A_ETYPE (op1_type),
+                                   PKL_AST_TYPE_A_ETYPE (op2_type)))
           goto invalid_array_operands;
 
         /* If the bounds of both array types are known at
@@ -341,7 +341,7 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_isa)
     {
       pkl_ast_node bool_node
         = pkl_ast_make_integer (PKL_PASS_AST,
-                                pkl_ast_type_equal (isa_type, isa_exp_type));
+                                pkl_ast_type_equal_p (isa_type, isa_exp_type));
 
 
       PKL_AST_TYPE (bool_node) = ASTREF (bool_type);
@@ -489,7 +489,7 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_cast)
   /* Only arrays can be casted to arrays.  Also, only array boundaries
      may differ.  */
   if (PKL_AST_TYPE_CODE (type) == PKL_TYPE_ARRAY
-      && !pkl_ast_type_equal (type, exp_type))
+      && !pkl_ast_type_equal_p (type, exp_type))
     {
       char *type_str = pkl_type_str (type, 1);
       char *found_type_str = pkl_type_str (exp_type, 1);
@@ -506,7 +506,7 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_cast)
   /* Arrays can only be casted to other arrays of the right type,
      i.e. only array boundaries may differ.  */
   if (PKL_AST_TYPE_CODE (exp_type) == PKL_TYPE_ARRAY
-      && !pkl_ast_type_equal (type, exp_type))
+      && !pkl_ast_type_equal_p (type, exp_type))
     {
       char *type_str = pkl_type_str (type, 1);
       char *found_type_str = pkl_type_str (exp_type, 1);
@@ -745,8 +745,8 @@ TYPIFY_BIN (sub);
   {                                                             \
   /* The type of the elements of the operand arrays */          \
     /* should be the same.  */                                  \
-    if (!pkl_ast_type_equal (PKL_AST_TYPE_A_ETYPE (t1),         \
-                             PKL_AST_TYPE_A_ETYPE (t2)))        \
+    if (!pkl_ast_type_equal_p (PKL_AST_TYPE_A_ETYPE (t1),       \
+                               PKL_AST_TYPE_A_ETYPE (t2)))      \
       {                                                         \
         char *t1_str = pkl_type_str (t1, 1);                    \
         char *t2_str = pkl_type_str (t2, 1);                    \
@@ -1134,7 +1134,7 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_array)
 
       if (type == NULL)
         type = PKL_AST_TYPE (initializer);
-      else if (!pkl_ast_type_equal (PKL_AST_TYPE (initializer), type))
+      else if (!pkl_ast_type_equal_p (PKL_AST_TYPE (initializer), type))
         {
           PKL_ERROR (PKL_AST_LOC (array),
                      "array initializers should be of the same type");
@@ -2134,7 +2134,7 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_print_stmt)
             {
               pkl_ast_node arg_type = PKL_AST_TYPE (arg_exp);
 
-              if (!pkl_ast_type_equal (arg_type, type))
+              if (!pkl_ast_type_equal_p (arg_type, type))
                 {
                   if (PKL_AST_TYPE_CODE (type) == PKL_TYPE_ANY
                       || (PKL_AST_TYPE_CODE (type) == PKL_TYPE_INTEGRAL
@@ -2699,7 +2699,7 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_cond_exp)
       && PKL_AST_TYPE_S_ITYPE (cond_type))
     cond_type = PKL_AST_TYPE_S_ITYPE (cond_type);
 
-  if (!pkl_ast_type_equal (then_type, else_type))
+  if (!pkl_ast_type_equal_p (then_type, else_type))
     {
       PKL_ERROR (PKL_AST_LOC (cond_exp),
                  "alternatives in conditional expression shall be of\n"
-- 
2.25.0.2.g232378479e




reply via email to

[Prev in Thread] Current Thread [Next in Thread]