mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-19 01:41:30 +00:00
optimize array literal init, warn on unsupported inlining
This commit is contained in:
@ -58,14 +58,17 @@ export declare function isConstant(expression: void): bool;
|
||||
@builtin
|
||||
export declare function isManaged<T>(value?: T): bool;
|
||||
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
export function isNaN<T>(value: T): bool { return value != value; }
|
||||
export function isNaN<T extends number>(value: T): bool {
|
||||
if (!isFloat<T>()) {
|
||||
if (!isInteger<T>()) ERROR("numeric type expected");
|
||||
}
|
||||
return value != value;
|
||||
}
|
||||
|
||||
// @ts-ignore: decorator
|
||||
@inline
|
||||
export function isFinite<T>(value: T): bool {
|
||||
// @ts-ignore: type
|
||||
export function isFinite<T extends number>(value: T): bool {
|
||||
if (!isFloat<T>()) {
|
||||
if (!isInteger<T>()) ERROR("numeric type expected");
|
||||
}
|
||||
return value - value == 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user