diff options
author | Kevin Newton <[email protected]> | 2024-02-13 13:19:02 -0500 |
---|---|---|
committer | git <[email protected]> | 2024-02-13 18:26:28 +0000 |
commit | 29d04bb0c452e31424fb22f62151ab7da566a71e (patch) | |
tree | 3124d8e0bcce2f12dc609a2b2186b2cb50402a21 | |
parent | 246005f5bd3171e12bafe820d183a7a23adc9e96 (diff) |
[ruby/prism] Introduce `version: "3.4.0"`
This is effectively an alias for "latest" right now. In the future
it will change to be its own enum value.
https://github.com/ruby/prism/commit/2c86036022
-rw-r--r-- | lib/prism/ffi.rb | 2 | ||||
-rw-r--r-- | prism/options.c | 13 | ||||
-rw-r--r-- | test/prism/location_test.rb | 3 |
3 files changed, 12 insertions, 6 deletions
diff --git a/lib/prism/ffi.rb b/lib/prism/ffi.rb index 617c469df6..3418d787da 100644 --- a/lib/prism/ffi.rb +++ b/lib/prism/ffi.rb @@ -317,7 +317,7 @@ module Prism values << (options.fetch(:frozen_string_literal, false) ? 1 : 0) template << "C" - values << { nil => 0, "3.3.0" => 1, "latest" => 0 }.fetch(options[:version]) + values << { nil => 0, "3.3.0" => 1, "3.4.0" => 0, "latest" => 0 }.fetch(options[:version]) template << "L" if (scopes = options[:scopes]) diff --git a/prism/options.c b/prism/options.c index ae5b5a8d3c..35d3869a97 100644 --- a/prism/options.c +++ b/prism/options.c @@ -44,9 +44,16 @@ pm_options_version_set(pm_options_t *options, const char *version, size_t length return true; } - if (length == 5 && strncmp(version, "3.3.0", length) == 0) { - options->version = PM_OPTIONS_VERSION_CRUBY_3_3_0; - return true; + if (length == 5) { + if (strncmp(version, "3.3.0", length) == 0) { + options->version = PM_OPTIONS_VERSION_CRUBY_3_3_0; + return true; + } + + if (strncmp(version, "3.4.0", length) == 0) { + options->version = PM_OPTIONS_VERSION_LATEST; + return true; + } } if (length == 6 && strncmp(version, "latest", length) == 0) { diff --git a/test/prism/location_test.rb b/test/prism/location_test.rb index 5e402ee33c..c60717059e 100644 --- a/test/prism/location_test.rb +++ b/test/prism/location_test.rb @@ -179,8 +179,7 @@ module Prism node.body.body.first end - # TODO: Please consider using `version: 3.4.0` instead of `version: latest` in the future. - assert_location(LocalVariableReadNode, "-> { it }", 5...7, version: "latest") do |node| + assert_location(LocalVariableReadNode, "-> { it }", 5...7, version: "3.4.0") do |node| node.body.body.first end end |