79876 Commits

Author SHA1 Message Date
Kevin Newton
b1a28b05db Support local variable targeting in pattern matching 2023-09-28 15:13:09 -04:00
Kevin Newton
41d3e23582 Support the AlternationPatternNode 2023-09-28 15:13:09 -04:00
Kevin Newton
64da9be3af Fill in other missing pattern matching expression types 2023-09-28 15:13:09 -04:00
Kevin Newton
6e88a56f63 Compile basic pattern matching expressions 2023-09-28 15:13:09 -04:00
Kevin Newton
223e9fcb27 [ruby/prism] Self should not be marked as static literal
https://github.com/ruby/prism/commit/81265ed8a7
2023-09-28 18:51:26 +00:00
Peter Zhu
cc6ffceeec [ruby/open3] [DOC] RDoc for Open3 2023-09-28 14:37:44 -04:00
Kevin Newton
56cf1633a2 [ruby/prism] Turn on static literal for assoc, hash, and array nodes
https://github.com/ruby/prism/commit/80c2c931b5
2023-09-28 18:15:35 +00:00
Nobuyoshi Nakada
eaa0fbf9b9 Fix retry in nested rescue blocks
Restore `rescue`-context from the outer context.
`retry` targets the next outer block except for between `rescue` and
`else` or `ensure`, otherwise, if there is no enclosing block, it
should be syntax error.
2023-09-29 03:14:17 +09:00
Kevin Newton
5a376f0f71 Consolidate regexp options, interpolated match last line 2023-09-28 14:11:34 -04:00
Aaron Patterson
d3574c117a Move IO#readline to Ruby
This commit moves IO#readline to Ruby.  In order to call C functions,
keyword arguments must be converted to hashes.  Prior to this commit,
code like `io.readline(chomp: true)` would allocate a hash.  This
commits moves the keyword "denaturing" to Ruby, allowing us to send
positional arguments to the C API and avoiding the hash allocation.

Here is an allocation benchmark for the method:

```
x = GC.stat(:total_allocated_objects)
File.open("/usr/share/dict/words") do |f|
  f.readline(chomp: true) until f.eof?
end
p ALLOCATIONS: GC.stat(:total_allocated_objects) - x
```

Before this commit, the output was this:

```
$ make run
./miniruby -I./lib -I. -I.ext/common  -r./arm64-darwin22-fake  ./test.rb
{:ALLOCATIONS=>707939}
```

Now it is this:

```
$ make run
./miniruby -I./lib -I. -I.ext/common  -r./arm64-darwin22-fake  ./test.rb
{:ALLOCATIONS=>471962}
```

[Bug #19890] [ruby-core:114803]
2023-09-28 10:43:45 -07:00
Nobuyoshi Nakada
655bcee95a
[DOC] Add link 2023-09-29 02:32:04 +09:00
Jean Boussier
2e4e4c82c2 Add a mention about Socket#recv in NEWS.md
[Misc #19012]
2023-09-28 19:26:56 +02:00
Nobuyoshi Nakada
809b67bd91
Add indentation to ignore revs [ci skip] 2023-09-29 00:57:09 +09:00
Nobuyoshi Nakada
d2c5867357
Fix up indentation [ci skip] 2023-09-29 00:55:43 +09:00
Matt Valentine-House
414c781158 [YARP] Implement MatchWriteNode 2023-09-28 16:51:30 +01:00
Kevin Newton
f4580ce95c
Fix order-dependent tests in test_compile_prism 2023-09-28 10:23:12 -04:00
tomoya ishida
d4942546af [ruby/reline] Properly restore Reline::IOGate in test teardown
(https://github.com/ruby/reline/pull/593)

* Properly restore Reline::IOGate in test teardown

* GeneralIO.reset should reset class variable existence

https://github.com/ruby/reline/commit/c16d33dae5
2023-09-28 13:53:30 +00:00
Kevin Newton
20c561fe0c
Add indentation to ignore revs 2023-09-28 09:48:26 -04:00
Kevin Newton
40b2c8e5e7
Fix up indentation in prism_compile.c 2023-09-28 09:47:46 -04:00
Kevin Newton
a213d21448 Move CRuby-specific prism files to top level 2023-09-28 09:44:16 -04:00
Haldun Bayhantopcu
834560a923 [ruby/prism] Check whether the predicate is closed for conditionals
https://github.com/ruby/prism/commit/bf43006d0a
2023-09-28 13:32:02 +00:00
Haldun Bayhantopcu
7799fe90da [ruby/prism] Check for a semicolon or a newline after the inheritance operator
https://github.com/ruby/prism/commit/0326ba6775
2023-09-28 13:31:22 +00:00
Haldun Bayhantopcu
0084bac47a [ruby/prism] Fix assertion failure for fwd params after rest
https://github.com/ruby/prism/commit/f86bff6dd7
2023-09-28 13:24:57 +00:00
Nobuyoshi Nakada
bf335bcb11
Requires ruby/rbs#1550 2023-09-28 17:53:02 +09:00
Nobuyoshi Nakada
b5e23d3e3b
Syntax check of yield in the parser 2023-09-28 16:23:51 +09:00
Nobuyoshi Nakada
ad96962173
Jumps are possible in the top-level loop 2023-09-28 15:12:27 +09:00
Nobuyoshi Nakada
a790f83bac
Suppress void context warnings in verbose mode 2023-09-28 14:30:10 +09:00
Burdette Lamar
e9bc51966b
[DOC] RDoc for Open3.popen3 (#8521) 2023-09-27 23:02:00 -04:00
yui-knk
74c6781153 Change RNode structure from union to struct
All kind of AST nodes use same struct RNode, which has u1, u2, u3 union members
for holding different kind of data.
This has two problems.

1. Low flexibility of data structure

Some nodes, for example NODE_TRUE, don’t use u1, u2, u3. On the other hand,
NODE_OP_ASGN2 needs more than three union members. However they use same
structure definition, need to allocate three union members for NODE_TRUE and
need to separate NODE_OP_ASGN2 into another node.
This change removes the restriction so make it possible to
change data structure by each node type.

2. No compile time check for union member access

It’s developer’s responsibility for using correct member for each node type when it’s union.
This change clarifies which node has which type of fields and enables compile time check.

This commit also changes node_buffer_elem_struct buf management to handle
different size data with alignment.
2023-09-28 11:58:10 +09:00
git
684686a1e1 Update bundled gems list at 2023-09-28 2023-09-28 02:47:00 +00:00
Soutaro Matsumoto
b72e320733
Bundle RBS 3.2.2 2023-09-28 11:30:08 +09:00
Nobuyoshi Nakada
81c0d0e2fb
[CI] Fix conditional for RUBYOPT
Since GitHub has no real ternary [operator], the second expression
must be "truthy" value instead of an empty string which is evaluated
as `0`.

- Some bundler tests seem trying to install old Rack where
  `Rack::Utils.byte_ranges` method has been deprecated once.

- Racc tests do not seem aware about warnings very well.

[operator]: https://docs.github.com/actions/learn-github-actions/expressions#operators
2023-09-28 10:10:11 +09:00
Nobuyoshi Nakada
aa6764e66d
[CI] Fix indentation to concatenate the lines and pass the options 2023-09-28 08:16:36 +09:00
Nobuyoshi Nakada
dd5814ed1a
Suppress void context warnings 2023-09-28 08:01:35 +09:00
eileencodes
54bbf9a6e9 [PRISM] Implement MatchLastLineNode
This PR implements `MatchLastLineNode` for Prism.

Related: ruby/prism#1335
2023-09-27 18:36:23 -04:00
Kevin Newton
175ac32c62 Use new constant pool layout for prism 2023-09-27 15:41:05 -04:00
Nathan Froyd
2955513095 [ruby/prism] rearrange the constant pool so IDs can be used for indexing
https://github.com/ruby/prism/commit/6f243de0c7
2023-09-27 15:41:05 -04:00
Nathan Froyd
5b6a51ad9d [ruby/prism] shrink yp_constant_t by 8 bytes
https://github.com/ruby/prism/commit/5c01eb5e6f
2023-09-27 15:41:05 -04:00
Jeremy Evans
62181e17da Make {Queue,SizedQueue}#freeze raise TypeError
Fixes [Bug #17146]
2023-09-27 19:57:50 +01:00
BurdetteLamar
84312e688f [DOC] Fix minor inconsistencies 2023-09-27 14:42:50 -04:00
Kevin Newton
224e76ada7 Include recently added parse_test code in rename 2023-09-27 13:57:38 -04:00
Kevin Newton
3d0a46796b Rename YARP symbols to prism 2023-09-27 13:57:38 -04:00
Kevin Newton
4f73a7c2f7 Sync to prism rename commits 2023-09-27 13:57:38 -04:00
Kevin Newton
8ab56869a6 Rename YARP filepaths to prism filepaths 2023-09-27 13:57:38 -04:00
Kevin Newton
7e0971eb5d Update YARP build targets 2023-09-27 12:10:23 -04:00
Kevin Newton
758e70d3d4 Update YARP gitignore 2023-09-27 12:10:23 -04:00
Kevin Newton
5f905026bc [ruby/yarp] Move node ext and parse result to their own files
https://github.com/ruby/yarp/commit/916828767c
2023-09-27 12:10:23 -04:00
Kevin Newton
7d11f58b6e [ruby/yarp] Move lex compat into its own file
https://github.com/ruby/yarp/commit/e90f88f21f
2023-09-27 12:10:23 -04:00
Kevin Newton
3e8aa3d1cc [ruby/yarp] Move node inspector into its own file
https://github.com/ruby/yarp/commit/1c843d2f22
2023-09-27 12:10:23 -04:00
Kevin Newton
978f91a10c [ruby/yarp] Move debug into its own file
https://github.com/ruby/yarp/commit/139362c90a
2023-09-27 12:10:23 -04:00