synvert-core 0.6.5 → 0.7.1

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: c69ab4da0af0653167d9dfe2e71304529c95f229
4
- data.tar.gz: b9be8a50e3742075c6794f1a382ed0deb78cf7b1
3
+ metadata.gz: cdc3fbd5d7dc516d36c8e94946293d811f2fee72
4
+ data.tar.gz: b88d34bbd86b3cbc43d70c5c843e05b6f19cf607
5
5
  SHA512:
6
- metadata.gz: 77432c6fe75a540234f968e75b6912693b2abef90865c1bad86d9e657e12f54f818d9286aaf70be35a612911f87420768d97b1388381226f9974ba853d3f1004
7
- data.tar.gz: 32a22daf02eef74d970d38afb72877979fc95493b0631df472593c8d096e3d4ba133d5226f7d2a6501a43a7da1e003d0cb011a8b967ec7cfb30d507bef7e7e09
6
+ metadata.gz: 20141c9c486a7f3e669e7ffd907d2cbfdb9b88417f176e9db51244445f5434adfe393753d5cacb52fe8d22f75d05150742cd0f6008447ea48966aa8cb6bea1ad
7
+ data.tar.gz: 5fc3a03961b287c19b2bf80701308fb620c3b3d5338e7b011df6dcc0aea66064006f6c3636ed4f64073b482175bd99f69d5f59f7fe498bd4eaa916ede092ad0d
data/CHANGELOG.md CHANGED
@@ -1,22 +1,14 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 0.6.5
3
+ ## 0.7.0 (2014-09-29)
4
4
 
5
+ * Add debug info for MethodNotSupported error.
5
6
  * Add left_value and right_vaue ext to ast node
6
-
7
- ## 0.6.4
8
-
9
7
  * Add arguments for def and defs nodes
10
8
  * Add name for arg and blockarg nodes
11
-
12
- ## 0.6.3
13
-
9
+ * Remove trailing whitespaces in rewritten code
14
10
  * Rewriter.available always returns a hash
15
-
16
- ## 0.6.2
17
-
18
11
  * Support ArgumentsNode in rewritten_source
19
- * Remove trailing whitespaces in rewritten code
20
12
 
21
13
  ## 0.6.0 (2014-09-01)
22
14
 
@@ -35,7 +35,7 @@ module Parser::AST
35
35
  when :defs
36
36
  self.children[1]
37
37
  else
38
- raise Synvert::Core::MethodNotSupported.new "name is not handled for #{self.inspect}"
38
+ raise Synvert::Core::MethodNotSupported.new "name is not handled for #{self.debug_info}"
39
39
  end
40
40
  end
41
41
 
@@ -47,7 +47,7 @@ module Parser::AST
47
47
  if :class == self.type
48
48
  self.children[1]
49
49
  else
50
- raise Synvert::Core::MethodNotSupported.new "parent_class is not handled for #{self.inspect}"
50
+ raise Synvert::Core::MethodNotSupported.new "parent_class is not handled for #{self.debug_info}"
51
51
  end
52
52
  end
53
53
 
@@ -59,7 +59,7 @@ module Parser::AST
59
59
  if :send == self.type
60
60
  self.children[0]
61
61
  else
62
- raise Synvert::Core::MethodNotSupported.new "receiver is not handled for #{self.inspect}"
62
+ raise Synvert::Core::MethodNotSupported.new "receiver is not handled for #{self.debug_info}"
63
63
  end
64
64
  end
65
65
 
@@ -71,7 +71,7 @@ module Parser::AST
71
71
  if :send == self.type
72
72
  self.children[1]
73
73
  else
74
- raise Synvert::Core::MethodNotSupported.new "message is not handled for #{self.inspect}"
74
+ raise Synvert::Core::MethodNotSupported.new "message is not handled for #{self.debug_info}"
75
75
  end
76
76
  end
77
77
 
@@ -90,7 +90,7 @@ module Parser::AST
90
90
  when :defined?
91
91
  self.children
92
92
  else
93
- raise Synvert::Core::MethodNotSupported.new "arguments is not handled for #{self.inspect}"
93
+ raise Synvert::Core::MethodNotSupported.new "arguments is not handled for #{self.debug_info}"
94
94
  end
95
95
  end
96
96
 
@@ -102,7 +102,7 @@ module Parser::AST
102
102
  if :block == self.type
103
103
  self.children[0]
104
104
  else
105
- raise Synvert::Core::MethodNotSupported.new "caller is not handled for #{self.inspect}"
105
+ raise Synvert::Core::MethodNotSupported.new "caller is not handled for #{self.debug_info}"
106
106
  end
107
107
  end
108
108
 
@@ -121,7 +121,7 @@ module Parser::AST
121
121
  return [] if self.children[3].nil?
122
122
  :begin == self.children[3].type ? self.children[3].body : self.children[3..-1]
123
123
  else
124
- raise Synvert::Core::MethodNotSupported.new "body is not handled for #{self.inspect}"
124
+ raise Synvert::Core::MethodNotSupported.new "body is not handled for #{self.debug_info}"
125
125
  end
126
126
  end
127
127
 
@@ -133,7 +133,7 @@ module Parser::AST
133
133
  if :if == self.type
134
134
  self.children[0]
135
135
  else
136
- raise Synvert::Core::MethodNotSupported.new "condition is not handled for #{self.inspect}"
136
+ raise Synvert::Core::MethodNotSupported.new "condition is not handled for #{self.debug_info}"
137
137
  end
138
138
  end
139
139
 
@@ -145,7 +145,7 @@ module Parser::AST
145
145
  if :hash == self.type
146
146
  self.children.map { |child| child.children[0] }
147
147
  else
148
- raise Synvert::Core::MethodNotSupported.new "keys is not handled for #{self.inspect}"
148
+ raise Synvert::Core::MethodNotSupported.new "keys is not handled for #{self.debug_info}"
149
149
  end
150
150
  end
151
151
 
@@ -157,7 +157,7 @@ module Parser::AST
157
157
  if :hash == self.type
158
158
  self.children.map { |child| child.children[1] }
159
159
  else
160
- raise Synvert::Core::MethodNotSupported.new "keys is not handled for #{self.inspect}"
160
+ raise Synvert::Core::MethodNotSupported.new "keys is not handled for #{self.debug_info}"
161
161
  end
162
162
  end
163
163
 
@@ -170,7 +170,7 @@ module Parser::AST
170
170
  if :hash == self.type
171
171
  self.children.any? { |pair_node| pair_node.key.to_value == key }
172
172
  else
173
- raise Synvert::Core::MethodNotSupported.new "has_key? is not handled for #{self.inspect}"
173
+ raise Synvert::Core::MethodNotSupported.new "has_key? is not handled for #{self.debug_info}"
174
174
  end
175
175
  end
176
176
 
@@ -184,7 +184,7 @@ module Parser::AST
184
184
  value_node = self.children.find { |pair_node| pair_node.key.to_value == key }
185
185
  value_node ? value_node.value : nil
186
186
  else
187
- raise Synvert::Core::MethodNotSupported.new "has_key? is not handled for #{self.inspect}"
187
+ raise Synvert::Core::MethodNotSupported.new "has_key? is not handled for #{self.debug_info}"
188
188
  end
189
189
  end
190
190
 
@@ -196,7 +196,7 @@ module Parser::AST
196
196
  if :pair == self.type
197
197
  self.children.first
198
198
  else
199
- raise Synvert::Core::MethodNotSupported.new "key is not handled for #{self.inspect}"
199
+ raise Synvert::Core::MethodNotSupported.new "key is not handled for #{self.debug_info}"
200
200
  end
201
201
  end
202
202
 
@@ -208,7 +208,7 @@ module Parser::AST
208
208
  if :pair == self.type
209
209
  self.children.last
210
210
  else
211
- raise Synvert::Core::MethodNotSupported.new "value is not handled for #{self.inspect}"
211
+ raise Synvert::Core::MethodNotSupported.new "value is not handled for #{self.debug_info}"
212
212
  end
213
213
  end
214
214
 
@@ -223,7 +223,7 @@ module Parser::AST
223
223
  when :lvasgn, :ivasgn
224
224
  self.children[0]
225
225
  else
226
- raise Synvert::Core::MethodNotSupported.new "left_value is not handled for #{self.inspect}"
226
+ raise Synvert::Core::MethodNotSupported.new "left_value is not handled for #{self.debug_info}"
227
227
  end
228
228
  end
229
229
 
@@ -238,7 +238,7 @@ module Parser::AST
238
238
  when :lvasgn, :ivasgn
239
239
  self.children[1]
240
240
  else
241
- raise Synvert::Core::MethodNotSupported.new "right_value is not handled for #{self.inspect}"
241
+ raise Synvert::Core::MethodNotSupported.new "right_value is not handled for #{self.debug_info}"
242
242
  end
243
243
  end
244
244
 
@@ -261,10 +261,19 @@ module Parser::AST
261
261
  when :begin
262
262
  self.children.first.to_value
263
263
  else
264
- raise Synvert::Core::MethodNotSupported.new "to_value is not handled for #{self.inspect}"
264
+ raise Synvert::Core::MethodNotSupported.new "to_value is not handled for #{self.debug_info}"
265
265
  end
266
266
  end
267
267
 
268
+ def debug_info
269
+ "\n" + [
270
+ "file: #{self.loc.expression.source_buffer.name}",
271
+ "line: #{self.loc.expression.line}",
272
+ "source: #{self.to_source}",
273
+ "node: #{self.inspect}"
274
+ ].join("\n")
275
+ end
276
+
268
277
  # Get the source code of current node.
269
278
  #
270
279
  # @return [String] source code.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Synvert
4
4
  module Core
5
- VERSION = "0.6.5"
5
+ VERSION = "0.7.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synvert-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-29 00:00:00.000000000 Z
11
+ date: 2014-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser