File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ export class HEADER {
14
14
}
15
15
16
16
/** Whether a GC is present or not. */
17
- @inline export const GC = true ;
17
+ @inline export const GC = isDefined ( __REGISTER_IMPL ) ;
18
18
19
19
/** Size of the common runtime header. */
20
20
@inline export const HEADER_SIZE : usize = GC
@@ -96,11 +96,15 @@ export function FREE(ref: usize): void {
96
96
memory . free ( changetype < usize > ( header ) ) ;
97
97
}
98
98
99
- /** Registers a managed object with GC. */
99
+ function CLASSID < T > ( ) : u32 {
100
+ return 1 ;
101
+ }
102
+
103
+ /** Registers a managed object with GC. Cannot be changed anymore afterwards. */
100
104
export function REGISTER < T > ( ref : usize , parentRef : usize ) : void {
101
105
var header = UNREF ( ref ) ;
102
- header . classId = /* TODO: CLASSID<T>() */ 1 ;
103
- // TODO
106
+ header . classId = CLASSID < T > ( ) ;
107
+ if ( GC ) __REGISTER_IMPL ( ref , parentRef ) ;
104
108
}
105
109
106
110
/** ArrayBuffer base class. */
You can’t perform that action at this time.
0 commit comments