Skip to content

Allow special case of expandarray with nil#202

Merged
maximecb merged 1 commit intoShopify:mainfrom
jhawthorn:expandarray_nil
Sep 7, 2021
Merged

Allow special case of expandarray with nil#202
maximecb merged 1 commit intoShopify:mainfrom
jhawthorn:expandarray_nil

Conversation

@jhawthorn
Copy link
Copy Markdown
Member

@jhawthorn jhawthorn commented Sep 6, 2021

This adds support for expandarray being passed an explicit nil. I'm really don't like this pattern but ragel seems to generate it.

For example

a, b, c = nil

to set a, b, and c to nil. (🤮 I would prefer a = b = c = nil)

Fortunately, it's at least easy to implement by checking for a known nil type and pushing N nils onto the stack.

It's likely we could support this case for other non-array values being passed, but I'm not sure how common that is.

Found in the ragel generated mail parsers in ruby/ruby-bench#40

@maximecb maximecb merged commit 42755a9 into Shopify:main Sep 7, 2021
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.

2 participants