Hi Philip,

On Thu, Sep 02, 2021 at 02:23:33PM +0100, Philip Herron wrote:
> 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 wasn't sure whether to replicate this for the HIR classes, so at
first I did it with a lambda, but found that not very nice. So instead
I added simple accessors for the fields vector which are the used in
in a simple for loop using get () on the elements. If you also like
that better I can change the AST classes to do the same thing.

> I also noticed quite a few test cases already are these compiling?

Yes, but they are all "negative" tests. I mean, that they check for
errors. After resolving we can check for unused enum item
warnings. After lowering we can detect bad visibility and duplicate
fields in struct variants. And after typechecking (not finished yet)
we can check the denominators of fieldless enums are unique (and
aren't too big).

> you have to add much to the rust-gcc.cc wrapper for the enum type?

I am still stuck at the type check pass. So haven't actually gotten to
that part.

I'll sent the parser, resolve and hit lowering bits, which include the
test cases.

These patches are also on
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