Skip to content

Commit 31a5c34

Browse files
committed
fix instance var decl
1 parent dc29397 commit 31a5c34

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

lib/rubex/ast/statement/c_ptr_decl.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ def analyse_statement(local_scope, extern: false)
1717
@type = Helpers.determine_dtype @type, @ptr_level
1818
if @value
1919
@value.analyse_for_target_type(@type, local_scope)
20+
@value.allocate_temps(local_scope)
2021
@value = Helpers.to_lhs_type(self, @value)
22+
@value.release_temps(local_scope)
2123
end
2224

2325
@entry = local_scope.declare_var name: @name, c_name: @c_name,

spec/fixtures/instance_variables/instance_variables.rubex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ class ToChar
1717
def bar
1818
char * b
1919
b = @foo
20+
21+
char * c = @foo
22+
2023
return b
2124
end
2225
end

spec/instance_variables_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
end
2121
end
2222

23-
context "Black box testing" do
23+
context "Black box testing", hell: true do
2424
it "compiles and checks for valid output" do
2525
setup_and_teardown_compiled_files(test_case) do |dir|
2626
require_relative "#{dir}/#{test_case}.#{os_extension}"

0 commit comments

Comments
 (0)