to_source 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Changelog.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.2.6 2013-01-1
2
+
3
+ * [fixed] Emit super vs super() correctly
4
+
1
5
  # v0.2.5 2012-12-14
2
6
 
3
7
  * [fixed] Emit unary operators correctly
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  to_source
2
2
  =========
3
3
 
4
- [![Build Status](https://secure.travis-ci.org/txus/to_source.png?branch=master)](http://travis-ci.org/txus/to_source)
5
- [![Dependency Status](https://gemnasium.com/txus/to_source.png)](https://gemnasium.com/txus/to_source)
6
- [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/txus/to_source)
4
+ [![Build Status](https://secure.travis-ci.org/mbj/to_source.png?branch=master)](http://travis-ci.org/mbj/to_source)
5
+ [![Dependency Status](https://gemnasium.com/mbj/to_source.png)](https://gemnasium.com/mbj/to_source)
6
+ [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/mbj/to_source)
7
7
 
8
8
  Reverse parser to generate source code from the Rubinius AST. Also works well under MRI.
9
9
 
data/TODO CHANGED
@@ -3,5 +3,4 @@
3
3
  * Do a metric driven refactor once flay flog and friends work.
4
4
  * Report bug about missing Rubinius::AST::SClass#body
5
5
  * Decide about to support 18-mode or not
6
- * Handle Rubinius::AST::PatternArguments
7
6
  * Fix emit of nested boolean uperators and parantheses!
@@ -901,7 +901,12 @@ module ToSource
901
901
  #
902
902
  def super(node)
903
903
  z_super(node)
904
+ # Stupid hack to ensure super() is emitted, this lib needs a redesign!
905
+ arguments = node.arguments
906
+ empty = arguments.array.empty? && !arguments.splat && !node.block.kind_of?(Rubinius::AST::BlockPass19)
907
+ emit('(') if empty
904
908
  arguments(node)
909
+ emit(')') if empty
905
910
  end
906
911
 
907
912
  # Emit concat args
@@ -1175,7 +1180,7 @@ module ToSource
1175
1180
  #
1176
1181
  def element_reference(node)
1177
1182
  dispatch(node.receiver)
1178
- arguments(node,'[',']')
1183
+ arguments(node, '[', ']')
1179
1184
  end
1180
1185
 
1181
1186
  # Emit send with arguments
@@ -484,6 +484,10 @@ describe ToSource::Visitor,'.run' do
484
484
  assert_source 'super'
485
485
  end
486
486
 
487
+ context 'with explicit zero arguments' do
488
+ assert_source 'super()'
489
+ end
490
+
487
491
  context 'with argument' do
488
492
  assert_source 'super(a)'
489
493
  end
@@ -1040,8 +1044,13 @@ describe ToSource::Visitor,'.run' do
1040
1044
 
1041
1045
  context 'with spat and block arguments' do
1042
1046
  assert_source <<-RUBY
1043
- def foo(*bar, &block)
1044
- bar
1047
+ def initialize(attributes, options)
1048
+ @attributes = freeze_object(attributes)
1049
+ @options = freeze_object(options)
1050
+ @attribute_for = Hash[@attributes.map do |attribute|
1051
+ attribute.name
1052
+ end.zip(@attributes)]
1053
+ @keys = coerce_keys
1045
1054
  end
1046
1055
  RUBY
1047
1056
  end
data/to_source.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'to_source'
4
- s.version = '0.2.5'
4
+ s.version = '0.2.6'
5
5
  s.authors = ['Josep M. Bach', 'Markus Schirp']
6
6
  s.email = ['josep.m.bach@gmail.com', 'mbj@seonic.net']
7
7
  s.homepage = 'http://github.com/txus/to_source'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: to_source
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-14 00:00:00.000000000 Z
13
+ date: 2013-01-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: adamantium
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  requirements: []
96
96
  rubyforge_project:
97
- rubygems_version: 1.8.24
97
+ rubygems_version: 1.8.23
98
98
  signing_key:
99
99
  specification_version: 3
100
100
  summary: Transform your Rubinius AST nodes back to source code. Reverse parsing!