From 23beceedb76a47b3f4497809eefb7338690df191 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Tue, 2 Jan 2024 11:18:29 -0500 Subject: [ruby/prism] IndexTargetNode should always have ATTRIBUTE_WRITE Because this is a user-facing change, we also need to deal with the fact that CRuby 3.3.0 was just released. In order to support workflows that want to parse exactly as CRuby parses in a specific version, this PR introduces a new option to the options struct that is "version". This allows you to specify that you want "3.3.0" parsing. I'm not sure if this is the correct solution. Another solution is to just fork and keep around the old branch for security patches. Or we could keep around a copy of the source files within this repository as another directory and only update when necessary. There are a lot of potential solutions here. Because this change is so small and the check for it is so minimal, I've decided to go with this enum. If this ends up entirely cluttering the codebase with version checks, we'll come up with another solution. But for now this works, so we're going to go in this direction for a bit until we determine it's no longer working. https://github.com/ruby/prism/commit/d8c7e6bd10 --- lib/prism/ffi.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/prism/ffi.rb b/lib/prism/ffi.rb index 8324f722a7..4c42e5061b 100644 --- a/lib/prism/ffi.rb +++ b/lib/prism/ffi.rb @@ -314,6 +314,9 @@ module Prism template << "C" values << (options.fetch(:verbose, true) ? 0 : 1) + template << "C" + values << { nil => 0, "3.3.0" => 1, "latest" => 0 }.fetch(options[:version]) + template << "L" if (scopes = options[:scopes]) values << scopes.length -- cgit v1.2.3