| Age | Commit message (Collapse) | Author |
|
[PATCH] Correctly compile splats in for-loop index in prism
Fixes [Bug #21648]
This is a followup to https://github.com/ruby/ruby/pull/13597.
The added test passed but didn't emit the same instructions.
This also handles bare splats and aligns instructions for all cases
|
|
[Bug #21439] Fix `PM_SPLAT_NODE` compilation error in for loops (#13597)
[Bug #21439] Fix PM_SPLAT_NODE compilation error in for loops
This commit fixes a crash that occurred when using splat nodes (*) as
the index variable in for loops. The error "Unexpected node type for
index in for node: PM_SPLAT_NODE" was thrown because the compiler
didn't know how to handle splat nodes in this context.
The fix allows code like `for *x in [[1,2], [3,4]]` to compile and
execute correctly, where the splat collects each sub-array.
|
|
Correctly set node_id on iseq location
The iseq location object has a slot for node ids. parse.y was correctly
populating that field but Prism was not. This commit populates the field
with the ast node id for that iseq
[Bug #21014]
|
|
Allow escaping from ensures through next
Fixes [Bug #21001]
|
|
Fixes [Bug #20973]
Notes:
Merged: https://github.com/ruby/ruby/pull/12408
|
|
Put a pop as needed. This example currently causes [BUG]:
$ ruby --parser=prism -e'1.times{"".freeze;nil}'
-e:1: [BUG] Stack consistency error (sp: 15, bp: 14)
ruby 3.4.0dev (2024-12-20T00:48:01Z master 978df259ca) +PRISM [x86_64-linux]
Notes:
Merged: https://github.com/ruby/ruby/pull/12410
|
|
This fixes the behavioural difference between Prism and parse.y when
evaluating the following code
```ruby
1 in [1 | [1]]
```
Fixes [Bug #20956]
Notes:
Merged: https://github.com/ruby/ruby/pull/12370
|
|
Co-authored-by: Adam Hess <HParker@github.com>
Notes:
Merged: https://github.com/ruby/ruby/pull/11800
|
|
|
|
These tests are flaky and are duplicative of other tests that are
run in CI when parser=prism.
|
|
|
|
[Feature #20205]
As a path toward enabling frozen string literals by default in the future,
this commit introduce "chilled strings". From a user perspective chilled
strings pretend to be frozen, but on the first attempt to mutate them,
they lose their frozen status and emit a warning rather than to raise a
`FrozenError`.
Implementation wise, `rb_compile_option_struct.frozen_string_literal` is
no longer a boolean but a tri-state of `enabled/disabled/unset`.
When code is compiled with frozen string literals neither explictly enabled
or disabled, string literals are compiled with a new `putchilledstring`
instruction. This instruction is identical to `putstring` except it marks
the String with the `STR_CHILLED (FL_USER3)` and `FL_FREEZE` flags.
Chilled strings have the `FL_FREEZE` flag as to minimize the need to check
for chilled strings across the codebase, and to improve compatibility with
C extensions.
Notes:
- `String#freeze`: clears the chilled flag.
- `String#-@`: acts as if the string was mutable.
- `String#+@`: acts as if the string was mutable.
- `String#clone`: copies the chilled flag.
Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
|
|
|
|
|
|
|
|
Co-Authored-By: Kevin Newton <kddnewton@gmail.com>
|
|
Following changes made in ruby/prism#2365 this implements error handling
for when `pm_string_mapped_init` returns `false`.
Related: ruby/prism#2207
|
|
Fixes ruby/prism#2313.
|
|
Part of ruby/prism#2231
Co-authored-by: Adrianna Chang <adrianna.chang@shopify.com>
Co-authored-by: Peter Zhu <peter@peterzhu.ca>
|
|
Previously, the local index of numbered parameters were assigned to
names of regular locals, making it hard to read both of them. Use proper
`_[1-9]` numbered parameters. This fixes `test_shapes.rb`.
Also, properly mark the iseq as having lead parameters.
|
|
Fixes `TestZlibGzipReader#test_gets2`,
`Psych_Unit_Tests#test_spec_explicit_families`, and many failures in
`test_unicode_normalize.rb`.
|
|
Fixes ruby/prism#2321
Co-authored-by: Adrianna Chang <adrianna.chang@shopify.com>
Co-authored-by: Peter Zhu <peter@peterzhu.ca>
|
|
|
|
Previously, `return *array, 1` didn't behave like `return [*array, 1]`
properly. Also, it crashed when splat and kwsplat is combined like in
`array = [*things, **hash]`.
Fix this by grouping `PM_ARGUMENTS_NODE` with `PM_ARRAY_NODE` handling and
combining splat and kwsplat handling.
|
|
Fixes ruby/prism#2307.
|
|
Fixes: https://github.com/ruby/prism/issues/2294
|
|
|
|
Fixes ruby/prism#2295.
|
|
Fixes ruby/prism#2290.
|
|
|
|
|
|
Fixes ruby/prism#2242.
|
|
Fixes ruby/prism#2272.
|
|
Fixes ruby/prism#2250.
Co-Authored-By: Kevin Newton <kddnewton@gmail.com>
|
|
Fixes ruby/prism#2279.
|
|
|
|
|
|
|
|
|
|
|
|
Fixes ruby/prism#2248.
|
|
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
|
|
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
|
|
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
|
|
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
|
|
We need to make sure there is enough room in the local table for
repeated `*_` parameters
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
|
|
Ensure there is enough space in the local table for repeated optional
parameters.
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
|
|
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
|
|
Fixes ruby/prism#2253.
|
|
Fixes ruby/prism#2262.
|