| Age | Commit message (Collapse) | Author |
|
This is follow-up for 7c315e23983a35d29108d9ba8c914d6320254d43.
|
|
We should bundle released version of Prism for Ruby 3.3.0
|
|
String literal hash keys can't be mutated by the user so we should mark
them as frozen. We were seeing instructions for hashes with string
literal keys using two `putstring` instructions when it should be a
`putobject` and `putstring`.
Code example:
```ruby
{ "a" => "b" }
```
Instructions before:
```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(2,14)>
0000 putobject "a" ( 2)[Li]
0002 putstring "b"
0004 newhash 2
0006 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(1,14)>
0000 putstring "a" ( 1)[Li]
0002 putstring "b"
0004 newhash 2
0006 leave
```
Instructions after:
```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(2,14)>
0000 putobject "a" ( 2)[Li]
0002 putstring "b"
0004 newhash 2
0006 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(1,14)>
0000 putobject "a" ( 1)[Li]
0002 putstring "b"
0004 newhash 2
0006 leave
```
https://github.com/ruby/prism/commit/b14ae55385
|
|
https://github.com/ruby/prism/commit/7f812389f8
|
|
https://github.com/ruby/prism/commit/89bf7a4948
|
|
https://github.com/ruby/prism/commit/3a67b37a56
|
|
Fix https://github.com/ruby/prism/pull/2026
https://github.com/ruby/prism/commit/c4b41cd477
|
|
https://github.com/ruby/prism/commit/ee6fc9ee87
|
|
The previous implementation was incorrect since it was just checking for all keys in assoc nodes to be static literals but the actual check is that all keys in assoc nodes must be symbol nodes.
This commit fixes that implementation, and, also, aliases the flag to `PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS` so that ruby/ruby can start using the new flag name.
I intend to later change the real flag name to `PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS` and remove the alias.
https://github.com/ruby/prism/commit/f5099c79ce
|
|
Fix https://github.com/ruby/prism/pull/2073
https://github.com/ruby/prism/commit/0f747d9240
|
|
https://github.com/ruby/prism/commit/43c4232cfc
|
|
https://github.com/ruby/prism/commit/465731969c
|
|
https://github.com/ruby/prism/commit/0663e2bcfa
|
|
https://github.com/ruby/prism/commit/42a48a2ba9
|
|
https://github.com/ruby/prism/commit/b23136ebfd
|
|
In this commit we're splitting up the call nodes that were in target
positions (that is, for loop indices, rescue error captures, and
multi assign targets).
Previously, we would simply leave the call nodes in place. This had
the benefit of keeping the AST relatively simple, but had the
downside of not being very explicit. If a static analysis tool wanted
to only look at call nodes, it could easily be confused because the
method would have 1 fewer argument than it would actually be called
with.
This also brings some consistency to the AST. All of the nodes in
a target position are now *TargetNode nodes. These should all be
treated the same, and the call nodes can now be treated the same.
Finally, there is benefit to memory. Because being in a target
position ensures we don't have some fields, we can strip down the
number of fields on these nodes.
So this commit introduces two new nodes: CallTargetNode and
IndexTargetNode. For CallTargetNode we get to drop the opening_loc,
closing_loc, arguments, and block. Those can never be present. We
also get to mark their fields as non-null, so they will always be
seen as present.
The IndexTargetNode keeps around most of its fields but gets to
drop both the name (because it will always be []=) and the
message_loc (which was always super confusing because it included
the arguments by virtue of being inside the []).
Overall, this adds complexity to the AST at the expense of memory
savings and explicitness. I believe this tradeoff is worth it in
this case, especially because these are very much not common nodes
in the first place.
https://github.com/ruby/prism/commit/3ef71cdb45
|
|
Fix https://github.com/ruby/prism/pull/2034
https://github.com/ruby/prism/commit/8280e577fa
|
|
Fix https://github.com/ruby/prism/pull/2022
Fix https://github.com/ruby/prism/pull/2030
https://github.com/ruby/prism/commit/b78d8b6525
|
|
https://github.com/ruby/prism/commit/a28b427dcc
|
|
This doesn't actually fix the encodings for symbols and regex,
unfortunately. But I wanted to get this change in because it is
the last AST change we're going to make before 3.3 is released.
So, if consumers want, they can start to check these flags to
determine the encoding, even though it will be wrong. Then once we
actually set them correctly, everything should work.
https://github.com/ruby/prism/commit/9b35f7e891
|
|
https://github.com/ruby/prism/commit/1ed07a0c6d
|
|
https://github.com/ruby/prism/commit/d711950d5f
|
|
https://github.com/ruby/prism/commit/e30a241fb3
|
|
https://github.com/ruby/prism/commit/864b06f90e
|
|
https://github.com/ruby/prism/commit/ef512ca914
|
|
https://github.com/ruby/prism/commit/6e69a81737
|
|
Fix https://github.com/ruby/prism/pull/1974
https://github.com/ruby/prism/commit/453d403593
|
|
https://github.com/ruby/prism/commit/e838eaff6f
|
|
The locals_body_index gives the index in the locals array where
the locals from the body start. This allows compilers to easily
index past the parameters in the locals array.
https://github.com/ruby/prism/commit/5d4627b890
|
|
https://github.com/ruby/prism/commit/5f0ea09785
|
|
It's possible to write the following and have it be valid Ruby:
```
defined?("foo"
)
```
But Prism wasn't taking the new line into account. This adds an
`accept1` for a `PM_TOKEN_NEWLINE` to account for this. I've also
updated the fixtures and snapshots to test this.
https://github.com/ruby/prism/commit/b87f8eedc6
|
|
https://github.com/ruby/prism/commit/e91f8dbb99
|
|
https://github.com/ruby/prism/commit/d5453f168e
|
|
Fix https://github.com/ruby/prism/pull/1468
Fix https://github.com/ruby/prism/pull/1575
To decide command-style method calls are allowed, this introduce a new
parameter `accepts_command_call` to `parse_expression` and some
functions.
Although one think this can be solved by operator precedence, it is
hard or impossible, because the precedence of command-style calls is skewed
(e.g. `! bar 1 ` is accepted, but `foo = ! bar 1` is rejected.)
One of the most complex examples is that:
(1) even though `foo = bar = baz 1` and `foo, bar = baz 1` is accepted,
(2) `foo, bar = baz = fuzz 1` is rejected.
To implement this behavior, this introduces a new binding power
`PM_BINDING_POWER_MULTI_ASSIGNMENT` and uses it for distinguish which single
assignments or multi assignments at their RHS.
https://github.com/ruby/prism/commit/d4dd49ca81
|
|
https://github.com/ruby/prism/commit/5f70b32b02
|
|
Fix https://github.com/ruby/prism/pull/1978
https://github.com/ruby/prism/commit/194c997d0a
|
|
A lot of tools use Ripper/RubyVM::AbstractSyntaxTree to determine
if a source is valid. These tools both create an AST instead of
providing an API that will return a boolean only.
This new API only creates the C structs, but doesn't bother
reifying them into Ruby/the serialization API. Instead it only
returns true/false, which is significantly more efficient.
https://github.com/ruby/prism/commit/7014740118
|
|
https://github.com/ruby/prism/commit/aa8c702271
|
|
https://github.com/ruby/prism/commit/e148e8fe6a
|
|
Previously numbered parameters were a field on blocks and lambdas
that indicated the maximum number of numbered parameters in either
the block or lambda, respectively. However they also had a
parameters field that would always be nil in these cases.
This changes it so that we introduce a NumberedParametersNode that
goes in place of parameters, which has a single uint8_t maximum
field on it. That field contains the maximum numbered parameter in
either the block or lambda.
As a part of the PR, I'm introducing a new UInt8Field type that
can be used on nodes, which is just to make it a little more
explicit what the maximum values can be (the maximum is actually 9,
since it only goes up to _9). Plus we can do a couple of nice
things in serialization like just read a single byte.
https://github.com/ruby/prism/commit/2d87303903
|
|
https://github.com/ruby/prism/commit/f4c80c67dc
|
|
The problem was deeper than just looking back a single token.
You can push the heredoc_end token way back into the list.
We need to save the last location of a heredoc end to see if
it's the last token in the file.
Fixes https://github.com/ruby/prism/pull/1954
https://github.com/ruby/prism/commit/91dfd4eecd
|
|
Fix https://github.com/ruby/prism/pull/1946
This fixes to set an error position for unterminated strings to the
opening delimiters. Previously, the error position was set to the end
of the delimiter.
The same fix applies to other string-like literals.
Additionally, this fixes https://github.com/ruby/prism/pull/1946; that is, it adds the last part of the
string even though the string literal does not terminate.
https://github.com/ruby/prism/commit/c1240baafd
|
|
|
|
https://github.com/ruby/prism/commit/97b296a0f7
|
|
https://github.com/ruby/prism/commit/b9510aed40
|
|
https://github.com/ruby/prism/commit/2d5b9c2b3c
|
|
https://github.com/ruby/prism/commit/edfb54f039
|
|
https://github.com/ruby/prism/commit/ca3ab7ec89
|
|
https://github.com/ruby/prism/commit/4c06b6c42e
|