rubinius-ast 3.6 → 3.7

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: 03b20e9b3a87699e1b270e481571d3cb3ce36ade
4
- data.tar.gz: a1e2ab029d36856c39134ebac9b7281db7100941
3
+ metadata.gz: 06e0b46a159bfd5b70e0be0f33d991baac700441
4
+ data.tar.gz: e263ff589d929bf5a470c66332a0ae429c08bd40
5
5
  SHA512:
6
- metadata.gz: 06a5d737c90eb84cc1576a9b1400a62e490e721e696c6cf54f8dc05b3a063ec2a33a9518267dd71e9a7fe9c08116fb21e14bbc9986d1e9fd3d1d42acad3e96e5
7
- data.tar.gz: 1a5b784a46f81f132810f4128b9c8c0890d4ebd255e6ef1f1d7004332426772d9c68cc72015ef963c76fbf4dfdfebc99cd0ad01abeca3dacee5d84ec534df611
6
+ metadata.gz: ab67238f9e53b7bd5b12e4e4d35a221119b2ae1cbc5a649ced69ea1c6212c133421e3efe34fb316991be446f0cc8b5b3959f2a5e0935f54aa8e42881e745ecdd
7
+ data.tar.gz: e828f1158c94f947e665c46553ec251c8321602f94d4de37ee38152ec9eafc49f7215f65eeb3e2b91af3e132dea6efb157afa108198b4128fe4bcbe3335dbf8b
@@ -290,11 +290,11 @@ module CodeTools
290
290
  @assign = name.to_s[-1] == ?= ? name : :"#{name}="
291
291
  end
292
292
 
293
- def bytecode(g)
293
+ def bytecode(g, anddot=false)
294
294
  pos(g)
295
295
 
296
296
  # X: h.a += 3, given h.a == 2
297
- @receiver.bytecode(g)
297
+ @receiver.bytecode(g) unless anddot
298
298
  # X: TOS = h
299
299
  g.dup
300
300
  g.send @name, 0
@@ -389,6 +389,10 @@ module CodeTools
389
389
  end
390
390
  end
391
391
 
392
+ def sexp_name
393
+ :op_asgn2
394
+ end
395
+
392
396
  def to_sexp
393
397
  case @op
394
398
  when :or
@@ -398,7 +402,26 @@ module CodeTools
398
402
  else
399
403
  op = @op
400
404
  end
401
- [:op_asgn2, @receiver.to_sexp, :"#{@name}=", op, @value.to_sexp]
405
+ [sexp_name, @receiver.to_sexp, :"#{@name}=", op, @value.to_sexp]
406
+ end
407
+ end
408
+
409
+ class AndOpAssignAttribute < OpAssignAttribute
410
+ def bytecode(g)
411
+ done = g.new_label
412
+
413
+ @receiver.bytecode(g)
414
+
415
+ g.dup
416
+ g.goto_if_nil done
417
+
418
+ super(g, true)
419
+
420
+ done.set!
421
+ end
422
+
423
+ def sexp_name
424
+ :and_op_asgn2
402
425
  end
403
426
  end
404
427
 
@@ -20,14 +20,14 @@ module CodeTools
20
20
  end
21
21
  end
22
22
 
23
- def bytecode(g)
23
+ def bytecode(g, anddot=false)
24
24
  pos(g)
25
25
 
26
26
  if @vcall_style
27
27
  if reference = check_local_reference(g)
28
28
  return reference.get_bytecode(g)
29
29
  end
30
- else
30
+ elsif !anddot
31
31
  @receiver.bytecode(g)
32
32
  end
33
33
 
@@ -127,6 +127,25 @@ module CodeTools
127
127
  end
128
128
  end
129
129
 
130
+ class AndSend < Send
131
+ def bytecode(g)
132
+ done = g.new_label
133
+
134
+ @receiver.bytecode(g)
135
+
136
+ g.dup
137
+ g.goto_if_nil done
138
+
139
+ super(g, true)
140
+
141
+ done.set!
142
+ end
143
+
144
+ def sexp_name
145
+ :and_call
146
+ end
147
+ end
148
+
130
149
  class SendWithArguments < Send
131
150
  attr_accessor :arguments
132
151
 
@@ -136,8 +155,8 @@ module CodeTools
136
155
  @arguments = Arguments.new line, arguments
137
156
  end
138
157
 
139
- def bytecode(g)
140
- @receiver.bytecode(g)
158
+ def bytecode(g, anddot=false)
159
+ @receiver.bytecode(g) unless anddot
141
160
  @arguments.bytecode(g)
142
161
 
143
162
  pos(g)
@@ -168,6 +187,25 @@ module CodeTools
168
187
  end
169
188
  end
170
189
 
190
+ class AndSendWithArguments < SendWithArguments
191
+ def bytecode(g)
192
+ done = g.new_label
193
+
194
+ @receiver.bytecode(g)
195
+
196
+ g.dup
197
+ g.goto_if_nil done
198
+
199
+ super(g, true)
200
+
201
+ done.set!
202
+ end
203
+
204
+ def sexp_name
205
+ :and_call
206
+ end
207
+ end
208
+
171
209
  class AttributeAssignment < SendWithArguments
172
210
  def initialize(line, receiver, name, arguments)
173
211
  @line = line
@@ -180,8 +218,8 @@ module CodeTools
180
218
  @arguments = Arguments.new line, arguments
181
219
  end
182
220
 
183
- def bytecode(g)
184
- @receiver.bytecode(g)
221
+ def bytecode(g, anddot=false)
222
+ @receiver.bytecode(g) unless anddot
185
223
  if g.state.masgn?
186
224
  g.swap
187
225
  g.send @name, 1, @privately
@@ -208,6 +246,25 @@ module CodeTools
208
246
  end
209
247
  end
210
248
 
249
+ class AndAttributeAssignment < AttributeAssignment
250
+ def bytecode(g)
251
+ done = g.new_label
252
+
253
+ @receiver.bytecode(g)
254
+
255
+ g.dup
256
+ g.goto_if_nil done
257
+
258
+ super(g, true)
259
+
260
+ done.set!
261
+ end
262
+
263
+ def sexp_name
264
+ :and_attrasgn
265
+ end
266
+ end
267
+
211
268
  class ElementAssignment < SendWithArguments
212
269
  def initialize(line, receiver, arguments)
213
270
  @line = line
@@ -1,5 +1,5 @@
1
1
  module CodeTools
2
2
  module AST
3
- VERSION = "3.6"
3
+ VERSION = "3.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubinius-ast
3
3
  version: !ruby/object:Gem::Version
4
- version: '3.6'
4
+ version: '3.7'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Shirai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-04 00:00:00.000000000 Z
11
+ date: 2016-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  description: An Abstract Syntax Tree for the Rubinius language platform.
@@ -73,17 +73,17 @@ require_paths:
73
73
  - lib
74
74
  required_ruby_version: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - '>='
76
+ - - ">="
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  requirements: []
85
85
  rubyforge_project:
86
- rubygems_version: 2.0.14.1
86
+ rubygems_version: 2.5.1
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: An Abstract Syntax Tree for the Rubinius language platform.