Граф коммитов

380 Коммитов

Автор SHA1 Сообщение Дата
Kevin Newton 8333845b0b [ruby/prism] Unary symbols that cannot be binary should drop @
https://github.com/ruby/prism/commit/d139af033f
2024-01-10 20:24:31 +00:00
Aaron Patterson f165fa09e7 [ruby/prism] address feedback
https://github.com/ruby/prism/commit/ed183ad30c
2024-01-10 15:24:26 +00:00
Aaron Patterson 881c5a1846 [ruby/prism] Add a "repeated flag" to parameter nodes
It's possible to repeat parameters in method definitions like so:

```ruby
def foo(_a, _a)
end
```

The compiler needs to know to adjust the local table size to account for
these duplicate names.  We'll use the repeated parameter flag to account
for the extra stack space required

https://github.com/ruby/prism/commit/b443cb1f60

Co-Authored-By: Kevin Newton <kddnewton@gmail.com>
Co-Authored-By: Jemma Issroff <jemmaissroff@gmail.com>
2024-01-10 15:24:26 +00:00
Kevin Newton 80da9b1547 [ruby/prism] Clarify __END__ comment
https://github.com/ruby/prism/commit/3e36d5eabc
2024-01-09 19:02:26 +00:00
Kevin Newton 88d7838445 [ruby/prism] Fix assertion on spanning heredocs
https://github.com/ruby/prism/commit/e190308845
2024-01-09 15:15:52 +00:00
Matthew Healy c39c49cb24 [ruby/prism] Add missing comment key
https://github.com/ruby/prism/commit/723480a107
2024-01-08 18:47:18 +00:00
matthew healy eef74d8367 [ruby/prism] Fix spacing in documentation comment
https://github.com/ruby/prism/commit/8408961e76

Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2024-01-08 18:47:17 +00:00
Matthew Healy d02455afc1 [ruby/prism] Add comments documenting RangeNode fields
https://github.com/ruby/prism/commit/e6aef6499b
2024-01-08 18:47:17 +00:00
matthew healy 1e7d1da3b0 [ruby/prism] Clarify keys and values in AssocNode must be non-void
https://github.com/ruby/prism/commit/0caca53a2c

Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2024-01-08 18:47:06 +00:00
Matthew Healy b57c5e560e [ruby/prism] Add comments for AssocSplatNode fields
https://github.com/ruby/prism/commit/a0fd874848
2024-01-08 18:47:06 +00:00
Matthew Healy 04ae8fb3a9 [ruby/prism] Add comments for AssocNode fields
https://github.com/ruby/prism/commit/fb60072a1e
2024-01-08 18:47:06 +00:00
Matthew Healy 7e09dd433b [ruby/prism] Add comments for HashNode fields
https://github.com/ruby/prism/commit/649e209519
2024-01-08 18:47:05 +00:00
Kevin Newton d1d50a0505 [ruby/prism] Handle parsing a line break in a receiver of a method
https://github.com/ruby/prism/commit/4d5f43ecbc
2024-01-08 14:34:59 +00:00
Benoit Daloze 7304d56236 [ruby/prism] Include field comments in Java source
https://github.com/ruby/prism/commit/4a9389f304
2024-01-03 20:00:18 +00:00
TSUYUSATO Kitsune a25329e0da [ruby/prism] Fix parsing pinned local variable pattern for numbered parameter
Fix https://github.com/ruby/prism/pull/2094

The part of `parse_variable_call` for variables was split into a new
function `parse_variable` and used it.

https://github.com/ruby/prism/commit/4c5fd1a746
2024-01-03 17:20:33 +00:00
Kevin Newton 0215965df4 [ruby/prism] Better error recovery for content after unterminated heredoc
https://github.com/ruby/prism/commit/c2d325a886
2024-01-03 16:46:08 +00:00
Kevin Newton a1d0c621e9 [ruby/prism] More spacing in config.yml
https://github.com/ruby/prism/commit/825ff8b9ec
2024-01-03 16:44:38 +00:00
Kevin Newton ca2a6b7d4d [ruby/prism] Spacing in config.yml
https://github.com/ruby/prism/commit/983561988e
2024-01-03 16:44:37 +00:00
Sanjay Karukamanna 06a65ce641 [ruby/prism] Document `IntegerNode` fields
https://github.com/ruby/prism/commit/77280b2807
2024-01-03 16:44:37 +00:00
Kevin Newton e46922e48f [ruby/prism] Introduce field comments
In an effort to further improve our documentation, this commit
introduces the concept of templating comments onto fields. I hope
to get more documentation above the nuances of specific fields this
way going forward.

With this, we template the comments into C and Ruby. I haven't done
JS or Java yet, but we can touch those in the future, especially
once their documentation is published.

https://github.com/ruby/prism/commit/af300d5fb3
2024-01-02 21:16:35 +00:00
Kevin Newton adbfbd822f [ruby/prism] Ignore visibility flag
https://github.com/ruby/prism/commit/55b049ddac
2024-01-02 20:59:19 +00:00
Kevin Newton 380c218bfa [ruby/prism] Do not add error for forwarding in CRuby 3.3.0
https://github.com/ruby/prism/commit/a28e57c650
2024-01-02 19:10:43 +00:00
TSUYUSATO Kitsune 0ee625ceae [ruby/prism] Fix to check multiple block arguments for forwarding arg
Fix https://github.com/ruby/prism/pull/2111

https://github.com/ruby/prism/commit/21ca243d0a
2024-01-02 19:08:15 +00:00
Kevin Newton 165deec5fe [ruby/prism] Document the version option on prism parse
https://github.com/ruby/prism/commit/eddd72a8ef
2024-01-02 18:59:26 +00:00
Kevin Newton 23beceedb7 [ruby/prism] IndexTargetNode should always have ATTRIBUTE_WRITE
Because this is a user-facing change, we also need to deal with the
fact that CRuby 3.3.0 was just released.

In order to support workflows that want to parse exactly as CRuby
parses in a specific version, this PR introduces a new option to
the options struct that is "version". This allows you to specify
that you want "3.3.0" parsing.

I'm not sure if this is the correct solution. Another solution is
to just fork and keep around the old branch for security patches.
Or we could keep around a copy of the source files within this
repository as another directory and only update when necessary.
There are a lot of potential solutions here.

Because this change is so small and the check for it is so minimal,
I've decided to go with this enum. If this ends up entirely
cluttering the codebase with version checks, we'll come up with
another solution. But for now this works, so we're going to go in
this direction for a bit until we determine it's no longer working.

https://github.com/ruby/prism/commit/d8c7e6bd10
2024-01-02 18:51:18 +00:00
Kevin Newton 28ec79404a
Sync to latest prism 2024-01-02 11:34:04 -05:00
Hiroshi SHIBATA fa251d60aa Revert "Revert all of commits after Prism 0.19.0 release"
This reverts commit d242e8416e.
2023-12-25 21:12:49 +09:00
Hiroshi SHIBATA d242e8416e
Revert all of commits after Prism 0.19.0 release
We should bundle released version of Prism for Ruby 3.3.0
2023-12-16 11:08:51 +08:00
Gopal Patel b9542246c9 [ruby/prism] Fix majority of RBS type mismatches
https://github.com/ruby/prism/commit/62cc50e41b
2023-12-15 21:14:58 +00:00
eileencodes 2e8cfcac91 [ruby/prism] String literal hash keys should be frozen
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
2023-12-15 20:55:13 +00:00
Ufuk Kayserilioglu 0a31cb1a37 [ruby/prism] Finish keyword hash node flag refactor by renaming flag
https://github.com/ruby/prism/commit/7f812389f8
2023-12-15 18:45:36 +00:00
Kevin Newton f38814564b [ruby/prism] Fix eval parsing depth
https://github.com/ruby/prism/commit/89bf7a4948
2023-12-15 15:19:50 +00:00
Kevin Newton fe9b42f024 [ruby/prism] Invalid pinned locals in pattern matching
https://github.com/ruby/prism/commit/3a67b37a56
2023-12-15 15:03:49 +00:00
Kevin Newton 854ff25f4f [ruby/prism] Add TODO comment
https://github.com/ruby/prism/commit/885d1d78cb
2023-12-15 13:26:40 +00:00
TSUYUSATO Kitsune 16830a4783 [ruby/prism] Add an error for `in` keyword in arguments
Fix https://github.com/ruby/prism/pull/2026

https://github.com/ruby/prism/commit/c4b41cd477
2023-12-15 13:25:54 +00:00
Kevin Newton 8bbe835cd8
Bump prism to version 0.19.0 2023-12-14 15:06:09 -05:00
Kevin Newton 019fff3a86 [ruby/prism] Fix parse result for nesting pattern matching
https://github.com/ruby/prism/commit/ee6fc9ee87
2023-12-14 18:54:46 +00:00
Ufuk Kayserilioglu 01f21d5729 [ruby/prism] Fix the implementation of the flag on keyword hash nodes
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
2023-12-14 18:05:54 +00:00
TSUYUSATO Kitsune 3658798dbb [ruby/prism] Make equality operators non-associative
Fix https://github.com/ruby/prism/pull/2073

https://github.com/ruby/prism/commit/0f747d9240
2023-12-14 16:39:05 +00:00
Kevin Newton b7e89d4b17 [ruby/prism] Fix hash pattern rest
https://github.com/ruby/prism/commit/43c4232cfc
2023-12-14 02:43:32 +00:00
Alex Koval 36ca99b343 [ruby/prism] fix typo in docs
https://github.com/ruby/prism/commit/d7fbc09345
2023-12-13 12:17:57 +00:00
Ufuk Kayserilioglu e96f6126f2 [ruby/prism] Fix hash deopt based on contents
The previous implementation of hash deopt was based on clearing the static literal flag on a hash node if the element that was being added was an array, hash or range node, or if the element was not a static literal in the first place.

However, this is not correct. First of all, the elements added to a hash node will primarily be assoc nodes, but never array, hash or range nodes. Secondly, the static literal flag is set on assoc nodes, only if the value in an assoc node is a static literal, so the key is never checked. As a result, the static literal flag on a hash node would never be cleared if the key wasn't a static literal.

This commit fixes this by clearing the static literal flag if:
1. the element is not an assoc node,
2. the element is an assoc node, but the key is not a static literal, or
3. the element is an assoc node, the key is a static literal, but assoc node (and thus the value in assoc node) is not a static literal.

https://github.com/ruby/prism/commit/7f67109b36
2023-12-13 00:21:42 +00:00
Kevin Newton f61df27b4c [ruby/prism] Use new flag setters for attribute write
https://github.com/ruby/prism/commit/1e07832778
2023-12-12 18:43:59 +00:00
Ufuk Kayserilioglu 1f22245ed5 [ruby/prism] Start using flag macros/methods exclusively
https://github.com/ruby/prism/commit/5f05a6fe83
2023-12-12 17:35:53 +00:00
Ufuk Kayserilioglu bdb38dd9f2 [ruby/prism] Add methods for setting/unsetting and macros for testing a flags
https://github.com/ruby/prism/commit/e5f37d1407
2023-12-12 17:35:52 +00:00
Kevin Newton 278ce27ee4 [ruby/prism] Flag for attribute write on calls
https://github.com/ruby/prism/commit/465731969c
2023-12-12 15:55:54 +00:00
Ufuk Kayserilioglu 43229d531f [ruby/prism] Start `KeywordHashNode`s with `STATIC_KEYS` set, until hit an element that should clear it
https://github.com/ruby/prism/commit/7c7c486507
2023-12-12 13:05:09 +00:00
Ufuk Kayserilioglu 25b9a0cbc8 [ruby/prism] Add `STATIC_KEYS` flag for `KeywordHashNode`
https://github.com/ruby/prism/commit/aa83de39c1
2023-12-12 13:05:08 +00:00
Kevin Newton 4095e7d2be [ruby/prism] Regexp terminator escapes
https://github.com/ruby/prism/commit/42a48a2ba9
2023-12-11 16:34:55 +00:00
Kevin Newton c65de63913 [ruby/prism] Handle a non-interpolated dsym spanning a heredoc
https://github.com/ruby/prism/commit/b23136ebfd
2023-12-11 16:34:41 +00:00