mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-20 10:16:37 +00:00
Initial GC integration (#196)
This commit is contained in:
13
src/types.ts
13
src/types.ts
@ -5,7 +5,9 @@
|
||||
|
||||
import {
|
||||
Class,
|
||||
FunctionTarget
|
||||
FunctionTarget,
|
||||
Program,
|
||||
DecoratorFlags
|
||||
} from "./program";
|
||||
|
||||
import {
|
||||
@ -134,6 +136,15 @@ export class Type {
|
||||
}
|
||||
}
|
||||
|
||||
/** Tests if this is a managed type that needs GC hooks. */
|
||||
isManaged(program: Program): bool {
|
||||
if (program.hasGC) {
|
||||
let classReference = this.classReference;
|
||||
return classReference !== null && !classReference.hasDecorator(DecoratorFlags.UNMANAGED);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Computes the sign-extending shift in the target type. */
|
||||
computeSmallIntegerShift(targetType: Type): u32 {
|
||||
return targetType.size - this.size;
|
||||
|
Reference in New Issue
Block a user