[pull] master from ruby:master - #1255
Merged
Merged
Conversation
parse_expression_terminator runs after every infix operator and called pm_block_call_p, which walks the whole receiver chain, even when the binding power alone already decided the result. Check the binding power first; pm_block_call_p is pure, so the condition is unchanged. Parsing "a" followed by 8000 ".b" links drops from 44.8ms to 0.46ms. ruby/prism@8a40a928a8 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… parser translator There's some special handling in regards to empty symbols and those containing newlines that should apply here. Makes it produce the correct amount of sym/dsym nodes ruby/prism@8b567cc403
The example shows the result as `+4`, but the operation returns a buffer of
the same size as the source, which is 10 bytes here:
$ ruby -e 'p((IO::Buffer.for("1234567890") & IO::Buffer.for("\xFF\x00\x00\xFF")).size)'
10
The rest of the example is already correct. The hex dump and the ASCII column
show all 10 bytes, and the description right above says "Generate a new buffer
the same size as the source", so the example contradicts both. The size of the
mask is 4, which is likely where the number came from.
The neighbouring examples for #|, #^ and #~ all show `+10` and need no change.
…18089) The call-seq of IO::Buffer#<=> says it returns "true or false", but rb_io_buffer_compare always returns an integer: -1 or 1 when the sizes differ, and the result of memcmp as is when the sizes are equal. Since the value comes straight from memcmp it is not normalized to -1, 0 or 1, so only its sign is meaningful. p(IO::Buffer.for("abc") <=> IO::Buffer.for("abc")) # => 0 p(IO::Buffer.for("abc") <=> IO::Buffer.for("ab")) # => 1 p(IO::Buffer.for("abc") <=> IO::Buffer.for("abz")) # => -23 IO::Buffer#hexdump returns nil when the buffer does not reference any memory, that is, when #null? returns true, but this was not documented. buffer = IO::Buffer.new(4) buffer.free p buffer.hexdump # => nil
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )