poke-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 1/5] pkl: Postpone decision of completeness of a struct liter


From: Jose E. Marchesi
Subject: Re: [PATCH 1/5] pkl: Postpone decision of completeness of a struct literals
Date: Sun, 23 Jan 2022 19:03:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Hi, Jose
>
> On Sun, Jan 23, 2022 at 03:22:29PM +0100, Jose E. Marchesi wrote:
>> 
>> > 2022-01-22  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
>> >
>> >    * libpoke/pkl-typify.c (pkl_typify1_ps_struct): Postpone type
>> >    completion decision to `pkl_typify2_ps_type` phase.
>> > ---
>> >  ChangeLog            | 5 +++++
>> >  libpoke/pkl-typify.c | 5 +----
>> >  2 files changed, 6 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/ChangeLog b/ChangeLog
>> > index ee3e304c..fc088bc9 100644
>> > --- a/ChangeLog
>> > +++ b/ChangeLog
>> > @@ -1,3 +1,8 @@
>> > +2022-01-22  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
>> > +
>> > +  * libpoke/pkl-typify.c (pkl_typify1_ps_struct): Postpone type
>> > +  completion decision to `pkl_typify2_ps_type` phase.
>> > +
>> >  2022-01-22  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
>> >  
>> >    * libpoke/pkl-typify.c (pkl_typify1_ps_funcall): When the arg
>> > diff --git a/libpoke/pkl-typify.c b/libpoke/pkl-typify.c
>> > index fa621aa6..28ee181b 100644
>> > --- a/libpoke/pkl-typify.c
>> > +++ b/libpoke/pkl-typify.c
>> > @@ -1206,7 +1206,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_struct)
>> >    pkl_ast_node node = PKL_PASS_NODE;
>> >    pkl_ast_node type;
>> >    pkl_ast_node t, struct_field_types = NULL;
>> > -  int type_complete = 1;
>> >  
>> >    /* Build a chain with the types of the struct fields.  */
>> >    for (t = PKL_AST_STRUCT_FIELDS (node); t; t = PKL_AST_CHAIN (t))
>> > @@ -1223,8 +1222,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_struct)
>> >  
>> >        struct_field_types = pkl_ast_chainon (struct_field_types,
>> >                                              struct_type_field);
>> > -      if (!PKL_AST_TYPE_COMPLETE (PKL_AST_TYPE (t)))
>> > -        type_complete = 0;
>> >      }
>> >  
>> >    /* Build the type of the struct.  */
>> > @@ -1237,7 +1234,7 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_struct)
>> >                                     0 /* pinned */,
>> >                                     0 /* union */);
>> >    PKL_AST_TYPE (node) = ASTREF (type);
>> > -  PKL_AST_TYPE_COMPLETE (type) = type_complete;
>> > +  PKL_PASS_RESTART = 1;
>> 
>> Why this restart?
>> 
>
> We're creating new nodes using `pkl_ast_make_struct_type_field`.
> The code above is like this:
>
> ```c
>       pkl_ast_node struct_type_field
>         = pkl_ast_make_struct_type_field (PKL_PASS_AST,
>                                           PKL_AST_STRUCT_FIELD_NAME (t),
>                                           PKL_AST_TYPE (t),
>                                           NULL /* constraint */,
>                                           NULL /* initializer */,
>                                           NULL /* label */,
>                                           PKL_AST_ENDIAN_DFL /* endian */,
>                                           NULL /* optcond */);
>
>       struct_field_types = pkl_ast_chainon (struct_field_types,
>                                             struct_type_field);
> ```
>
> I think thse new fields should be processed.

You are right :)



reply via email to

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