aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Make expandarray compaction safePeter Zhu2023-12-012-24/+30
| | | | | | | | | | | | The expandarray instruction can allocate an array, which can trigger a GC compaction. However, since it does not increment the sp until the end of the instruction, the objects it places on the stack are not marked or reference updated by the GC, which can cause the objects to move which leaves broken or incorrect objects on the stack. This commit changes the instruction to be handles_sp so the sp is incremented inside of the instruction right after the object is written on the stack.
* [ruby/prism] Prism.parse_success?(source)Kevin Newton2023-12-016-1/+133
| | | | | | | | | | | | A lot of tools use Ripper/RubyVM::AbstractSyntaxTree to determine if a source is valid. These tools both create an AST instead of providing an API that will return a boolean only. This new API only creates the C structs, but doesn't bother reifying them into Ruby/the serialization API. Instead it only returns true/false, which is significantly more efficient. https://github.com/ruby/prism/commit/7014740118
* Remove unneeded local variablesPeter Zhu2023-12-011-2/+0
|
* [ruby/prism] Fix parsing heredoc endsHaldun Bayhantopcu2023-12-015-28/+147
| | | | https://github.com/ruby/prism/commit/aa8c702271
* Implements missing literals for `defined?`eileencodes2023-12-012-1/+16
| | | | | | | | | | | | | | | This PR implements the following literals: - String - Symbols - Integers - Floats - Regexs - Ranges - Lambdas - Hashes and tests for them.
* Make String#undump compaction safePeter Zhu2023-12-012-0/+13
|
* Pin embedded shared stringsPeter Zhu2023-12-013-23/+10
| | | | | | | Embedded shared strings cannot be moved because strings point into the slot of the shared string. There may be code using the RSTRING_PTR on the stack, which would pin the string but not pin the shared string, causing it to move.
* [rubygems/rubygems] Reduce array allocations when loading definitionSamuel Giddins2023-12-012-4/+14
| | | | | | The same array was being re-created in a loop (as well as the `generic_local_platform`), which is avoidable by hoisting it to a frozen array created once https://github.com/rubygems/rubygems/commit/009a3c6d0d
* [Bug #20033] Dynamic regexp should not assign capturesNobuyoshi Nakada2023-12-023-10/+23
|
* [ruby/prism] Provide heredoc? queriesKevin Newton2023-12-012-16/+53
| | | | https://github.com/ruby/prism/commit/e148e8fe6a
* [PRISM] Account for RescueNodes with no statementsJemma Issroff2023-12-012-0/+11
| | | | We need a PUTNIL if a RescueNode has no statements.
* [PRISM] Fix behavior of BlockParameters with only one parameterJemma Issroff2023-12-012-4/+23
| | | | | | 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.
* [ruby/irb] Scrub past history input before splithogelog2023-12-012-3/+20
| | | | | | | | | | (https://github.com/ruby/irb/pull/795) * Scrub past history input before split * Don't rewrite ENV["LANG"] https://github.com/ruby/irb/commit/0f344f66d9
* [rubygems/rubygems] Many major_deprecations supply :removed_messageEric Mueller2023-12-017-46/+91
| | | | | | | | | | Generally the removed message is very similar, but often it needs to specify that the feature has "been removed" instead of "will be removed", or "been deprecated". And a few chunks of text needed more substantial updates. And a number of them seemed to have been carefully crafted to make sense in either context, so I left those alone. https://github.com/rubygems/rubygems/commit/8d42cf9104
* [rubygems/rubygems] major_deprecation accepts :removed_messageEric Mueller2023-12-012-3/+35
| | | | | | | If supplied, it uses that in place of the message for the case where the deprecation version is already past. https://github.com/rubygems/rubygems/commit/1deb73663c
* [Bug #19838] Flush delayed token nonconsecutive with the next tokenNobuyoshi Nakada2023-12-022-0/+69
|
* Extract `end_with_newline_p`Nobuyoshi Nakada2023-12-021-1/+7
|
* Prefer proper enum over bare intNobuyoshi Nakada2023-12-021-3/+3
|
* [PRISM] Clean up trailing commentJemma Issroff2023-12-011-1/+1
|
* [PRISM] Restructure parametersJemma Issroff2023-12-013-15/+92
| | | | | | | 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
|
* [ruby/prism] Change numbered parametersKevin Newton2023-12-01205-1361/+983
| | | | | | | | | | | | | | | | | | | | Previously numbered parameters were a field on blocks and lambdas that indicated the maximum number of numbered parameters in either the block or lambda, respectively. However they also had a parameters field that would always be nil in these cases. This changes it so that we introduce a NumberedParametersNode that goes in place of parameters, which has a single uint8_t maximum field on it. That field contains the maximum numbered parameter in either the block or lambda. As a part of the PR, I'm introducing a new UInt8Field type that can be used on nodes, which is just to make it a little more explicit what the maximum values can be (the maximum is actually 9, since it only goes up to _9). Plus we can do a couple of nice things in serialization like just read a single byte. https://github.com/ruby/prism/commit/2d87303903
* [PRISM] Compile RescueNodeMatt Valentine-House2023-12-012-11/+176
|
* Remove unused files in prismKevin Newton2023-12-016-3097/+0
|
* [ruby/prism] Update snapshotsKevin Newton2023-12-011-8/+18
| | | | https://github.com/ruby/prism/commit/f4c80c67dc
* [ruby/prism] Fix comments after HEREDOCs again.Martin Emde2023-12-012-14/+10
| | | | | | | | | | | The problem was deeper than just looking back a single token. You can push the heredoc_end token way back into the list. We need to save the last location of a heredoc end to see if it's the last token in the file. Fixes https://github.com/ruby/prism/pull/1954 https://github.com/ruby/prism/commit/91dfd4eecd
* [ruby/prism] Add missing context names to the switch in `debug_context`TSUYUSATO Kitsune2023-12-011-0/+3
| | | | | | Now, `PM_DEBUG_LOGGING` can be available. https://github.com/ruby/prism/commit/569ffacb5f
* [ruby/prism] Improve to handle unterminated stringsTSUYUSATO Kitsune2023-12-012-35/+102
| | | | | | | | | | | | | | | Fix https://github.com/ruby/prism/pull/1946 This fixes to set an error position for unterminated strings to the opening delimiters. Previously, the error position was set to the end of the delimiter. The same fix applies to other string-like literals. Additionally, this fixes https://github.com/ruby/prism/pull/1946; that is, it adds the last part of the string even though the string literal does not terminate. https://github.com/ruby/prism/commit/c1240baafd
* [ruby/prism] Fix `not_provided` commentTSUYUSATO Kitsune2023-12-011-2/+1
| | | | | | | I don't know when it is changed, but the `not_provided` signature is changed. https://github.com/ruby/prism/commit/0255cc307d
* [PRISM] Use depth_offset not transparent scopes for FORMatt Valentine-House2023-12-011-0/+1
|
* [PRISM] Remove transparent scope nodesMatt Valentine-House2023-12-016-75/+33
|
* Add assertions for shape cache grandchild nodesPeter Zhu2023-12-011-0/+8
|
* [ruby/prism] Add test/prism/snapshots/heredoc_with_comment.txtHiroshi SHIBATA2023-12-011-0/+11
| | | | https://github.com/ruby/prism/commit/97b296a0f7
* Update default gems list at 7d142c08cb5b65e4ba110b116c41a8 [ci skip]git2023-12-011-0/+1
|
* lib/helper only needs on flori/json repoHiroshi SHIBATA2023-12-011-1/+4
|
* Manually merged from flori/jsonHiroshi SHIBATA2023-12-016-6/+62
| | | | | | | | | | | | > https://github.com/flori/json/pull/525 > Rename escape_slash in script_safe and also escape E+2028 and E+2029 Co-authored-by: Jean Boussier <jean.boussier@gmail.com> > https://github.com/flori/json/pull/454 > Remove unnecessary initialization of create_id in JSON.parse() Co-authored-by: Watson <watson1978@gmail.com>
* Rename escape_slash in script_safe and also escape E+2028 and E+2029Jean Boussier2023-12-015-29/+74
| | | | | | | | | | | | | | | | | | | | | It is rather common to directly interpolate JSON string inside <script> tags in HTML as to provide configuration or parameters to a script. However this may lead to XSS vulnerabilities, to prevent that 3 characters need to be escaped: - `/` (forward slash) - `U+2028` (LINE SEPARATOR) - `U+2029` (PARAGRAPH SEPARATOR) The forward slash need to be escaped to prevent closing the script tag early, and the other two are valid JSON but invalid Javascript and can be used to break JS parsing. Given that the intent of escaping forward slash is the same than escaping U+2028 and U+2029, I chos to rename and repurpose the existing `escape_slash` option.
* Use ruby_xfree to free buffersJean Boussier2023-12-012-8/+8
| | | | | They are allocated with ruby_xmalloc, they should be freed with ruby_xfree.
* [flori/json] Bump up 2.7.0Hiroshi SHIBATA2023-12-012-2/+2
| | | | https://github.com/flori/json/commit/ca546128f2
* [flori/json] Fix "unexpected token" offset for InfinityJohn Hawthorn2023-12-013-2/+21
| | | | | | | | Previously in the JSON::Ext parser, when we encountered an "Infinity" token (and weren't allowing NaN/Infinity) we would try to display the "unexpected token" at the character before. https://github.com/flori/json/commit/42ac170712
* [flori/json] tests/ractor_test.rb: make assert_separately availableLucas Kanashiro2023-12-011-0/+2
| | | | | | | | Require tests/lib/helper.rb to avoid: NoMethodError: undefined method `assert_separately' https://github.com/flori/json/commit/a81bcc0328
* Fix typos [ci skip]Kazuhiro NISHIYAMA2023-12-011-2/+2
|
* Sort links [ci skip]Kazuhiro NISHIYAMA2023-12-011-2/+2
|
* Dispatch invalid hex escape content tooNobuyoshi Nakada2023-12-012-4/+6
|
* [Bug #20030] dispatch invalid escaped character without ignoring itNobuyoshi Nakada2023-12-013-2/+26
|
* Fixup with review commentMisaki Shioi2023-12-011-1/+1
| | | | https://github.com/ruby/ruby/pull/9088#discussion_r1411490445
* Relax test conditions to velify Socket::ResolutionError#error_codeMisaki Shioi2023-12-011-5/+2
| | | | | | | | | | The test for Socket::ResolutionError#error_code fails in the FreeBSD environment with this test condition. Because Socket::ResolutionError#error_code returns Socket::EAI_FAIL instead of Socket::EAI_FAMILY. https://rubyci.s3.amazonaws.com/freebsd12/ruby-master/log/20231130T103002Z.fail.html.gz This PR avoids the test failure by relaxing the condition. Also changed the domain for testing to `example.com`.
* [ruby/prism] Correctly pass around const pm_encoding_t *Kevin Newton2023-11-306-7/+12
| | | | https://github.com/ruby/prism/commit/ce4c67fb3a
* [PRISM] Fix up prism encoding targetsKevin Newton2023-11-301-87/+22
|
* [ruby/prism] Document remaining encodingsKevin Newton2023-11-303-4/+3
| | | | https://github.com/ruby/prism/commit/b9510aed40