Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share reading/validation code between elem exprs & other const exprs #2288

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

keithw
Copy link
Member

@keithw keithw commented Aug 30, 2023

This continues the work from #1783 and reduces special handling of elem exprs, by treating them the same as other const expressions (init expressions).

Fixes #2201 (now allows global.get in an elem expr)

This is a prerequisite for updating the testsuite (spun out from #2287). It seemed cleaner to do it this way than to add a OnElemSegmentElemExpr_GlobalGet to all the readers and validators, given that the validation rules are the same as when global.get appears in any other const expression.

@keithw keithw requested a review from sbc100 August 30, 2023 07:57
@keithw keithw force-pushed the unify-elem-exprs branch 2 times, most recently from 3fca756 to 7d0fd5e Compare August 30, 2023 08:25
@keithw keithw mentioned this pull request Aug 30, 2023
Copy link
Member

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

I've long thought this would be good idea but wan't sure how to make it happen. Thanks.

}

if (expr.insts.empty()) {
PrintDetails("malformed\n");
Copy link
Member

@sbc100 sbc100 Sep 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we do this kind of things elsewhere in this file? How about <MALFORMED> to be extra clear?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I went with <EMPTY> to be safe -- on further review I don't think an empty const expression is malformed, just invalid.

This continues the work from #1783 and reduces special handling of elem
exprs, by treating them the same as other const expressions (init
expressions).

Fixes #2201 (now allows global.get in an elem expr)
@keithw keithw enabled auto-merge (squash) September 6, 2023 22:35
@keithw keithw merged commit ab05e50 into main Sep 6, 2023
@keithw keithw deleted the unify-elem-exprs branch September 6, 2023 22:54
@keithw keithw mentioned this pull request Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Is global.get allowed in element segments?
2 participants