mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-14 23:41:30 +00:00
Initial GC integration (#196)
This commit is contained in:
@ -1,14 +1,18 @@
|
||||
// declare classes to test with
|
||||
class A {}
|
||||
class B {
|
||||
static readonly c: B = changetype<B>(8);
|
||||
static d: A = changetype<A>(16);
|
||||
static readonly c: B = changetype<B>(8); // static root, readonly
|
||||
static d: A = changetype<A>(16); // static root, writable
|
||||
}
|
||||
|
||||
// make sure static properties are compiled
|
||||
B.c;
|
||||
B.d;
|
||||
|
||||
var no_ref: usize = 64;
|
||||
var a_ref: A | null = changetype<A>(24);
|
||||
var b_ref: B = changetype<B>(32);
|
||||
// declare roots
|
||||
var no_ref: usize = 64; // NOT a root, basic value
|
||||
var a_ref: A | null = changetype<A>(24); // global root, nullable
|
||||
var b_ref: B = changetype<B>(32); // global root, non-nullable
|
||||
|
||||
var i: i32 = 0;
|
||||
iterateRoots((ref: usize): void => { assert(<u32>ref == ++i << 3); });
|
||||
|
Reference in New Issue
Block a user