dtr_to_rust 0.14.5 → 0.14.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
  SHA256:
3
- metadata.gz: 022316c353e8a2563e3392ed13c84b2189655aa085f0596c0577f228714ad0bc
4
- data.tar.gz: a11fe2942e80e3c13bcbc71d23ec2d11434247cb838e98f90f63ecfbc11148ab
3
+ metadata.gz: 15322681bdf48e0dc82cb017c736df9e17e6091167c4f1c0a4dd70d66922eb0b
4
+ data.tar.gz: 9d39ba82691e9c25a544444e18748a4798fa54d8e3eac533a1afed29a19e323d
5
5
  SHA512:
6
- metadata.gz: 58798c1e9497604dc800af6d603808259807aab1dc81be8e63c8348beb1603de4ff4253f2b63d45c0c0eb03b28c32b185836a4744f4814bca5499522b9855143
7
- data.tar.gz: 35368a7f48e8590fdff98c9ccc4e285be3c7ea638a118c57d4e69bcbb7597cb5d2097286a7d0c30d9aae27c1cbf04b6a80d1ec9825b3df47b7cd8bc401e51b57
6
+ metadata.gz: cf52bdcb0a0c04dd2e4e7b61350420eb7cb1b9b35f843e9a9fa13afc3306de1dc1731e22e554a6cb75620e6fd0f2daeabc2719f1cd46dc9a47d4fb078b1bff0b
7
+ data.tar.gz: 43fe25709836c184892f44f5bb43f4de4afde4ae97741247fedf995869c32c04c172be6ff0c4aec86113ae35198274da3720ac5f405418175454d4546a82838c
@@ -9,10 +9,43 @@ module SorobanRustBackend
9
9
  end
10
10
 
11
11
  def handle
12
+ starts_with_ref = @instruction.inputs[0] == '&'
13
+ if starts_with_ref
14
+ @instruction = DTRCore::Instruction.new(
15
+ @instruction.instruction,
16
+ @instruction.inputs[1..],
17
+ @instruction.assign,
18
+ @instruction.scope,
19
+ @instruction.id
20
+ )
21
+ end
22
+
23
+ modded_inputs = []
24
+
25
+ last_was_ref = false
26
+ @instruction.inputs.each do |input|
27
+ if last_was_ref
28
+ modded_inputs << "&#{input}"
29
+ last_was_ref = false
30
+ elsif input == '&'
31
+ last_was_ref = true
32
+ else
33
+ modded_inputs << input
34
+ end
35
+ end
36
+
37
+ @instruction = DTRCore::Instruction.new(
38
+ @instruction.instruction,
39
+ modded_inputs,
40
+ @instruction.assign,
41
+ @instruction.scope,
42
+ @instruction.id
43
+ )
44
+
12
45
  if @metadata[:symbol_table].include?(@instruction.assign) || @instruction.assign.include?('.') || @instruction.assign == 'Thing_to_return'
13
- "#{@instruction.assign} = #{@instruction.inputs[0]} #{@operation} #{@instruction.inputs[1]};"
46
+ "#{@instruction.assign} = #{starts_with_ref ? '&(' : ''}#{@instruction.inputs[0]} #{@operation} #{@instruction.inputs[1]}#{starts_with_ref ? ')' : ''};"
14
47
  else
15
- "let mut #{@instruction.assign} = #{@instruction.inputs[0]} #{@operation} #{@instruction.inputs[1]};"
48
+ "let mut #{@instruction.assign} = #{starts_with_ref ? '&(' : ''}#{@instruction.inputs[0]} #{@operation} #{@instruction.inputs[1]}#{starts_with_ref ? ')' : ''};"
16
49
  end
17
50
  end
18
51
  end
@@ -2,52 +2,50 @@ require 'dtr_core'
2
2
 
3
3
  # This is the main module for the DTR to Rust gem.
4
4
  module SorobanRustBackend
5
- autoload :LCPBT_Forrest, './lib/lcpbt_forrest'
6
- autoload :LeftChildPreferentialBinaryTree, './lib/left_child_preferential_binary_tree'
7
- autoload :Silviculturist, './lib/silviculturist'
8
- autoload :CodeGenerator, './lib/code_generator'
9
- autoload :Condenser, './lib/condenser'
10
- autoload :InstructionHandler, './lib/instruction_handler'
11
- autoload :UserDefinedTypesHandler, './lib/user_defined_types_handler'
12
- autoload :FunctionHandler, './lib/function_handler'
13
- autoload :ContractHandler, './lib/contract_handler'
5
+ autoload :LCPBT_Forrest, 'lcpbt_forrest'
6
+ autoload :LeftChildPreferentialBinaryTree, 'left_child_preferential_binary_tree'
7
+ autoload :Silviculturist, 'silviculturist'
8
+ autoload :CodeGenerator, 'code_generator'
9
+ autoload :InstructionHandler, 'instruction_handler'
10
+ autoload :UserDefinedTypesHandler, 'user_defined_types_handler'
11
+ autoload :FunctionHandler, 'function_handler'
12
+ autoload :ContractHandler, 'contract_handler'
14
13
 
15
14
  # This module contains all the classes that handle the different types of instructions.
16
15
  module Instruction
17
- autoload :Evaluate, './lib/instruction/evaluate'
18
- autoload :Field, './lib/instruction/field'
19
- autoload :Handler, './lib/instruction/handler'
20
- autoload :Print, './lib/instruction/print'
21
- autoload :Return, './lib/instruction/return'
22
- autoload :InstantiateObject, './lib/instruction/instantiate_object'
23
- autoload :Add, './lib/instruction/add'
24
- autoload :Subtract, './lib/instruction/subtract'
25
- autoload :Multiply, './lib/instruction/multiply'
26
- autoload :Divide, './lib/instruction/divide'
27
- autoload :Assign, './lib/instruction/assign'
28
- autoload :Jump, './lib/instruction/jump'
29
- autoload :Goto, './lib/instruction/goto'
30
- autoload :ExitWithMessage, './lib/instruction/exit_with_message'
31
- autoload :And, './lib/instruction/and'
32
- autoload :Or, './lib/instruction/or'
33
- autoload :EndOfIterationCheck, './lib/instruction/end_of_iteration_check'
34
- autoload :Increment, './lib/instruction/increment'
35
- autoload :TryAssign, './lib/instruction/try_assign'
36
- autoload :Break, './lib/instruction/break'
37
- autoload :BinaryInstruction, './lib/instruction/binary_instruction'
16
+ autoload :Evaluate, 'instruction/evaluate'
17
+ autoload :Field, 'instruction/field'
18
+ autoload :Handler, 'instruction/handler'
19
+ autoload :Print, 'instruction/print'
20
+ autoload :Return, 'instruction/return'
21
+ autoload :InstantiateObject, 'instruction/instantiate_object'
22
+ autoload :Add, 'instruction/add'
23
+ autoload :Subtract, 'instruction/subtract'
24
+ autoload :Multiply, 'instruction/multiply'
25
+ autoload :Divide, 'instruction/divide'
26
+ autoload :Assign, 'instruction/assign'
27
+ autoload :Jump, 'instruction/jump'
28
+ autoload :ExitWithMessage, 'instruction/exit_with_message'
29
+ autoload :And, 'instruction/and'
30
+ autoload :Or, 'instruction/or'
31
+ autoload :EndOfIterationCheck, 'instruction/end_of_iteration_check'
32
+ autoload :Increment, 'instruction/increment'
33
+ autoload :TryAssign, 'instruction/try_assign'
34
+ autoload :Break, 'instruction/break'
35
+ autoload :BinaryInstruction, 'instruction/binary_instruction'
38
36
  end
39
37
 
40
38
  module Common
41
- autoload :TypeTranslator, './lib/common/type_translator'
42
- autoload :InputInterpreter, './lib/common/input_interpreter'
39
+ autoload :TypeTranslator, 'common/type_translator'
40
+ autoload :InputInterpreter, 'common/input_interpreter'
43
41
  end
44
42
 
45
43
  module NonTranslatables
46
- autoload :Handler, './lib/non_translatables/handler'
44
+ autoload :Handler, 'non_translatables/handler'
47
45
  end
48
46
 
49
47
  module ContractState
50
- autoload :Handler, './lib/contract_state/handler'
48
+ autoload :Handler, 'contract_state/handler'
51
49
  end
52
50
  end
53
51
 
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dtr_to_rust
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.5
4
+ version: 0.14.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Durst
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2024-07-19 00:00:00.000000000 Z
@@ -55,7 +55,7 @@ licenses:
55
55
  - MIT
56
56
  metadata:
57
57
  rubygems_mfa_required: 'true'
58
- post_install_message:
58
+ post_install_message:
59
59
  rdoc_options: []
60
60
  require_paths:
61
61
  - lib
@@ -70,8 +70,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  requirements: []
73
- rubygems_version: 3.4.10
74
- signing_key:
73
+ rubygems_version: 3.5.13
74
+ signing_key:
75
75
  specification_version: 4
76
76
  summary: Rust to DTR translator (Digicus Textual Representation).
77
77
  test_files: []