dtr_to_rust 0.14.6 → 0.14.8

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: 06ead4aca0be96aad916b9bcf698872601b95af15ab0af7fcdb6d0576d639a96
4
- data.tar.gz: bca7fe27e3988993ef4a28ac17412af4e5e76fbd4d42c9f8ecfa7b56cffc3bd8
3
+ metadata.gz: 60589470c69799232ce92d69cf62671bdd334568a20b771b296d940cde791c82
4
+ data.tar.gz: 110af636a7f5aac2029635752deb42e8a75487b05301c33d0a3261e8e3f78bae
5
5
  SHA512:
6
- metadata.gz: a6ea0dd23bb5c70d074d8b15a5c9b5c6aa00145fa5ccec8fe3d3182efd14aa843735b9a5e13286c4544ac1679e8f31ca32afacaba477d4df2be1ff3062f63e92
7
- data.tar.gz: fbbfde7d90119186ae17a50be67fcc1d5f86c50b0286c60188a99d7cd4a10487223fb804ed7aa8154debf115c4982e19acad89b8a137ef94c26a6e2a36f5549a
6
+ metadata.gz: a309755bcb0b0aff23ac0d1eb544b20d93021045a465032d6bc4f757160a883dfc7f5e80136bb3cbc7c4d739e0ca36a35791e1ec3dd4d7b05c6ba04ad7734e1b
7
+ data.tar.gz: e1315ffd513f36c99ab91f9edd6e3462a35bdd5332c8382c9aa749b28580947301abd5f3f7a62e6b8655ddbe828b60f5bb3ff073f52b900d6fe2434a533788a4
@@ -67,6 +67,7 @@ module SorobanRustBackend
67
67
  Val
68
68
  log
69
69
  token
70
+ HashMap
70
71
  ]
71
72
 
72
73
  used_imports = []
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dtr_to_rust
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.6
4
+ version: 0.14.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Durst