aboutsummaryrefslogtreecommitdiffstats
path: root/prism_compile.c
Commit message (Collapse)AuthorAgeFilesLines
* Implement paren node for `defined?`eileencodes2023-12-011-2/+2
| | | | Implements and adds a test for passing a parentheses node to `defined?`.
* Implements missing literals for `defined?`eileencodes2023-12-011-1/+8
| | | | | | | | | | | | | | | This PR implements the following literals: - String - Symbols - Integers - Floats - Regexs - Ranges - Lambdas - Hashes and tests for them.
* [PRISM] Account for RescueNodes with no statementsJemma Issroff2023-12-011-0/+5
| | | | We need a PUTNIL if a RescueNode has no statements.
* [PRISM] Fix behavior of BlockParameters with only one parameterJemma Issroff2023-12-011-4/+14
| | | | | | This commit sets the ambiguous param flag if there is only one parameter on a block node. It also fixes a small bug with a trailing comma on params.
* [PRISM] Clean up trailing commentJemma Issroff2023-12-011-1/+1
|
* [PRISM] Restructure parametersJemma Issroff2023-12-011-14/+52
| | | | | | | Prior to this commit, we weren't accounting for hidden variables on the locals table, so we would have inconsistencies on the stack. This commit fixes params, and introduces a hidden_variable_count on the scope, both of which fix parameters.
* [prism] Update to latest numbered parametersKevin Newton2023-12-011-14/+28
|
* [PRISM] Compile RescueNodeMatt Valentine-House2023-12-011-11/+112
|
* [PRISM] Use depth_offset not transparent scopes for FORMatt Valentine-House2023-12-011-0/+1
|
* [Prism] Fix local variable access for POST_EXECUTION_NODEMatt Valentine-House2023-11-301-0/+1
|
* Store depth offset inside the scope node.Matt Valentine-House2023-11-301-24/+23
| | | | | | | Instead of incrementing the depth using call by reference as we're recursing up the stack we could instead store an offset for each known scope where we know the depth is going to represented differently in the Prism ast.
* Add a rescue for `defined?(A::B::C)`Aaron Patterson2023-11-301-1/+18
| | | | | | It's possible for `defined?(A::B::C)` to raise an exception. `defined?` must swallow the exception and return nil, so this commit adds a rescue entry for `defined?` expressions on constant paths
* [PRISM] Compile empty array as newarray 0Jemma Issroff2023-11-291-3/+9
| | | | | | | Prior to this commit, we were compiling an empty array as a duparray of [] which meant we were allocating a new value unnecessarily. With this commit, we emit a newarray with size 0 instead.
* [PRISM] Implement CallNodes with splat followed by argsJemma Issroff2023-11-291-2/+10
|
* [PRISM] Account for ImplicitRestNodeJemma Issroff2023-11-291-4/+1
| | | | | | Prism introduced a new ImplicitRestNode. This adds tests for the ImplicitRestNode cases, and changes one assert which is no longer accurate.
* [PRISM] Fix EnsureNode, pass depth to get localsJemma Issroff2023-11-291-39/+45
| | | | | | | This commit fixes a bug with locals in ensure nodes by setting the local tables correctly. It also changes accessing locals to look at local tables in parent scopes, and account for this correctly on depths of get or setlocals.
* [PRISM] Don't calculate params size based on localsJemma Issroff2023-11-281-3/+18
| | | | | | | Prior to this commit, we were conflating the size of the locals list with the number of parameters. This commit distinguishes the two, and fixes a related bug which would occur if we set a local that was not a parameter
* [PRISM] Implement more compilation of SplatNodesJemma Issroff2023-11-281-11/+20
| | | | | | There was a bug with the rest argument in SplatNodes, this commit fixes it, and adds more tests illustrating the behavior of SplatNodes
* [PRISM] Compile YieldNode with different argumentsJemma Issroff2023-11-281-38/+38
|
* [PRISM] Small fixes to parameters ordering and methodsJemma Issroff2023-11-271-5/+11
|
* [PRISM] Renamed some variables, added commentsJemma Issroff2023-11-271-20/+23
|
* [PRISM] Compile IndexOperatorWriteNodeJemma Issroff2023-11-271-23/+70
|
* [PRISM] Compile IndexAndWriteNodeJemma Issroff2023-11-271-224/+246
|
* [PRISM] Compile IndexOrWriteNodeJemma Issroff2023-11-271-0/+69
|
* [PRISM] Fix compilation for SplatNodes within ArrayNodesJemma Issroff2023-11-271-5/+68
| | | | | | | | SplatNodes within ArrayNodes (e.g. [*1..2, 3]) need to be special cased in the compiler because they use a combination of concatarray and newarray instructions to treat each sequence of splat or non-splat elements as independent arrays which get concatenated. This commit implements those cases.
* [PRISM] Don't pop several args related nodesJemma Issroff2023-11-271-6/+6
|
* [PRISM] Insert Tracepoint line events on line changeMatt Valentine-House2023-11-241-0/+11
|
* [PRISM] Rename flag to CONTAINS_KEYWORD_SPLATJemma Issroff2023-11-211-1/+1
| | | | | We need to do this change first on ruby/ruby before merging to ruby/prism to avoid breaking ruby/ruby CI
* Remove string concat node in prismKevin Newton2023-11-211-9/+0
|
* Use new match write targetsKevin Newton2023-11-201-34/+51
|
* [PRISM] Updated LocalVariableTargetNodes tooJemma Issroff2023-11-201-2/+1
|
* [PRISM] Fix LocalVariableWriteNodes within blocksJemma Issroff2023-11-201-3/+23
| | | | | | Prior to this commit, we weren't recursing up scopes to look for the local definition. With this commit, we do so, fixing local writes within blocks
* [PRISM] Implement once node for interpolated regexeileencodes2023-11-201-1/+45
| | | | | | | | This PR implements the once node on interpolated regexes. There is a bug in Prism where the interpolated regex with the once flag only works when there is not a local variable so the test uses a "1". We'll need to fix that.
* [PRISM] Don't pop args to YieldNodeJemma Issroff2023-11-201-1/+1
|
* Switching first argument in pm_interpolated_node_compileeileencodes2023-11-201-8/+9
| | | | | This changes the first argument in `pm_interpolated_node_compile` to use a pointer.
* [PRISM] Initialize keyword to silence warningJemma Issroff2023-11-131-1/+1
|
* [PRISM] Implement compilation for ForwardingArgumentssNodeJemma Issroff2023-11-091-0/+12
|
* Range check in pm_constant_id_lookupNobuyoshi Nakada2023-11-091-0/+3
|
* Remove useless castsNobuyoshi Nakada2023-11-091-2/+2
|
* [PRISM] Always lookup idERROR_INFO consistently.Matt Valentine-House2023-11-081-9/+1
| | | | | | | | We know where it is in the iseq local table, because we forced it using `iseq_set_exception_local_table` when compiling the BEGIN_NODE, so we can always look it up from the same place. Co-Authored-By Peter Zhu <peter@peterzhu.ca>
* [PRISM] Add tests for OptionalKeywordParameterNodeJemma Issroff2023-11-081-0/+19
| | | | | | This commit adds tests for the compilation of the OptionalKeywordParameterNode, and fixes cases on the RequiredKeywordParameterNode
* [PRISM] Added tests for ForwardingParameterNode, KeywordRestParameterNodeJemma Issroff2023-11-081-2/+8
|
* [PRISM] Add tests for several parameters nodesJemma Issroff2023-11-081-12/+5
| | | | | This commit adds tests for BlockParameterNode, RequiredParameterNode, RequiredKeywordParameterNode and RestParameterNode
* [PRISM] Implement compilation for different parametersJemma Issroff2023-11-071-28/+127
| | | | | | This commit compiles most parameter types, setting appropriate values on the ISEQ_BODY. It also adds tests for callers and callees of methods, using many versions of tests from bootstraptest
* [PRISM] Move Local table setup into EnsureNode compilationMatt Valentine-House2023-11-071-8/+5
|
* [PRISM] Don't generate leave insns for Ensure nodesMatt Valentine-House2023-11-071-1/+1
|
* [PRISM] CompileEnsureNodeMatt Valentine-House2023-11-071-43/+117
|
* [PRISM] PM_COMPILE into a specified LINK_ANCHORMatt Valentine-House2023-11-071-43/+43
|
* [PRISM] Implement compilation for MultiWriteNodes, fix MultiTargetNodesJemma Issroff2023-11-061-20/+48
| | | | | | Compilation now works for MultiWriteNodes and MultiTargetNodes, with nesting on MultiWrites. See the tests added in this commit for example behavior.
* [PRISM] Fix stack consistency with Popped beginMatt Valentine-House2023-11-031-1/+1
| | | | | When a begin node is popped it only needs to putnil if that nil is going to be the return value, otherwise it can successfully be optimised out.