dtr_to_rust 0.0.6 → 0.0.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9d654b804b0e2e70eaa7262d789da82638a1f0085af9cb59f1c15172183b69c
4
- data.tar.gz: e19a3975c472be307f7f2b2e23798026fb09778985c2e822ee15f7592bd2c44e
3
+ metadata.gz: 75a4155b6f5e591a764deb02cca02bd05cb781481ae4d5602f2b784219d90837
4
+ data.tar.gz: 111292133a70c1c1b81b402d263837b271655445262cc62c26ebbead2bdfb398
5
5
  SHA512:
6
- metadata.gz: 8d08d0faf3192c0b014be5280f5cc5355e9db939a52aec85eccc34823e14c1fbd8aec6bc87c39754c19dbd1822e8a7e5e9e17b184a69bbcc96136af93442624e
7
- data.tar.gz: 4d2cd11212145f9e374167142f551dbb732673353a6db399144a685dd507c5b6732e2295201c8510a4495df0cbb645f593e4b442ba9735f5a78371caffce57d0
6
+ metadata.gz: 3dd217b90fd5aa4480c8932ddc95abf57630837aaf0f870248911233e23c093216c131eb18f431e5e65aaa48558c2fb051d480009048fb98bbd1aee7cb916d63
7
+ data.tar.gz: 12a427b6a3f01d2afd76886168a8078d8cf9c7c090830f0e97250e9df71ae923e65b04f3bd43988c53027d147c560398764ea7a9d9882f37686e2874f902a1f9
data/lib/generator.rb CHANGED
@@ -34,7 +34,7 @@ module DTRToRust
34
34
 
35
35
  def generate_contract_header
36
36
  # TODO: don't hardcode imports
37
- @content += "#![no_std]\nuse soroban_sdk::{contract, contractimpl, symbol_short, vec, Env, Symbol, Vec};\n\n"
37
+ @content += "#![no_std]\nuse soroban_sdk::{contract, contractimpl, symbol_short, vec, Env, Symbol, Vec, log};\n\n"
38
38
  end
39
39
 
40
40
  def generate_contract_name
@@ -5,7 +5,7 @@ module DTRToRust
5
5
  # This class is responsible for generating Rust code for the AddAndAssign instruction.
6
6
  class AddAndAssign < Handler
7
7
  def handle
8
- form_rust_string("#{@instruction[:inputs][0]} += #{@instruction[:inputs][1]}", @instruction[:scope])
8
+ form_rust_string("#{@instruction[:inputs][0]} += #{@instruction[:inputs][1]};", @instruction[:scope])
9
9
  end
10
10
  end
11
11
  end
@@ -5,7 +5,11 @@ module DTRToRust
5
5
  # This class is responsible for generating Rust code for the Evaluate instruction.
6
6
  class Evaluate < Handler
7
7
  def handle
8
- rust_string = "#{@instruction[:assign]} = #{@instruction[:inputs][0]}(#{@instruction[:inputs][1..].join(', ')})"
8
+ rust_string = if @instruction[:assign].nil?
9
+ "#{@instruction[:inputs][0]}(#{@instruction[:inputs][1..].join(', ')});"
10
+ else
11
+ "let mut #{@instruction[:assign]} = #{@instruction[:inputs][0]}(#{@instruction[:inputs][1..].join(', ')});"
12
+ end
9
13
 
10
14
  form_rust_string(rust_string, @instruction[:scope])
11
15
  end
@@ -5,7 +5,7 @@ module DTRToRust
5
5
  # This class is responsible for generating Rust code for the LogString instruction.
6
6
  class LogString < Handler
7
7
  def handle
8
- form_rust_string("log!(#{@instruction[:inputs].join(',')})", @instruction[:scope])
8
+ form_rust_string("log!(#{@instruction[:inputs].join(',')});", @instruction[:scope])
9
9
  end
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dtr_to_rust
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Durst
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-02 00:00:00.000000000 Z
11
+ date: 2024-06-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rust to DTR translator (Digicus Textual Representation).
14
14
  email: