mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-19 09:51:33 +00:00
if that's what's necessary
This commit is contained in:
@ -91,6 +91,7 @@ export namespace BuiltinSymbols {
|
||||
// std/builtins.ts
|
||||
export const isInteger = "~lib/builtins/isInteger";
|
||||
export const isFloat = "~lib/builtins/isFloat";
|
||||
export const isBoolean = "~lib/builtins/isBoolean";
|
||||
export const isSigned = "~lib/builtins/isSigned";
|
||||
export const isReference = "~lib/builtins/isReference";
|
||||
export const isString = "~lib/builtins/isString";
|
||||
@ -542,6 +543,14 @@ export function compileCall(
|
||||
? module.createI32(1)
|
||||
: module.createI32(0);
|
||||
}
|
||||
case BuiltinSymbols.isBoolean: { // isBoolean<T!>() / isBoolean<T?>(value: T) -> bool
|
||||
let type = evaluateConstantType(compiler, typeArguments, operands, reportNode);
|
||||
compiler.currentType = Type.bool;
|
||||
if (!type) return module.createUnreachable();
|
||||
return type == Type.bool
|
||||
? module.createI32(1)
|
||||
: module.createI32(0);
|
||||
}
|
||||
case BuiltinSymbols.isSigned: { // isSigned<T!>() / isSigned<T?>(value: T) -> bool
|
||||
let type = evaluateConstantType(compiler, typeArguments, operands, reportNode);
|
||||
compiler.currentType = Type.bool;
|
||||
|
Reference in New Issue
Block a user