summaryrefslogtreecommitdiff
path: root/prism_compile.c
AgeCommit message (Collapse)Author
2024-02-04[PRISM] Do not optimize safe navigation -@/freezeJenny Shen
Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2024-02-02[PRISM] Selectively dup array in `foo(*splat, &block_arg)` callsAlan Wu
This is essentially an adaptation of aae8223c707 ("Dup splat array in certain cases where there is a block argument") to pass `TestCall#test_call_block_order`. This also makes PRISM emit `getblockparamproxy` in cases like `def foo(&blk) = bar(&blk)` where it used the less efficient `getblockparam` previously. Remove the `popped` parameter from setup_args() because it should always be ignored, and is in fact unused.
2024-02-02[PRISM] Fix numbered parameters stealing local namesAlan Wu
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.
2024-02-02[PRISM] Fix indentation of pm_scope_node_init [ci skip]Peter Zhu
2024-02-01[PRISM] Respect string encoding override in array literalsAlan Wu
Fixes `TestZlibGzipReader#test_gets2`, `Psych_Unit_Tests#test_spec_explicit_families`, and many failures in `test_unicode_normalize.rb`.
2024-02-01[PRISM] dedup hash string keysJenny Shen
Fixes ruby/prism#2321 Co-authored-by: Adrianna Chang <adrianna.chang@shopify.com> Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2024-02-01[PRISM] Emit parse warningsKevin Newton
2024-02-01[PRISM] Use rb_fstring() on all string literalsAlan Wu
In addition to saving space by deduplicating, this also makes the literals have code range like TestObjSpace#test_dump_string_coderange expects. It's testing a detail, but we might as well use rb_fstring(). Note that `putstring` makes a mutable duplicate, so passing it an fstring is fine.
2024-02-01[prism] Use block opening line as `source_location` line of lambdaNikita Vasilevsky
There are several prism tests failing related to the `source_location` for lambda returning line of the operator (`->`) while original parser execution results in `source_location` line pointing to the block opening location (`{` or `do`) This commit changes `PM_LAMBDA_NODE` compilation case to use block opening location instead of the whole node (operator) opening location to get the line number to build block iseq
2024-02-01[PRISM] Fix multiple return with splat and splat+kwsplatAlan Wu
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.
2024-01-31[PRISM] Add splatkw to super calls when necessaryKevin Newton
2024-01-31[PRISM] Fix up index write nodes to matchKevin Newton
2024-01-31[PRISM] Fix keywords in index write nodesKevin Newton
2024-01-31[PRISM] Fix combination of safe navigation and ||= and &&= operatorsKevin Newton
2024-01-31[PRISM] Fix combination of attribute write and safe navigationKevin Newton
2024-01-31[PRISM] Support SCRIPT_LINES__Kevin Newton
2024-01-31[PRISM] Fix else with rescuePeter Zhu
Fixes ruby/prism#2307.
2024-01-31[PRISM] Fix incorrect use of VM_CALL_KW_SPLAT_MUT in zsuper with keyword splatÉtienne Barrié
This copies the changes from 771a2f039b9a059a73e8f111d1d46590fa697f63. Fixes ruby/prism#2310.
2024-01-31[PRISM] Mirror iseq APIsKevin Newton
Before this commit, we were mixing a lot of concerns with the prism compile between RubyVM::InstructionSequence and the general entry points to the prism parser/compiler. This commit makes all of the various prism-related APIs mirror their corresponding APIs in the existing parser/compiler. This means we now have the correct frame naming, and it's much easier to follow where the logic actually flows. Furthermore this consolidates a lot of the prism initialization, making it easier to see where we could potentially be raising errors.
2024-01-30[PRISM] pm_compile_logical: Fix OrNode in IfNode predicateMatt Valentine-House
Fixes: https://github.com/ruby/prism/issues/2294
2024-01-30[PRISM] Remove unneccessary uses of cond_seqMatt Valentine-House
As this is compiled into only on the recursive call and then added, we can just use `ret` directly
2024-01-30Update forwarding locals for prismAaron Patterson
2024-01-30[PRISM] Remove unused variablePeter Zhu
2024-01-29[PRISM] Method location for callsKevin Newton
2024-01-29[PRISM] Fix crash when multiple underscoresPeter Zhu
Fixes ruby/prism#2295.
2024-01-29[PRISM] Fix rescue frame labelKevin Newton
2024-01-29[PRISM] Implement opt_str_uminusPeter Zhu
2024-01-29[PRISM] Use opt_str_freeze instructionPeter Zhu
Fixes ruby/prism#2290.
2024-01-29[PRISM] Fix InterpolatedStringNodeMatt Valentine-House
If the first element of an interpolated string node is an embedded statement, CRuby "pre-initializes" the interpolation with a string of known encoding to concat into. This patch replicates thate behaviour in Prism
2024-01-29[PRISM] Support US-ASCII symbolsPeter Zhu
2024-01-29[PRISM] Support ASCII-8BIT symbolsPeter Zhu
2024-01-29[PRISM] Support UTF-8 symbolsPeter Zhu
Fixes ruby/prism#2242.
2024-01-29[PRISM] Use the splatkw instructionPeter Zhu
Fixes ruby/prism#2272.
2024-01-29[PRISM] Fix encoding for interpolated strings.Matt Valentine-House
This wasn't taking into account strings with flags set on the containing node that could affect the encoding. It does now
2024-01-26[PRISM] Fix branchif ADD_INSN1Kevin Newton
2024-01-26[PRISM] Fix loop in rescue blocksPeter Zhu
Fixes ruby/prism#2250. Co-Authored-By: Kevin Newton <kddnewton@gmail.com>
2024-01-26[PRISM] Fix for s390xPeter Zhu
On s390x, a long is 8 bytes. st_data_t is an unsigned long but pm_constant_id_t is a 4 byte integer. We need to cast it to st_data_t when passing it to ST functions.
2024-01-26[PRISM] Keyword arguments incorrectly passed as mutablePeter Zhu
Fixes ruby/prism#2279.
2024-01-25[PRISM] Fix next inside rescueMatt Valentine-House
2024-01-25[PRISM] Fix VM_CALL_ARGS_SPLAT_MUT failuresKevin Newton
2024-01-24[PRISM] Fix getblockparamproxy for forwarding argumentsPeter Zhu
2024-01-24[PRISM] Fix method calls in keyword argumentsPeter Zhu
Fixes ruby/prism#2248.
2024-01-24Fix repeated block paramAaron Patterson
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24Fix local table size / index for repeated kwrestAaron Patterson
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24Fix local table size and variable offset for repeated keywordsAaron Patterson
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24Fix local table size and index for required post underscoreAaron Patterson
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24Fix local table space for `*_`Aaron Patterson
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>
2024-01-24Fix repeated optional _ parametersAaron Patterson
Ensure there is enough space in the local table for repeated optional parameters. Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24Fix required positional repeated _ parametersAaron Patterson
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2024-01-24[PRISM] Support __LINE__, __FILE__, and __ENCODING__ in patterns, fix pinned ↵Kevin Newton
expressions