Hi Mark,

I've been reviewing your branch a bit and noticed this commit
https://code.wildebeest.org/git/user/mjw/gccrs/commit/?h=enums&id=84d27b926e09ef44dd94be20c97d72bd4b865c40
which I really like. I wasn't sure what was the best way to interact with
the AST which contained unique_ptr's to things so I initially added little
lambda's but these don't really help anything at all other than make it
more confusing to work with. So feel free to create patches to remove those.

I also noticed quite a few test cases already are these compiling? And did
you have to add much to the rust-gcc.cc wrapper for the enum type?

Thanks,
--Phil

On Wed, 1 Sept 2021 at 20:24, Mark Wielaard <m...@klomp.org> wrote:

> Hi,
>
> On Wed, Sep 01, 2021 at 11:11:46AM +0100, Philip Herron wrote:
> > This is fantastic work Mar. This brings us closer to the AST structures
> of
> > rustc and does simplify a lot of the analysis within the compiler.
> > https://doc.rust-lang.org/nightly/reference/expressions/struct-expr.html
>
> The reference does change from time to time. The older one did
> describe various constructs that the newer does and for some it still
> has comments saying some construct doesn't really construct, like the
> tuple expression, which is simply a call (constructor) expression.  I
> don't know if there is some kind of change log for the Rust reference.
>
> Note that there are some more StructExpr cleanups at:
> https://github.com/Rust-GCC/gccrs/pull/405
> Which might be nice to finish.
>
> > I agree the HIR cleanup will also help reduce a lot of duplication of
> code
> > and visitors. It might mean we get alot of enum stuff for free
> potentially.
>
> Potentially yes, but in practice enum item variants are different
> enough to require lots of new code. I have patches for the parser,
> resolver, and ast-hir-lowering and working on type-checking. One
> tricky issue is that references to an enum item are paths with the
> enum name first and the enum item second (Enum::Item). Which is
> somewhat more complex than the IdentifierExpr. Another is that a
> struct has one constructor, an enum has multiple (depending on the
> enum item variant). So you need to add variants to the ADTType.
>
> Work in progress at
> https://code.wildebeest.org/git/user/mjw/gccrs/log/?h=enums
> cleaned up patches (that I hope are correct) at
> https://code.wildebeest.org/git/user/mjw/gccrs/log/?h=enums2
>
> Cheers,
>
> Mark
>
>
-- 
Gcc-rust mailing list
Gcc-rust@gcc.gnu.org
https://gcc.gnu.org/mailman/listinfo/gcc-rust

Reply via email to