Skip to content

Optimize literal array used only to call a method #9166

Description

@headius

CRuby introduced an optimization to avoid the array construction for calls like the following:

[1,2].include? foo

We can easily do the same thing, and perhaps expand it to other forms like [1,2,3][foo] or [1,2,3].each {}.

Relates to #9123 to be used for validating that include? and other methods have not been redefined.

See ruby/ruby#12123

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions