This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -111,7 +111,8 @@ def supports_taint?
111
111
ripper_requirements . push ( Ruby . jruby_version >= '1.7.5' )
112
112
# Ripper on JRuby 9.0.0.0.rc1 - 9.1.8.0 reports wrong line number
113
113
# or cannot parse source including `:if`.
114
- ripper_requirements . push ( !Ruby . jruby_version . between? ( '9.0.0.0.rc1' , '9.1.8.0' ) )
114
+ # Ripper on JRuby 9.x.x.x < 9.2.1.0 can't handle keyword arguments.
115
+ ripper_requirements . push ( !Ruby . jruby_version . between? ( '9.0.0.0.rc1' , '9.2.0.0' ) )
115
116
end
116
117
117
118
if ripper_requirements . all?
Original file line number Diff line number Diff line change @@ -120,7 +120,8 @@ def ripper_is_implemented?
120
120
121
121
def ripper_works_correctly?
122
122
ripper_reports_correct_line_number? &&
123
- ripper_can_parse_source_including_keywordish_symbol?
123
+ ripper_can_parse_source_including_keywordish_symbol? &&
124
+ ripper_can_parse_source_referencing_keyword_arguments?
124
125
end
125
126
126
127
# https://github.com/jruby/jruby/issues/3386
@@ -144,6 +145,25 @@ def ripper_can_parse_source_including_keywordish_symbol?
144
145
end
145
146
end
146
147
148
+ # https://github.com/jruby/jruby/issues/5209
149
+ def ripper_can_parse_source_referencing_keyword_arguments?
150
+ in_sub_process_if_possible do
151
+ require 'ripper'
152
+ # It doesn't matter if keyword arguments don't exist.
153
+ if Ruby . mri? || Ruby . jruby?
154
+ if RUBY_VERSION < '2.0'
155
+ true
156
+ else
157
+ begin
158
+ !::Ripper . sexp ( 'def a(**kw_args); end' ) . nil?
159
+ rescue NoMethodError
160
+ false
161
+ end
162
+ end
163
+ end
164
+ end
165
+ end
166
+
147
167
it 'returns whether Ripper is correctly implemented in the current environment' do
148
168
expect ( RubyFeatures . ripper_supported? ) . to eq ( ripper_is_implemented? && ripper_works_correctly? )
149
169
end
You can’t perform that action at this time.
0 commit comments