mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-07-18 15:52:07 +00:00
Make the transition to ArrayBuffer backed Arrays (#70)
* 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:
src
ast.tsbuiltins.tscompiler.tsdiagnosticMessages.generated.tsdiagnosticMessages.jsondiagnostics.ts
extra
module.tsparser.tsprogram.tstokenizer.tstypes.tsstd
tests
allocators
compiler
if.optimized.watif.untouched.watinlining.optimized.watinlining.tsinlining.untouched.wat
std
array-access.optimized.watarray-access.untouched.watarray.optimized.watarray.tsarray.untouched.watarraybuffer.optimized.watarraybuffer.untouched.watmath.optimized.watmath.untouched.watoperator-overloading.optimized.watoperator-overloading.tsoperator-overloading.untouched.watstatic-array.optimized.watstatic-array.untouched.watstring.optimized.watstring.untouched.wattypedarray.optimized.wattypedarray.tstypedarray.untouched.wat
18
src/types.ts
18
src/types.ts
@@ -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;
|
||||
|
Reference in New Issue
Block a user