rubinius-ast 3.15 → 3.16

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: 328973f90732961bbcaa7b54cc1fb38183fb6008
4
- data.tar.gz: e2df1578fdd7418afc6e61a3a8e3ed4d3d405046
3
+ metadata.gz: 5b35a8d42ecaadc5079f0c2fab33ae04f8a72c54
4
+ data.tar.gz: 4b472ed53ba2baa4d4cf976f2eafaea9e6f493fc
5
5
  SHA512:
6
- metadata.gz: 6e079793bc8f5b6324f4030380123515730a73d47b9bdb0e2f46020ed5c4e8225193641ff6d7df9c37ceb6498b856a65769b5622a08e0a15faae1a506a314dce
7
- data.tar.gz: c89d62825be15d83e4412c87c13faf6cc779d31ff6c5ec47b352e7a2775b1dd295efe47664fee6ec874d8acb573566ee802f6944ea2ff148600373f5baadea66
6
+ metadata.gz: 7e4b9effcdab32cc9d99f587683d08fea3cb1130a30785ac9e7a05c790ab43448568606e7f532b8317a26181e5c2ac8a3bd9233940254099f6a6696b5f234fe6
7
+ data.tar.gz: 01bf970764aebabdd356f7f5cd8e0879038aec061aa406daf05ba940775a0fe216fa1a42f5049c37c4e552a4022eef3ae8344d5bb62f08ee89074a6c508a3bac
@@ -185,7 +185,7 @@ module CodeTools
185
185
  end
186
186
  end
187
187
 
188
- class DefineFunction < Node
188
+ class DefineFunction < ClosedScope
189
189
  attr_accessor :name, :arguments
190
190
 
191
191
  def initialize(line, name, block)
@@ -196,19 +196,43 @@ module CodeTools
196
196
  @body = block
197
197
  end
198
198
 
199
+ def compile_body(g)
200
+ function = new_generator(g, @name, @arguments)
201
+
202
+ function.push_state self
203
+ function.state.push_super self
204
+ function.definition_line(@line)
205
+
206
+ function.state.push_name @name
207
+
208
+ @arguments.bytecode(function)
209
+ @body.bytecode(function)
210
+
211
+ function.state.pop_name
212
+
213
+ function.local_count = local_count
214
+ function.local_names = local_names
215
+
216
+ function.ret
217
+ function.close
218
+ function.pop_state
219
+
220
+ return function
221
+ end
222
+
199
223
  def bytecode(g)
200
224
  pos(g)
201
225
 
202
- g.push_const :Kernel
203
- g.push_literal sexp_name.to_s
204
- g.push_literal " "
205
- g.push_literal @name.to_s
206
- g.string_build 3
207
- g.send :puts, 1
226
+ g.push_rubinius
227
+ g.push_literal @name
228
+ g.push_generator compile_body(g)
229
+ g.push_scope
230
+
231
+ g.send :add_function, 3
208
232
  end
209
233
 
210
234
  def sexp_name
211
- :fun
235
+ [:fun, @name, @arguments.to_sexp, [:scope, @body.to_sexp]]
212
236
  end
213
237
  end
214
238
 
@@ -1,5 +1,5 @@
1
1
  module CodeTools
2
2
  module AST
3
- VERSION = "3.15"
3
+ VERSION = "3.16"
4
4
  end
5
5
  end
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: '3.15'
4
+ version: '3.16'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Shirai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-20 00:00:00.000000000 Z
11
+ date: 2019-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  version: '0'
84
84
  requirements: []
85
85
  rubyforge_project:
86
- rubygems_version: 2.5.1
86
+ rubygems_version: 2.5.2.3
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: An Abstract Syntax Tree for the Rubinius language platform.