dtr_to_rust 0.14.6 → 0.14.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/instruction/binary_instruction.rb +35 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15322681bdf48e0dc82cb017c736df9e17e6091167c4f1c0a4dd70d66922eb0b
|
4
|
+
data.tar.gz: 9d39ba82691e9c25a544444e18748a4798fa54d8e3eac533a1afed29a19e323d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|