mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-12 22:41:27 +00:00
Statically eliminate unnecessary branches in generic contexts
In order to use the new compile time type checks in generics, untaken branches must be skipped because these might be invalid.
This commit is contained in:
10
std/assembly.d.ts
vendored
10
std/assembly.d.ts
vendored
@ -195,15 +195,15 @@ declare function isNaN<T = f32 | f64>(value: T): bool;
|
||||
/** Tests if a 32-bit or 64-bit float is finite, that is not `NaN` or +/-`Infinity`. */
|
||||
declare function isFinite<T = f32 | f64>(value: T): bool;
|
||||
/** Tests if the specified expression is of an integer type and not a reference. Compiles to a constant. */
|
||||
declare function isInteger(value: any): bool;
|
||||
declare function isInteger(value: any): value is number;
|
||||
/** Tests if the specified expression is of a float type. Compiles to a constant. */
|
||||
declare function isFloat(value: any): bool;
|
||||
declare function isFloat(value: any): value is number;
|
||||
/** Tests if the specified expression is of a reference type. Compiles to a constant. */
|
||||
declare function isReference(value: any): bool;
|
||||
declare function isReference(value: any): value is object | string;
|
||||
/** Tests if the specified expression can be used ass a string. Compiles to a constant. */
|
||||
declare function isString(value: any): bool;
|
||||
declare function isString(value: any): value is string | String;
|
||||
/** Tests if the specified expression can be used as an array. Compiles to a constant. */
|
||||
declare function isArray(value: any): bool;
|
||||
declare function isArray(value: any): value is Array<any>;
|
||||
/** Traps if the specified value is not true-ish, otherwise returns the (non-nullable) value. */
|
||||
declare function assert<T>(isTrueish: T, message?: string): T & object; // any better way to model `: T != null`?
|
||||
/** Parses an integer string to a 64-bit float. */
|
||||
|
10
std/portable.d.ts
vendored
10
std/portable.d.ts
vendored
@ -141,15 +141,15 @@ declare function isNaN<T = f32 | f64>(value: T): bool;
|
||||
/** Tests if a 32-bit or 64-bit float is finite, that is not `NaN` or +/-`Infinity`. */
|
||||
declare function isFinite<T = f32 | f64>(value: T): bool;
|
||||
/** Tests if the specified value is a valid integer. Can't distinguish an integer from an integral float. */
|
||||
declare function isInteger(value: any): bool;
|
||||
declare function isInteger(value: any): value is number;
|
||||
/** Tests if the specified value is a valid float. Can't distinguish a float from an integer. */
|
||||
declare function isFloat(value: any): bool;
|
||||
declare function isFloat(value: any): value is number;
|
||||
/** Tests if the specified value is of a reference type. */
|
||||
declare function isReference(value: any): bool;
|
||||
declare function isReference(value: any): value is object | string;
|
||||
/** Tests if the specified value can be used as a string. */
|
||||
declare function isString(value: any): bool;
|
||||
declare function isString(value: any): value is string | String;
|
||||
/** Tests if the specified value can be used as an array. */
|
||||
declare function isArray(value: any): bool;
|
||||
declare function isArray(value: any): value is Array<any>;
|
||||
/** Traps if the specified value is not true-ish, otherwise returns the value. */
|
||||
declare function assert<T>(isTrueish: T | null, message?: string): T;
|
||||
/** Parses an integer string to a 64-bit float. */
|
||||
|
Reference in New Issue
Block a user