1
0
mirror of https://github.com/fluencelabs/assemblyscript synced 2025-07-18 15:52:07 +00:00

Make the transition to ArrayBuffer backed Arrays ()

* Traverse base classes when resolving overloads
* Implement preliminary TypedArray accessors
* Extract decorator flags from common flags to make space
* Add '**' overload
* Implement basic explicit inlining
* Support inlining of instance methods
* Reduce number of required locals when inlining
* Implement inlining of operator overloads
* Fix issues when inlining generic functions
This commit is contained in:
Daniel Wirtz
2018-04-11 23:35:19 +02:00
committed by GitHub
parent 0f49e054d2
commit 623597c23a
44 changed files with 13242 additions and 4945 deletions

@@ -80,7 +80,9 @@ export const enum TypeFlags {
/** Is a reference type. */
REFERENCE = 1 << 8,
/** Is a nullable type. */
NULLABLE = 1 << 9
NULLABLE = 1 << 9,
/** Is the special 'this' type. */
THIS = 1 << 10
}
/** Represents a resolved type. */
@@ -102,6 +104,8 @@ export class Type {
nullableType: Type | null = null;
/** Respective non-nullable type, if nullable. */
nonNullableType: Type;
/** Respective special 'this' type. */
thisType: Type | null = null;
/** Constructs a new resolved type. */
constructor(kind: TypeKind, flags: TypeFlags, size: i32) {
@@ -157,6 +161,18 @@ export class Type {
return this.nullableType;
}
/** Composes the respective 'this' type of this type. */
asThis(): Type {
var thisType = this.thisType;
if (thisType) return thisType;
thisType = new Type(this.kind, this.flags | TypeFlags.THIS, this.size);
thisType.classReference = this.classReference;
thisType.nullableType = this.nullableType;
thisType.nonNullableType = this.nonNullableType;
this.thisType = thisType;
return thisType;
}
/** Tests if a value of this type is assignable to a target of the specified type. */
isAssignableTo(target: Type, signednessIsImportant: bool = false): bool {
var currentClass: Class | null;