Skip to content

Commit

Permalink
Fix global prefixing
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyalIcing committed Oct 30, 2023
1 parent 88c4afb commit 536e622
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions test/examples/arena.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ defmodule Examples.Arena do
require Orb.Memory
page_offset = Orb.Memory.pages(unquote(opts[:pages]))

module_name = Module.concat(__MODULE__, unquote(name))

offset_global_name =
String.to_atom("#{Macro.inspect_atom(:literal, unquote(name))}.bump_offset")
String.to_atom("#{Macro.inspect_atom(:literal, module_name)}.bump_offset")

global(
do: [
Expand All @@ -33,8 +35,6 @@ defmodule Examples.Arena do
# end
# end

module_name = Module.concat(__MODULE__, unquote(name))

Module.create(module_name, quote do
use Orb

Expand Down
8 changes: 4 additions & 4 deletions test/examples/arena_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ defmodule Examples.ArenaTest do

Orb.include(A.First)

defw test() do
defw test(), I32 do
A.First.alloc(16)
end
end
Expand All @@ -24,12 +24,12 @@ defmodule Examples.ArenaTest do
assert ~S"""
(module $A
(memory (export "memory") 5)
(global $First.bump_offset (mut i32) (i32.const 0))
(global $Second.bump_offset (mut i32) (i32.const 131072))
(global $Examples.ArenaTest.A.First.bump_offset (mut i32) (i32.const 0))
(global $Examples.ArenaTest.A.Second.bump_offset (mut i32) (i32.const 131072))
(func $Examples.ArenaTest.A.First.alloc (param $byte_count i32) (result i32)
(i32.const 0)
)
(func $test (export "test")
(func $test (export "test") (result i32)
(call $Examples.ArenaTest.A.First.alloc (i32.const 16))
)
)
Expand Down

0 comments on commit 536e622

Please sign in to comment.