tealrb 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -107,7 +107,7 @@ module TEALrb
107
107
  super
108
108
  end
109
109
 
110
- OPCODE_METHODS = TEALrb::Opcodes.instance_methods.freeze
110
+ OPCODE_METHODS = TEALrb::Opcodes::AllOpcodes.instance_methods.freeze
111
111
 
112
112
  def on_send(node)
113
113
  meth_name = node.children[1]
@@ -116,7 +116,7 @@ module TEALrb
116
116
  if meth_name[/(byte|int)cblock/]
117
117
  @skips += node.children[2..]
118
118
  else
119
- params = TEALrb::Opcodes.instance_method(meth_name).parameters
119
+ params = TEALrb::Opcodes::AllOpcodes.instance_method(meth_name).parameters
120
120
  req_params = params.count { |param| param[0] == :req }
121
121
  @skips += node.children[2..(1 + req_params.size)] unless req_params.zero?
122
122
  end
@@ -131,7 +131,7 @@ module TEALrb
131
131
  @skips << node.children[2]
132
132
  elsif node.children.first&.children&.last == :@scratch && meth_name[/=$/]
133
133
  nil
134
- elsif %i[@scratch Gtxn].include? node.children.first&.children&.last
134
+ elsif %i[@scratch Gtxn Accounts ApplicationArgs Assets Apps Logs].include? node.children.first&.children&.last
135
135
  @skips << node.children.last
136
136
  end
137
137
 
@@ -169,6 +169,19 @@ module TEALrb
169
169
  end
170
170
  end
171
171
 
172
+ class InlineIfRewriter < Rewriter
173
+ def on_if(node)
174
+ unless node.loc.respond_to? :else
175
+ conditional = node.children[0].source
176
+ if_blk = node.children[1].source
177
+
178
+ replace(node.loc.expression, "if(#{conditional})\n#{if_blk}\nend")
179
+ end
180
+
181
+ super
182
+ end
183
+ end
184
+
172
185
  class IfRewriter < Rewriter
173
186
  def on_if(node)
174
187
  case node.loc.keyword.source
@@ -33,21 +33,5 @@ module TEALrb
33
33
  def unreserve(slot)
34
34
  @open_slots << slot
35
35
  end
36
-
37
- def respond_to_missing?
38
- !!(meth[/=$/] || @named_slots.key?(meth.to_s))
39
- end
40
-
41
- def method_missing(meth, *args, &block)
42
- super unless block.nil?
43
-
44
- if meth[/=$/]
45
- store(meth.to_s.chomp('='))
46
- elsif @named_slots.key?(meth.to_s)
47
- self[meth.to_s]
48
- else
49
- super
50
- end
51
- end
52
36
  end
53
37
  end
data/lib/tealrb.rb CHANGED
@@ -44,13 +44,13 @@ module TEALrb
44
44
 
45
45
  TEALrb::Opcodes::BINARY_OPCODE_METHOD_MAPPING.each do |meth, opcode|
46
46
  define_method(meth) do |other|
47
- ExtendedOpcodes.send(opcode, self, other)
47
+ TEALrb::Opcodes::ExtendedOpcodes.send(opcode, self, other)
48
48
  end
49
49
  end
50
50
 
51
51
  TEALrb::Opcodes::UNARY_OPCODE_METHOD_MAPPING.each do |meth, opcode|
52
52
  define_method(meth) do
53
- ExtendedOpcodes.send(opcode, self)
53
+ TEALrb::Opcodes::ExtendedOpcodes.send(opcode, self)
54
54
  end
55
55
  end
56
56
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tealrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Polny
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-30 00:00:00.000000000 Z
11
+ date: 2022-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: method_source
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.27'
33
+ version: '1.36'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.27'
40
+ version: '1.36'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 0.6.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.21.2
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 0.21.2
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: yard
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -177,5 +191,5 @@ requirements: []
177
191
  rubygems_version: 3.1.6
178
192
  signing_key:
179
193
  specification_version: 4
180
- summary: A DSL for building Algorand applications
194
+ summary: A DSL for building Algorand smart contracts
181
195
  test_files: []