rubinius-ast 2.3.2 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce309d261674f72639f17fab1746c6e70b207e43
4
- data.tar.gz: 53ef60ff69d147a5232e6b5988eeb1ea60e189d9
3
+ metadata.gz: 079e046e984c4362cd37c68024244f84009692fb
4
+ data.tar.gz: 7fe5ddb81c8cb3d6ecf596a16e78070b085a9160
5
5
  SHA512:
6
- metadata.gz: 1fbd9b7c7b706657e60760162da1cce65bd2d3e9bd154a1cb20c73f42557edf6a0052edf324d8c7b35cd02efc2b4d36f7873ee023e10d23f9846886511b6d200
7
- data.tar.gz: a9e5446be9d2bf2d40f6c55bb606750ed3b3fea0ea36d64e943f11805886a82f6eb4074292052f01f488f4e6f79596f8949952116efb9bf6d549da805be105aa
6
+ metadata.gz: a63fd1d372f96337214c45741a5a6b285bd7c7ad0ea537b6611f3c045429fe62bda9b107b7b4ffb86ba35661ccbee16be9912d02db0141baebac9a26ba965d10
7
+ data.tar.gz: ae131cde981af56b61d16528e81965fe3984730f0ed65ba7dac04c721bc5eb535910c6ef60ee26301e64d19a8b4fd5dfd93c8ef1290e588ea91c91664f1206c7
File without changes
File without changes
File without changes
@@ -344,6 +344,13 @@ module CodeTools
344
344
 
345
345
  process_fixed_arguments post, @post = [], names
346
346
 
347
+ if kwargs || kwrest
348
+ placeholder_var = local_placeholder
349
+ @locals << placeholder_var
350
+ end
351
+
352
+ kwrest = placeholder_var if kwrest == true
353
+
347
354
  if kwargs
348
355
  @keywords = KeywordParameters.new line, kwargs, kwrest
349
356
  names.concat @keywords.names
@@ -351,11 +358,7 @@ module CodeTools
351
358
  @keywords = KeywordParameters.new line, nil, kwrest
352
359
  end
353
360
 
354
- if @keywords
355
- var = local_placeholder
356
- @keywords.value = LocalVariableAccess.new line, var
357
- @locals << var
358
- end
361
+ @keywords.value = LocalVariableAccess.new line, placeholder_var if @keywords
359
362
 
360
363
  @names = names
361
364
 
@@ -602,13 +605,14 @@ module CodeTools
602
605
  @names = []
603
606
  end
604
607
 
605
- case kwrest
606
- when Symbol
607
- kwrest_name = :"**#{kwrest}"
608
+ if kwrest
609
+ if kwrest.to_s.start_with?("_:")
610
+ kwrest_name = :**
611
+ else
612
+ kwrest_name = :"**#{kwrest}"
613
+ end
614
+
608
615
  @kwrest = LocalVariableAssignment.new line, kwrest
609
- when true
610
- kwrest_name = :**
611
- @kwrest = true
612
616
  end
613
617
 
614
618
  @names << kwrest_name if kwrest_name
@@ -628,9 +632,7 @@ module CodeTools
628
632
  def map_arguments(scope)
629
633
  @arguments.each { |var| scope.assign_local_reference var }
630
634
 
631
- if @kwrest.kind_of? LocalVariableAssignment
632
- scope.assign_local_reference @kwrest
633
- end
635
+ scope.assign_local_reference @kwrest if @kwrest
634
636
  end
635
637
 
636
638
  def bytecode(g)
@@ -685,7 +687,7 @@ module CodeTools
685
687
  g.push @arguments.size
686
688
  g.gine extra_keys
687
689
 
688
- if @kwrest.kind_of? LocalVariableAssignment
690
+ if @kwrest
689
691
  g.push_cpath_top
690
692
  g.find_const :Hash
691
693
  g.send :allocate, 0, true
@@ -733,9 +735,7 @@ module CodeTools
733
735
  end
734
736
 
735
737
  g.send :keywords_extra, 2, true
736
- if @kwrest.kind_of? LocalVariableAssignment
737
- @kwrest.variable.set_bytecode(g)
738
- end
738
+ @kwrest.variable.set_bytecode(g) if @kwrest
739
739
  g.pop
740
740
 
741
741
  done.set!
@@ -751,6 +751,10 @@ module CodeTools
751
751
 
752
752
  module LocalVariable
753
753
  attr_accessor :variable
754
+
755
+ def placeholder?
756
+ name.to_s.start_with?("_:")
757
+ end
754
758
  end
755
759
 
756
760
  class BlockArgument < Node
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -569,7 +569,7 @@ module CodeTools
569
569
  def assign_local_reference(var)
570
570
  if variable = variables[var.name]
571
571
  var.variable = variable.reference
572
- elsif block_local?(var.name)
572
+ elsif block_local?(var.name) || var.placeholder?
573
573
  variable = new_local var.name
574
574
  var.variable = variable.reference
575
575
  elsif reference = @parent.search_local(var.name)
File without changes
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  module CodeTools
2
2
  module AST
3
- VERSION = "2.3.2"
3
+ VERSION = "2.4.0"
4
4
  end
5
5
  end
@@ -0,0 +1,18 @@
1
+ # -*- encoding: us-ascii -*-
2
+
3
+ require "rubinius/code/ast/node"
4
+ require "rubinius/code/ast/self"
5
+ require "rubinius/code/ast/constants"
6
+ require "rubinius/code/ast/control_flow"
7
+ require "rubinius/code/ast/data"
8
+ require "rubinius/code/ast/definitions"
9
+ require "rubinius/code/ast/encoding"
10
+ require "rubinius/code/ast/exceptions"
11
+ require "rubinius/code/ast/file"
12
+ require "rubinius/code/ast/grapher"
13
+ require "rubinius/code/ast/literals"
14
+ require "rubinius/code/ast/operators"
15
+ require "rubinius/code/ast/sends"
16
+ require "rubinius/code/ast/values"
17
+ require "rubinius/code/ast/variables"
18
+ require "rubinius/code/ast/transforms"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubinius-ast
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.2
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Shirai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-18 00:00:00.000000000 Z
11
+ date: 2016-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -17,8 +17,8 @@ dependencies:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
- type: :development
21
20
  prerelease: false
21
+ type: :development
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
@@ -31,8 +31,8 @@ dependencies:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
- type: :development
35
34
  prerelease: false
35
+ type: :development
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
@@ -45,33 +45,27 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - ".gitignore"
49
- - Gemfile
50
- - LICENSE
51
- - README.md
52
- - Rakefile
53
- - lib/rubinius/ast.rb
54
- - lib/rubinius/ast/constants.rb
55
- - lib/rubinius/ast/control_flow.rb
56
- - lib/rubinius/ast/data.rb
57
- - lib/rubinius/ast/definitions.rb
58
- - lib/rubinius/ast/encoding.rb
59
- - lib/rubinius/ast/exceptions.rb
60
- - lib/rubinius/ast/file.rb
61
- - lib/rubinius/ast/grapher.rb
62
- - lib/rubinius/ast/literals.rb
63
- - lib/rubinius/ast/node.rb
64
- - lib/rubinius/ast/operators.rb
65
- - lib/rubinius/ast/self.rb
66
- - lib/rubinius/ast/sends.rb
67
- - lib/rubinius/ast/transforms.rb
68
- - lib/rubinius/ast/values.rb
69
- - lib/rubinius/ast/variables.rb
70
- - lib/rubinius/ast/version.rb
71
- - rubinius-ast.gemspec
72
- homepage: https://github.com/rubinius/rubinius-ast
48
+ - lib/rubinius/code/ast.rb
49
+ - lib/rubinius/code/ast/constants.rb
50
+ - lib/rubinius/code/ast/control_flow.rb
51
+ - lib/rubinius/code/ast/data.rb
52
+ - lib/rubinius/code/ast/definitions.rb
53
+ - lib/rubinius/code/ast/encoding.rb
54
+ - lib/rubinius/code/ast/exceptions.rb
55
+ - lib/rubinius/code/ast/file.rb
56
+ - lib/rubinius/code/ast/grapher.rb
57
+ - lib/rubinius/code/ast/literals.rb
58
+ - lib/rubinius/code/ast/node.rb
59
+ - lib/rubinius/code/ast/operators.rb
60
+ - lib/rubinius/code/ast/self.rb
61
+ - lib/rubinius/code/ast/sends.rb
62
+ - lib/rubinius/code/ast/transforms.rb
63
+ - lib/rubinius/code/ast/values.rb
64
+ - lib/rubinius/code/ast/variables.rb
65
+ - lib/rubinius/code/ast/version.rb
66
+ homepage: https://github.com/rubinius/rubinius-code
73
67
  licenses:
74
- - BSD
68
+ - MPL-2.0
75
69
  metadata: {}
76
70
  post_install_message:
77
71
  rdoc_options: []
@@ -89,9 +83,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
83
  version: '0'
90
84
  requirements: []
91
85
  rubyforge_project:
92
- rubygems_version: 2.4.5
86
+ rubygems_version: 2.5.1
93
87
  signing_key:
94
88
  specification_version: 4
95
89
  summary: An Abstract Syntax Tree for Ruby.
96
90
  test_files: []
97
- has_rdoc:
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in rubinius-ast.gemspec
4
- gemspec
data/LICENSE DELETED
@@ -1,25 +0,0 @@
1
- Copyright (c) 2013, Brian Shirai
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without
5
- modification, are permitted provided that the following conditions are met:
6
-
7
- 1. Redistributions of source code must retain the above copyright notice, this
8
- list of conditions and the following disclaimer.
9
- 2. Redistributions in binary form must reproduce the above copyright notice,
10
- this list of conditions and the following disclaimer in the documentation
11
- and/or other materials provided with the distribution.
12
- 3. Neither the name of the library nor the names of its contributors may be
13
- used to endorse or promote products derived from this software without
14
- specific prior written permission.
15
-
16
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
- DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY DIRECT,
20
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21
- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23
- OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
25
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md DELETED
@@ -1,29 +0,0 @@
1
- # Rubinius::Ast
2
-
3
- TODO: Write a gem description
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'rubinius-ast'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install rubinius-ast
18
-
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
-
23
- ## Contributing
24
-
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
data/Rakefile DELETED
@@ -1 +0,0 @@
1
- require "bundler/gem_tasks"
data/lib/rubinius/ast.rb DELETED
@@ -1,18 +0,0 @@
1
- # -*- encoding: us-ascii -*-
2
-
3
- require "rubinius/ast/node"
4
- require "rubinius/ast/self"
5
- require "rubinius/ast/constants"
6
- require "rubinius/ast/control_flow"
7
- require "rubinius/ast/data"
8
- require "rubinius/ast/definitions"
9
- require "rubinius/ast/encoding"
10
- require "rubinius/ast/exceptions"
11
- require "rubinius/ast/file"
12
- require "rubinius/ast/grapher"
13
- require "rubinius/ast/literals"
14
- require "rubinius/ast/operators"
15
- require "rubinius/ast/sends"
16
- require "rubinius/ast/values"
17
- require "rubinius/ast/variables"
18
- require "rubinius/ast/transforms"
data/rubinius-ast.gemspec DELETED
@@ -1,23 +0,0 @@
1
- # coding: utf-8
2
- require './lib/rubinius/ast/version'
3
-
4
- Gem::Specification.new do |spec|
5
- spec.name = "rubinius-ast"
6
- spec.version = CodeTools::AST::VERSION
7
- spec.authors = ["Brian Shirai"]
8
- spec.email = ["brixen@gmail.com"]
9
- spec.description = %q{An Abstract Syntax Tree for Ruby.}
10
- spec.summary = %q{An Abstract Syntax Tree for Ruby.}
11
- spec.homepage = "https://github.com/rubinius/rubinius-ast"
12
- spec.license = "BSD"
13
-
14
- spec.files = `git ls-files`.split($/)
15
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
- spec.require_paths = ["lib"]
18
-
19
- spec.required_ruby_version = ">= 1.9.2"
20
-
21
- spec.add_development_dependency "bundler", "~> 1.3"
22
- spec.add_development_dependency "rake", "~> 10.0"
23
- end