Skip to content

Commit

Permalink
Add use of delete keyword for weak reference test
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Livesey committed Jul 16, 2024
1 parent e06681b commit ffd8d57
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/weak/expected.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Before unreference: hello
Is weak reference: true
After unreference: null
Before global deletion: test
After global deletion: null
13 changes: 13 additions & 0 deletions test/weak/main.vxl
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,17 @@ syscall io_out("\n");

syscall io_out("After unreference: ");
syscall io_out(weakRef.deref());
syscall io_out("\n");

var globalValue = "test";
var globalWeakRef = globalValue.weak();

syscall io_out("Before global deletion: ");
syscall io_out(globalWeakRef.deref());
syscall io_out("\n");

delete globalValue;

syscall io_out("After global deletion: ");
syscall io_out(globalWeakRef.deref());
syscall io_out("\n");

0 comments on commit ffd8d57

Please sign in to comment.