Skip to content

Commit

Permalink
* ruby28.y -> ruby30.y
Browse files Browse the repository at this point in the history
  • Loading branch information
palkan committed Aug 31, 2020
1 parent 61f5fb4 commit 5efc289
Show file tree
Hide file tree
Showing 10 changed files with 32,054 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -30,5 +30,6 @@ lib/parser/ruby25.rb
lib/parser/ruby26.rb
lib/parser/ruby27.rb
lib/parser/ruby28.rb
lib/parser/ruby30.rb
lib/parser/macruby.rb
lib/parser/rubymotion.rb
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -32,7 +32,7 @@ GENERATED_FILES = %w(lib/parser/lexer.rb
lib/parser/ruby25.rb
lib/parser/ruby26.rb
lib/parser/ruby27.rb
lib/parser/ruby28.rb
lib/parser/ruby30.rb
lib/parser/macruby.rb
lib/parser/rubymotion.rb)

Expand Down
2 changes: 1 addition & 1 deletion lib/parser/all.rb
Expand Up @@ -10,4 +10,4 @@
require 'parser/ruby25'
require 'parser/ruby26'
require 'parser/ruby27'
require 'parser/ruby28'
require 'parser/ruby30'
10 changes: 5 additions & 5 deletions lib/parser/builders/default.rb
Expand Up @@ -103,7 +103,7 @@ class << self
##
# AST compatibility attribute; arguments forwarding initially
# didn't have support for leading arguments
# (i.e. `def m(a, ...); end` was a syntax error). However, Ruby 2.8
# (i.e. `def m(a, ...); end` was a syntax error). However, Ruby 3.0
# added support for any number of arguments in front of the `...`.
#
# If set to false (the default):
Expand All @@ -120,7 +120,7 @@ class << self
# s(:def, :m, s(:args, s(:arg, :a), s(:arg, :b), s(:forward_arg)))
#
# It does't matter that much on 2.7 (because there can't be any leading arguments),
# but on 2.8 it should be better enabled to use a single AST format.
# but on 3.0 it should be better enabled to use a single AST format.
#
# @return [Boolean]
attr_accessor :emit_forward_arg
Expand Down Expand Up @@ -1601,9 +1601,9 @@ def check_assignment_to_numparam(name, loc)
end

def check_reserved_for_numparam(name, loc)
# MRI < 2.8 accepts assignemnt to variables like _1
# if it's not a numbererd parameter. MRI 2.8 and newer throws an error.
return if @parser.version < 28
# MRI < 3.0 accepts assignemnt to variables like _1
# if it's not a numbererd parameter. MRI 3.0 and newer throws an error.
return if @parser.version < 30

if name =~ /\A_([1-9])\z/
diagnostic :error, :reserved_for_numparam, { :name => name }, loc
Expand Down
10 changes: 5 additions & 5 deletions lib/parser/current.rb
Expand Up @@ -83,14 +83,14 @@ def warn_syntax_deviation(feature, version)
require 'parser/ruby27'
CurrentRuby = Ruby27

when /^2\.8\./
current_version = '2.8.0-dev'
when /^3\.0\./
current_version = '3.0.0-dev'
if RUBY_VERSION != current_version
warn_syntax_deviation 'parser/ruby28', current_version
warn_syntax_deviation 'parser/ruby30', current_version
end

require 'parser/ruby28'
CurrentRuby = Ruby28
require 'parser/ruby30'
CurrentRuby = Ruby30

else # :nocov:
# Keep this in sync with released Ruby.
Expand Down

0 comments on commit 5efc289

Please sign in to comment.