jruby / jruby-parser

JRuby's parser customized for IDE usage
45 stars 21 forks source link

Parser error with required keyword arguments #38

Open codelion opened 9 years ago

codelion commented 9 years ago

The following code gives no syntax error when using ruby, but fails to parse with jruby parser (in all compat modes).

     def initialize(access_key_id:, secret_access_key:, bucket:, max_size: nil, prefix: nil, hasher: Refile::RandomHasher.new)
        @access_key_id = access_key_id
        @secret_access_key = secret_access_key
        @s3 = AWS::S3.new(access_key_id: access_key_id, secret_access_key: secret_access_key)
        @bucket_name = bucket
        @bucket = @s3.buckets[@bucket_name]
        @hasher = hasher
        @prefix = prefix
        @max_size = max_size
      end
codelion commented 9 years ago

On further investigation I realized this is a feature introduced in Ruby 2.1 so may not be handled by jruby-parser in compat 2.0 mode.

https://robots.thoughtbot.com/ruby-2-keyword-arguments