optimize array literal init, warn on unsupported inlining

This commit is contained in:
dcode
2019-03-19 08:20:10 +01:00
parent 83566a5512
commit 7693b543f4
67 changed files with 1808 additions and 5124 deletions

View File

@ -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;
}