UNPKG

assemblyscript

Version:

A TypeScript-like language for WebAssembly.

1,153 lines (1,152 loc) 459 kB
declare module "types:assemblyscript/src/common" { /** * @fileoverview Common constants used by various parts of the compiler. * @license Apache-2.0 */ /** Indicates traits of a {@link Node} or {@link Element}. */ export const enum CommonFlags { /** No flags set. */ None = 0, /** Has an `import` modifier. */ Import = 1, /** Has an `export` modifier. */ Export = 2, /** Has a `declare` modifier. */ Declare = 4, /** Has a `const` modifier. */ Const = 8, /** Has a `let` modifier. */ Let = 16, /** Has a `static` modifier. */ Static = 32, /** Has a `readonly` modifier. */ Readonly = 64, /** Has an `abstract` modifier. */ Abstract = 128, /** Has a `public` modifier. */ Public = 256, /** Has a `private` modifier. */ Private = 512, /** Has a `protected` modifier. */ Protected = 1024, /** Has a `get` modifier. */ Get = 2048, /** Has a `set` modifier. */ Set = 4096, /** Has a `override` modifier. */ Override = 8192, /** Has a definite assignment assertion `!` as in `x!: i32;`. */ DefinitelyAssigned = 16384, /** Is ambient, that is either declared or nested in a declared element. */ Ambient = 32768, /** Is generic. */ Generic = 65536, /** Is part of a generic context. */ GenericContext = 131072, /** Is an instance member. */ Instance = 262144, /** Is a constructor. */ Constructor = 524288, /** Is a module export. */ ModuleExport = 1048576, /** Is a module import. */ ModuleImport = 2097152, /** Is resolved. */ Resolved = 4194304, /** Is compiled. */ Compiled = 8388608, /** Did error. */ Errored = 16777216, /** Has a constant value and is therefore inlined. */ Inlined = 33554432, /** Is scoped. */ Scoped = 67108864, /** Is a stub. */ Stub = 134217728, /** Is an overridden method. */ Overridden = 268435456, /** Is (part of) a closure. */ Closure = 536870912, /** Is quoted. */ Quoted = 1073741824, /** Is internally nullable. */ InternallyNullable = -2147483648 } /** Path delimiter inserted between file system levels. */ export const PATH_DELIMITER = "/"; /** Substitution used to indicate the parent directory. */ export const PARENT_SUBST = ".."; /** Function name prefix used for getters. */ export const GETTER_PREFIX = "get:"; /** Function name prefix used for setters. */ export const SETTER_PREFIX = "set:"; /** Delimiter used between class names and instance members. */ export const INSTANCE_DELIMITER = "#"; /** Delimiter used between class and namespace names and static members. */ export const STATIC_DELIMITER = "."; /** Delimiter used between a function and its inner elements. */ export const INNER_DELIMITER = "~"; /** Substitution used to indicate a library directory. */ export const LIBRARY_SUBST = "~lib"; /** Library directory prefix. */ export const LIBRARY_PREFIX: string; /** Path index suffix. */ export const INDEX_SUFFIX: string; /** Stub function delimiter. */ export const STUB_DELIMITER = "@"; /** Common names. */ export namespace CommonNames { const Empty = ""; const i8 = "i8"; const i16 = "i16"; const i32 = "i32"; const i64 = "i64"; const isize = "isize"; const u8 = "u8"; const u16 = "u16"; const u32 = "u32"; const u64 = "u64"; const usize = "usize"; const bool = "bool"; const f32 = "f32"; const f64 = "f64"; const v128 = "v128"; const ref_func = "ref_func"; const ref_extern = "ref_extern"; const ref_any = "ref_any"; const ref_eq = "ref_eq"; const ref_struct = "ref_struct"; const ref_array = "ref_array"; const ref_i31 = "ref_i31"; const ref_string = "ref_string"; const ref_stringview_wtf8 = "ref_stringview_wtf8"; const ref_stringview_wtf16 = "ref_stringview_wtf16"; const ref_stringview_iter = "ref_stringview_iter"; const i8x16 = "i8x16"; const u8x16 = "u8x16"; const i16x8 = "i16x8"; const u16x8 = "u16x8"; const i32x4 = "i32x4"; const u32x4 = "u32x4"; const i64x2 = "i64x2"; const u64x2 = "u64x2"; const f32x4 = "f32x4"; const f64x2 = "f64x2"; const void_ = "void"; const number = "number"; const boolean = "boolean"; const string = "string"; const native = "native"; const indexof = "indexof"; const valueof = "valueof"; const returnof = "returnof"; const nonnull = "nonnull"; const null_ = "null"; const true_ = "true"; const false_ = "false"; const this_ = "this"; const super_ = "super"; const constructor = "constructor"; const ASC_TARGET = "ASC_TARGET"; const ASC_RUNTIME = "ASC_RUNTIME"; const ASC_NO_ASSERT = "ASC_NO_ASSERT"; const ASC_MEMORY_BASE = "ASC_MEMORY_BASE"; const ASC_TABLE_BASE = "ASC_TABLE_BASE"; const ASC_OPTIMIZE_LEVEL = "ASC_OPTIMIZE_LEVEL"; const ASC_SHRINK_LEVEL = "ASC_SHRINK_LEVEL"; const ASC_LOW_MEMORY_LIMIT = "ASC_LOW_MEMORY_LIMIT"; const ASC_EXPORT_RUNTIME = "ASC_EXPORT_RUNTIME"; const ASC_FEATURE_SIGN_EXTENSION = "ASC_FEATURE_SIGN_EXTENSION"; const ASC_FEATURE_MUTABLE_GLOBALS = "ASC_FEATURE_MUTABLE_GLOBALS"; const ASC_FEATURE_NONTRAPPING_F2I = "ASC_FEATURE_NONTRAPPING_F2I"; const ASC_FEATURE_BULK_MEMORY = "ASC_FEATURE_BULK_MEMORY"; const ASC_FEATURE_SIMD = "ASC_FEATURE_SIMD"; const ASC_FEATURE_THREADS = "ASC_FEATURE_THREADS"; const ASC_FEATURE_EXCEPTION_HANDLING = "ASC_FEATURE_EXCEPTION_HANDLING"; const ASC_FEATURE_TAIL_CALLS = "ASC_FEATURE_TAIL_CALLS"; const ASC_FEATURE_REFERENCE_TYPES = "ASC_FEATURE_REFERENCE_TYPES"; const ASC_FEATURE_MULTI_VALUE = "ASC_FEATURE_MULTI_VALUE"; const ASC_FEATURE_GC = "ASC_FEATURE_GC"; const ASC_FEATURE_MEMORY64 = "ASC_FEATURE_MEMORY64"; const ASC_FEATURE_RELAXED_SIMD = "ASC_FEATURE_RELAXED_SIMD"; const ASC_FEATURE_EXTENDED_CONST = "ASC_FEATURE_EXTENDED_CONST"; const ASC_FEATURE_STRINGREF = "ASC_FEATURE_STRINGREF"; const ASC_VERSION_MAJOR = "ASC_VERSION_MAJOR"; const ASC_VERSION_MINOR = "ASC_VERSION_MINOR"; const ASC_VERSION_PATCH = "ASC_VERSION_PATCH"; const I8 = "I8"; const I16 = "I16"; const I32 = "I32"; const I64 = "I64"; const Isize = "Isize"; const U8 = "U8"; const U16 = "U16"; const U32 = "U32"; const U64 = "U64"; const Usize = "Usize"; const Bool = "Bool"; const F32 = "F32"; const F64 = "F64"; const V128 = "V128"; const RefFunc = "RefFunc"; const RefExtern = "RefExtern"; const RefAny = "RefAny"; const RefEq = "RefEq"; const RefStruct = "RefStruct"; const RefArray = "RefArray"; const RefI31 = "RefI31"; const RefString = "RefString"; const String = "String"; const RegExp = "RegExp"; const Object = "Object"; const Array = "Array"; const StaticArray = "StaticArray"; const Set = "Set"; const Map = "Map"; const Function = "Function"; const ArrayBufferView = "ArrayBufferView"; const ArrayBuffer = "ArrayBuffer"; const Math = "Math"; const Mathf = "Mathf"; const NativeMath = "NativeMath"; const NativeMathf = "NativeMathf"; const Int8Array = "Int8Array"; const Int16Array = "Int16Array"; const Int32Array = "Int32Array"; const Int64Array = "Int64Array"; const Uint8Array = "Uint8Array"; const Uint8ClampedArray = "Uint8ClampedArray"; const Uint16Array = "Uint16Array"; const Uint32Array = "Uint32Array"; const Uint64Array = "Uint64Array"; const Float32Array = "Float32Array"; const Float64Array = "Float64Array"; const TemplateStringsArray = "TemplateStringsArray"; const Error = "Error"; const abort = "abort"; const trace = "trace"; const seed = "seed"; const pow = "pow"; const ipow32 = "ipow32"; const ipow64 = "ipow64"; const mod = "mod"; const alloc = "__alloc"; const realloc = "__realloc"; const free = "__free"; const new_ = "__new"; const renew = "__renew"; const link = "__link"; const collect = "__collect"; const visit = "__visit"; const newBuffer = "__newBuffer"; const newArray = "__newArray"; const BLOCK = "~lib/rt/common/BLOCK"; const OBJECT = "~lib/rt/common/OBJECT"; const DefaultMemory = "0"; const DefaultTable = "0"; } export { Feature, featureToString } from "types:assemblyscript/std/assembly/shared/feature"; export { Target } from "types:assemblyscript/std/assembly/shared/target"; export { Runtime } from "types:assemblyscript/std/assembly/shared/runtime"; export { Typeinfo, TypeinfoFlags } from "types:assemblyscript/std/assembly/shared/typeinfo"; } declare module "types:assemblyscript/src/diagnosticMessages.generated" { /** Enum of available diagnostic codes. */ export enum DiagnosticCode { Not_implemented_0 = 100, Operation_is_unsafe = 101, User_defined_0 = 102, Feature_0_is_not_enabled = 103, Low_memory_limit_exceeded_by_static_data_0_1 = 104, Module_requires_at_least_0_pages_of_initial_memory = 105, Module_requires_at_least_0_pages_of_maximum_memory = 106, Shared_memory_requires_maximum_memory_to_be_defined = 107, Shared_memory_requires_feature_threads_to_be_enabled = 108, Transform_0_1 = 109, Start_function_name_0_is_invalid_or_conflicts_with_another_export = 110, Element_0_not_found = 111, Exchange_of_0_values_is_not_supported_by_all_embeddings = 112, Conversion_from_type_0_to_1_requires_an_explicit_cast = 200, Conversion_from_type_0_to_1_will_require_an_explicit_cast_when_switching_between_32_64_bit = 201, Type_0_cannot_be_changed_to_type_1 = 202, Operation_0_cannot_be_applied_to_type_1 = 203, Type_0_cannot_be_nullable = 204, Mutable_value_cannot_be_inlined = 206, Unmanaged_classes_cannot_extend_managed_classes_and_vice_versa = 207, Unmanaged_classes_cannot_implement_interfaces = 208, Invalid_regular_expression_flags = 209, Expression_is_never_null = 210, Class_0_is_final_and_cannot_be_extended = 211, Decorator_0_is_not_valid_here = 212, Duplicate_decorator = 213, Type_0_is_illegal_in_this_context = 214, Optional_parameter_must_have_an_initializer = 215, Class_0_cannot_declare_a_constructor_when_instantiated_from_an_object_literal = 216, Function_0_cannot_be_inlined_into_itself = 217, Cannot_access_method_0_without_calling_it_as_it_requires_this_to_be_set = 218, Optional_properties_are_not_supported = 219, Expression_must_be_a_compile_time_constant = 220, Type_0_is_not_a_function_index_or_function_reference = 221, _0_must_be_a_value_between_1_and_2_inclusive = 222, _0_must_be_a_power_of_two = 223, _0_is_not_a_valid_operator = 224, Expression_cannot_be_represented_by_a_type = 225, Expression_resolves_to_unusual_type_0 = 226, Array_literal_expected = 227, Function_0_is_virtual_and_will_not_be_inlined = 228, Property_0_only_has_a_setter_and_is_missing_a_getter = 229, _0_keyword_cannot_be_used_here = 230, A_class_with_a_constructor_explicitly_returning_something_else_than_this_must_be_final = 231, Property_0_is_always_assigned_before_being_used = 233, Expression_does_not_compile_to_a_value_at_runtime = 234, Only_variables_functions_and_enums_become_WebAssembly_module_exports = 235, Literal_0_does_not_fit_into_i64_or_u64_types = 236, Index_signature_accessors_in_type_0_differ_in_types = 237, Initializer_definitive_assignment_or_nullable_type_expected = 238, Definitive_assignment_has_no_effect_on_local_variables = 239, Ambiguous_operator_overload_0_conflicting_overloads_1_and_2 = 240, Importing_the_table_disables_some_indirect_call_optimizations = 901, Exporting_the_table_disables_some_indirect_call_optimizations = 902, Expression_compiles_to_a_dynamic_check_at_runtime = 903, Indexed_access_may_involve_bounds_checking = 904, Explicitly_returning_constructor_drops_this_allocation = 905, Unnecessary_definite_assignment = 906, _NaN_does_not_compare_equal_to_any_other_value_including_itself_Use_isNaN_x_instead = 907, Comparison_with_0_0_is_sign_insensitive_Use_Object_is_x_0_0_if_the_sign_matters = 908, Unterminated_string_literal = 1002, Identifier_expected = 1003, _0_expected = 1005, A_file_cannot_have_a_reference_to_itself = 1006, Trailing_comma_not_allowed = 1009, Unexpected_token = 1012, A_rest_parameter_must_be_last_in_a_parameter_list = 1014, Parameter_cannot_have_question_mark_and_initializer = 1015, A_required_parameter_cannot_follow_an_optional_parameter = 1016, _0_modifier_cannot_appear_on_class_elements_of_this_kind = 1031, Statements_are_not_allowed_in_ambient_contexts = 1036, Initializers_are_not_allowed_in_ambient_contexts = 1039, _0_modifier_cannot_be_used_here = 1042, A_rest_parameter_cannot_be_optional = 1047, A_rest_parameter_cannot_have_an_initializer = 1048, A_set_accessor_must_have_exactly_one_parameter = 1049, A_set_accessor_parameter_cannot_have_an_initializer = 1052, A_get_accessor_cannot_have_parameters = 1054, Enum_member_must_have_initializer = 1061, Type_parameters_cannot_appear_on_a_constructor_declaration = 1092, Type_annotation_cannot_appear_on_a_constructor_declaration = 1093, An_accessor_cannot_have_type_parameters = 1094, A_set_accessor_cannot_have_a_return_type_annotation = 1095, Type_parameter_list_cannot_be_empty = 1098, Type_argument_list_cannot_be_empty = 1099, A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement = 1104, A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement = 1105, A_return_statement_can_only_be_used_within_a_function_body = 1108, Expression_expected = 1109, Type_expected = 1110, A_default_clause_cannot_appear_more_than_once_in_a_switch_statement = 1113, Duplicate_label_0 = 1114, An_export_assignment_cannot_have_modifiers = 1120, Octal_literals_are_not_allowed_in_strict_mode = 1121, Digit_expected = 1124, Hexadecimal_digit_expected = 1125, Unexpected_end_of_text = 1126, Invalid_character = 1127, _case_or_default_expected = 1130, _super_must_be_followed_by_an_argument_list_or_member_access = 1034, A_declare_modifier_cannot_be_used_in_an_already_ambient_context = 1038, Type_argument_expected = 1140, String_literal_expected = 1141, Line_break_not_permitted_here = 1142, Declaration_expected = 1146, _const_declarations_must_be_initialized = 1155, Unterminated_regular_expression_literal = 1161, Declarations_with_initializers_cannot_also_have_definite_assignment_assertions = 1263, Interface_declaration_cannot_have_implements_clause = 1176, Binary_digit_expected = 1177, Octal_digit_expected = 1178, An_implementation_cannot_be_declared_in_ambient_contexts = 1183, The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer = 1190, An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive = 1198, Unterminated_Unicode_escape_sequence = 1199, Decorators_are_not_valid_here = 1206, _abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration = 1242, Method_0_cannot_have_an_implementation_because_it_is_marked_abstract = 1245, An_interface_property_cannot_have_an_initializer = 1246, A_definite_assignment_assertion_is_not_permitted_in_this_context = 1255, A_class_may_only_extend_another_class = 1311, A_parameter_property_cannot_be_declared_using_a_rest_parameter = 1317, A_default_export_can_only_be_used_in_a_module = 1319, An_expression_of_type_0_cannot_be_tested_for_truthiness = 1345, An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal = 1351, Duplicate_identifier_0 = 2300, Cannot_find_name_0 = 2304, Module_0_has_no_exported_member_1 = 2305, An_interface_can_only_extend_an_interface = 2312, Generic_type_0_requires_1_type_argument_s = 2314, Type_0_is_not_generic = 2315, Type_0_is_not_assignable_to_type_1 = 2322, Property_0_is_private_in_type_1_but_not_in_type_2 = 2325, Index_signature_is_missing_in_type_0 = 2329, _this_cannot_be_referenced_in_current_location = 2332, _this_cannot_be_referenced_in_constructor_arguments = 2333, _super_can_only_be_referenced_in_a_derived_class = 2335, _super_cannot_be_referenced_in_constructor_arguments = 2336, Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors = 2337, Property_0_does_not_exist_on_type_1 = 2339, Property_0_is_private_and_only_accessible_within_class_1 = 2341, Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures = 2349, This_expression_is_not_constructable = 2351, A_function_whose_declared_type_is_not_void_must_return_a_value = 2355, The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access = 2357, The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access = 2364, Operator_0_cannot_be_applied_to_types_1_and_2 = 2365, A_super_call_must_be_the_first_statement_in_the_constructor = 2376, Constructors_for_derived_classes_must_contain_a_super_call = 2377, _get_and_set_accessor_must_have_the_same_type = 2380, Overload_signatures_must_all_be_public_private_or_protected = 2385, Constructor_implementation_is_missing = 2390, Function_implementation_is_missing_or_not_immediately_following_the_declaration = 2391, Multiple_constructor_implementations_are_not_allowed = 2392, Duplicate_function_implementation = 2393, This_overload_signature_is_not_compatible_with_its_implementation_signature = 2394, Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local = 2395, Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2 = 2416, A_class_can_only_implement_an_interface = 2422, A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged = 2434, Types_have_separate_declarations_of_a_private_property_0 = 2442, Property_0_is_protected_in_type_1_but_public_in_type_2 = 2444, Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses = 2445, Variable_0_used_before_its_declaration = 2448, Cannot_redeclare_block_scoped_variable_0 = 2451, The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly = 2453, Variable_0_is_used_before_being_assigned = 2454, Type_alias_0_circularly_references_itself = 2456, Type_0_has_no_property_1 = 2460, The_0_operator_cannot_be_applied_to_type_1 = 2469, In_const_enum_declarations_member_initializer_must_be_constant_expression = 2474, Export_declaration_conflicts_with_exported_declaration_of_0 = 2484, _0_is_referenced_directly_or_indirectly_in_its_own_base_expression = 2506, Cannot_create_an_instance_of_an_abstract_class = 2511, Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_2 = 2515, Object_is_possibly_null = 2531, Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property = 2540, The_target_of_an_assignment_must_be_a_variable_or_a_property_access = 2541, Index_signature_in_type_0_only_permits_reading = 2542, Expected_0_arguments_but_got_1 = 2554, Expected_at_least_0_arguments_but_got_1 = 2555, Expected_0_type_arguments_but_got_1 = 2558, Property_0_has_no_initializer_and_is_not_assigned_in_the_constructor_before_this_is_used_or_returned = 2564, Property_0_is_used_before_being_assigned = 2565, _0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property = 2610, _0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor = 2611, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums = 2651, Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration = 2673, Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration = 2674, Cannot_extend_a_class_0_Class_constructor_is_marked_as_private = 2675, The_this_types_of_each_signature_are_incompatible = 2685, Namespace_0_has_no_exported_member_1 = 2694, Namespace_can_only_have_declarations = 2695, Required_type_parameters_may_not_follow_optional_type_parameters = 2706, Duplicate_property_0 = 2718, Property_0_is_missing_in_type_1_but_required_in_type_2 = 2741, Type_0_has_no_call_signatures = 2757, Get_accessor_0_must_be_at_least_as_accessible_as_the_setter = 2808, This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0 = 4117, File_0_not_found = 6054, Numeric_separators_are_not_allowed_here = 6188, Multiple_consecutive_numeric_separators_are_not_permitted = 6189, This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without = 6234, _super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class = 17009, _super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class = 17011 } /** Translates a diagnostic code to its respective string. */ export function diagnosticCodeToString(code: DiagnosticCode): string; } declare module "types:assemblyscript/src/util/binary" { /** * @fileoverview Various binary reading and writing utility. * @license Apache-2.0 */ /** Reads an 8-bit integer from the specified buffer. */ export function readI8(buffer: Uint8Array, offset: number): number; /** Writes an 8-bit integer to the specified buffer. */ export function writeI8(value: number, buffer: Uint8Array, offset: number): void; /** Reads a 16-bit integer from the specified buffer. */ export function readI16(buffer: Uint8Array, offset: number): number; /** Writes a 16-bit integer to the specified buffer. */ export function writeI16(value: number, buffer: Uint8Array, offset: number): void; /** Reads a 32-bit integer from the specified buffer. */ export function readI32(buffer: Uint8Array, offset: number): number; /** Writes a 32-bit integer to the specified buffer. */ export function writeI32(value: number, buffer: Uint8Array, offset: number): void; /** Writes a 32-bit integer as a 64-bit integer to the specified buffer. */ export function writeI32AsI64(value: number, buffer: Uint8Array, offset: number, unsigned?: boolean): void; /** Reads a 64-bit integer from the specified buffer. */ export function readI64(buffer: Uint8Array, offset: number): i64; /** Writes a 64-bit integer to the specified buffer. */ export function writeI64(value: i64, buffer: Uint8Array, offset: number): void; /** Writes a 64-bit integer as a 32-bit integer to the specified buffer. */ export function writeI64AsI32(value: i64, buffer: Uint8Array, offset: number, unsigned?: boolean): void; /** Reads a 32-bit float from the specified buffer. */ export function readF32(buffer: Uint8Array, offset: number): number; /** Writes a 32-bit float to the specified buffer. */ export function writeF32(value: number, buffer: Uint8Array, offset: number): void; /** Reads a 64-bit float from the specified buffer. */ export function readF64(buffer: Uint8Array, offset: number): number; /** Writes a 64-bit float to the specified buffer. */ export function writeF64(value: number, buffer: Uint8Array, offset: number): void; /** Reads a 128-bit vector from the specified buffer. */ export function readV128(buffer: Uint8Array, offset: number): Uint8Array; /** Writes a 128-bit vector to the specified buffer. */ export function writeV128(value: Uint8Array, buffer: Uint8Array, offset: number): void; } declare module "types:assemblyscript/src/util/collections" { /** * @fileoverview Various collections utility. * @license Apache-2.0 */ /** Clone map. Typically used to track contextual type arguments. */ export function cloneMap<K, V>(map: Map<K, V> | null): Map<K, V>; /** Merge two maps in into new one. */ export function mergeMaps<K, V>(map1: Map<K, V>, map2: Map<K, V>): Map<K, V>; /** BitSet represent growable sequence of N bits. It's faster alternative of Set<i32> when elements * are not too much sparsed. Also it's more memory and cache efficient than Array<bool>. * The best way to use it for short bit sequences (less than 32*(2**16)). */ export class BitSet { words: Uint32Array; constructor(); get size(): number; add(index: number): this; delete(index: number): void; has(index: number): boolean; clear(): void; toArray(): number[]; toString(): string; } } declare module "types:assemblyscript/src/util/math" { /** * @fileoverview Various math utility. * @license Apache-2.0 */ /** Tests if `x` is a power of two. */ export function isPowerOf2(x: number): boolean; export function accuratePow64(x: number, y: number): number; } declare module "types:assemblyscript/src/util/text" { /** * @fileoverview Various character and text utility. * @license Apache-2.0 */ /** An enum of named character codes. */ export const enum CharCode { Null = 0, LineFeed = 10, CarriageReturn = 13, LineSeparator = 8232, ParagraphSeparator = 8233, NextLine = 133, Space = 32, NonBreakingSpace = 160, EnQuad = 8192, EmQuad = 8193, EnSpace = 8194, EmSpace = 8195, ThreePerEmSpace = 8196, FourPerEmSpace = 8197, SixPerEmSpace = 8198, FigureSpace = 8199, PunctuationSpace = 8200, ThinSpace = 8201, HairSpace = 8202, ZeroWidthSpace = 8203, NarrowNoBreakSpace = 8239, IdeographicSpace = 12288, MathematicalSpace = 8287, Ogham = 5760, _ = 95, _0 = 48, _1 = 49, _2 = 50, _3 = 51, _4 = 52, _5 = 53, _6 = 54, _7 = 55, _8 = 56, _9 = 57, a = 97, b = 98, c = 99, d = 100, e = 101, f = 102, g = 103, h = 104, i = 105, j = 106, k = 107, l = 108, m = 109, n = 110, o = 111, p = 112, q = 113, r = 114, s = 115, t = 116, u = 117, v = 118, w = 119, x = 120, y = 121, z = 122, A = 65, B = 66, C = 67, D = 68, E = 69, F = 70, G = 71, H = 72, I = 73, J = 74, K = 75, L = 76, M = 77, N = 78, O = 79, P = 80, Q = 81, R = 82, S = 83, T = 84, U = 85, V = 86, W = 87, X = 88, Y = 89, Z = 90, Ampersand = 38, Asterisk = 42, At = 64, Backslash = 92, Backtick = 96, Bar = 124, Caret = 94, CloseBrace = 125, CloseBracket = 93, CloseParen = 41, Colon = 58, Comma = 44, Dollar = 36, Dot = 46, DoubleQuote = 34, Equals = 61, Exclamation = 33, GreaterThan = 62, Hash = 35, LessThan = 60, Minus = 45, OpenBrace = 123, OpenBracket = 91, OpenParen = 40, Percent = 37, Plus = 43, Question = 63, Semicolon = 59, SingleQuote = 39, Slash = 47, Tilde = 126, Backspace = 8, FormFeed = 12, ByteOrderMark = 65279, Tab = 9, VerticalTab = 11 } /** Tests if the specified character code is some sort of line break. */ export function isLineBreak(c: number): boolean; /** Tests if the specified character code is some sort of white space. */ export function isWhiteSpace(c: number): boolean; /** First high (lead) surrogate. */ export const SURROGATE_HIGH = 55296; /** First low (trail) surrogate. */ export const SURROGATE_LOW = 56320; /** Tests if a code unit or code point is a surrogate. */ export function isSurrogate(c: number): boolean; /** Tests if a surrogate is a high (lead) surrogate. */ export function isSurrogateHigh(c: number): boolean; /** Tests if a surrogate is a low (trail) surrogate. */ export function isSurrogateLow(c: number): boolean; /** Tests if a code unit or code point is a high (lead) surrogate. */ export function isHighSurrogate(c: number): boolean; /** Tests if a code unit or code point is a low (trail) surrogate. */ export function isLowSurrogate(c: number): boolean; /** Converts a surrogate pair to its respective code point. */ export function combineSurrogates(hi: number, lo: number): number; /** Gets the number of UTF-16 code units of the specified code point. */ export function numCodeUnits(cp: number): number; export function isAlpha(c: number): boolean; /** Tests if the specified character code is a valid decimal digit. */ export function isDecimal(c: number): boolean; /** Tests if the specified character code is a valid octal digit. */ export function isOctal(c: number): boolean; /** Tests if the specified character code is a valid hexadecimal symbol [a-f]. */ export function isHexBase(c: number): boolean; /** Tests if the specified character code is a valid hexadecimal digit. */ export function isHexOrDecimal(c: number): boolean; /** Tests if the specified character code is trivially alphanumeric. */ export function isAlphaOrDecimal(c: number): boolean; /** Tests if the specified code point is a valid start of an identifier. */ export function isIdentifierStart(cp: number): boolean; /** Tests if the specified code point is a valid part of an identifier. */ export function isIdentifierPart(cp: number): boolean; /** Tests if the specified string is a valid identifer. */ export function isIdentifier(str: string): boolean; export function indent(sb: string[], level: number): void; /** Escapes a string using the specified kind of quote. */ export function escapeString(str: string, quote: CharCode): string; } declare module "types:assemblyscript/src/util/path" { /** * @fileoverview Various file path utility. * @license Apache-2.0 */ /** * Normalizes the specified path, removing interior placeholders. * Expects a posix-compatible relative path (not Windows compatible). */ export function normalizePath(path: string): string; /** Resolves the specified path relative to the specified origin. */ export function resolvePath(normalizedPath: string, origin: string): string; /** Obtains the directory portion of a normalized path. */ export function dirname(normalizedPath: string): string; } declare module "types:assemblyscript/src/util/terminal" { /** * @fileoverview Terminal utility. * @license Apache-2.0 */ /** Gray terminal color code. */ export const COLOR_GRAY = "\u001B[90m"; /** Red terminal color code. */ export const COLOR_RED = "\u001B[91m"; /** Green terminal color code. */ export const COLOR_GREEN = "\u001B[92m"; /** Yellow terminal color code. */ export const COLOR_YELLOW = "\u001B[93m"; /** Blue terminal color code. */ export const COLOR_BLUE = "\u001B[94m"; /** Magenta terminal color code. */ export const COLOR_MAGENTA = "\u001B[95m"; /** Cyan terminal color code. */ export const COLOR_CYAN = "\u001B[96m"; /** White terminal color code. */ export const COLOR_WHITE = "\u001B[97m"; /** Terminal color reset code. */ export const COLOR_RESET = "\u001B[0m"; /** Checks whether terminal colors are enabled or not. */ export function isColorsEnabled(): boolean; /** Sets whether terminal colors are enabled or not. */ export function setColorsEnabled(isEnabled: boolean): boolean; /** Wraps the specified text in the specified terminal color code. */ export function colorize(text: string, color: string): string; } declare module "types:assemblyscript/src/util/vector" { /** * @fileoverview Various vector utility. * @license Apache-2.0 */ /** v128 zero constant. */ export const v128_zero: Uint8Array<ArrayBuffer>; /** v128 all ones constant. */ export const v128_ones: Uint8Array<ArrayBuffer>; } declare module "types:assemblyscript/src/util" { /** * @fileoverview Various utility. * @license Apache-2.0 */ export * from "types:assemblyscript/src/util/binary"; export * from "types:assemblyscript/src/util/collections"; export * from "types:assemblyscript/src/util/math"; export * from "types:assemblyscript/src/util/path"; export * from "types:assemblyscript/src/util/terminal"; export * from "types:assemblyscript/src/util/text"; export * from "types:assemblyscript/src/util/vector"; } declare module "types:assemblyscript/src/diagnostics" { /** * @fileoverview Shared diagnostic handling. * @license Apache-2.0 */ import { Source } from "types:assemblyscript/src/ast"; import { DiagnosticCode } from "types:assemblyscript/src/diagnosticMessages.generated"; export { DiagnosticCode, diagnosticCodeToString } from "types:assemblyscript/src/diagnosticMessages.generated"; /** Indicates the category of a {@link DiagnosticMessage}. */ export const enum DiagnosticCategory { /** Overly pedantic message. */ Pedantic = 0, /** Informatory message. */ Info = 1, /** Warning message. */ Warning = 2, /** Error message. */ Error = 3 } export class Range { start: number; end: number; source: Source; constructor(start: number, end: number); static join(a: Range, b: Range): Range; equals(other: Range): boolean; get atStart(): Range; get atEnd(): Range; toString(): string; } /** Returns the string representation of the specified diagnostic category. */ export function diagnosticCategoryToString(category: DiagnosticCategory): string; /** Returns the ANSI escape sequence for the specified category. */ export function diagnosticCategoryToColor(category: DiagnosticCategory): string; /** Represents a diagnostic message. */ export class DiagnosticMessage { /** Message code. */ code: number; /** Message category. */ category: DiagnosticCategory; /** Message text. */ message: string; /** Respective source range, if any. */ range: Range | null; /** Related range, if any. */ relatedRange: Range | null; /** Constructs a new diagnostic message. */ private constructor(); /** Creates a new diagnostic message of the specified category. */ static create(code: DiagnosticCode, category: DiagnosticCategory, arg0?: string | null, arg1?: string | null, arg2?: string | null): DiagnosticMessage; /** Tests if this message equals the specified. */ equals(other: DiagnosticMessage): boolean; /** Adds a source range to this message. */ withRange(range: Range): this; /** Adds a related source range to this message. */ withRelatedRange(range: Range): this; /** Converts this message to a string. */ toString(): string; } /** Formats a diagnostic message, optionally with terminal colors and source context. */ export function formatDiagnosticMessage(message: DiagnosticMessage, useColors?: boolean, showContext?: boolean): string; /** Base class of all diagnostic emitters. */ export abstract class DiagnosticEmitter { /** Diagnostic messages emitted so far. */ diagnostics: DiagnosticMessage[]; /** Diagnostic messages already seen, by range. */ private seen; /** Initializes this diagnostic emitter. */ protected constructor(diagnostics?: DiagnosticMessage[] | null); /** Emits a diagnostic message of the specified category. */ emitDiagnostic(code: DiagnosticCode, category: DiagnosticCategory, range: Range | null, relatedRange: Range | null, arg0?: string | null, arg1?: string | null, arg2?: string | null): void; /** Emits an overly pedantic diagnostic message. */ pedantic(code: DiagnosticCode, range: Range | null, arg0?: string | null, arg1?: string | null, arg2?: string | null): void; /** Emits an overly pedantic diagnostic message with a related range. */ pedanticRelated(code: DiagnosticCode, range: Range, relatedRange: Range, arg0?: string | null, arg1?: string | null, arg2?: string | null): void; /** Emits an informatory diagnostic message. */ info(code: DiagnosticCode, range: Range | null, arg0?: string | null, arg1?: string | null, arg2?: string | null): void; /** Emits an informatory diagnostic message with a related range. */ infoRelated(code: DiagnosticCode, range: Range, relatedRange: Range, arg0?: string | null, arg1?: string | null, arg2?: string | null): void; /** Emits a warning diagnostic message. */ warning(code: DiagnosticCode, range: Range | null, arg0?: string | null, arg1?: string | null, arg2?: string | null): void; /** Emits a warning diagnostic message with a related range. */ warningRelated(code: DiagnosticCode, range: Range, relatedRange: Range, arg0?: string | null, arg1?: string | null, arg2?: string | null): void; /** Emits an error diagnostic message. */ error(code: DiagnosticCode, range: Range | null, arg0?: string | null, arg1?: string | null, arg2?: string | null): void; /** Emits an error diagnostic message with a related range. */ errorRelated(code: DiagnosticCode, range: Range, relatedRange: Range, arg0?: string | null, arg1?: string | null, arg2?: string | null): void; } } declare module "types:assemblyscript/src/tokenizer" { /** * @fileoverview A TypeScript tokenizer modified for AssemblyScript. * * The `Tokenizer` scans over a source file and returns one syntactic token * at a time that the parser will combine to an abstract syntax tree. * * It skips over trivia like comments and whitespace and provides a general * mark/reset mechanism for the parser to utilize on ambiguous tokens, with * one token of lookahead otherwise. * * @license Apache-2.0 */ import { Range, DiagnosticMessage, DiagnosticEmitter } from "types:assemblyscript/src/diagnostics"; import { Source, CommentKind } from "types:assemblyscript/src/ast"; /** Named token types. */ export const enum Token { Abstract = 0, As = 1, Async = 2, Await = 3,// ES2017 Break = 4,// ES2017 Case = 5,// ES2017 Catch = 6,// ES2017 Class = 7,// ES2017 Const = 8,// ES2017 Continue = 9,// ES2017 Constructor = 10, Debugger = 11,// ES2017 Declare = 12, Default = 13,// ES2017 Delete = 14,// ES2017 Do = 15,// ES2017 Else = 16,// ES2017 Enum = 17,// ES2017 future Export = 18,// ES2017 Extends = 19,// ES2017 False = 20,// ES Finally = 21,// ES2017 For = 22,// ES2017 From = 23,// AS possible identifier Function = 24,// ES2017 Get = 25, If = 26,// ES2017 Implements = 27,// ES2017 non-lexical Import = 28,// ES2017 In = 29,// ES2017 InstanceOf = 30,// ES2017 Interface = 31,// ES2017 non-lexical Is = 32, KeyOf = 33, Let = 34,// ES2017 non-lexical Module = 35,// AS possible identifier Namespace = 36,// AS possible identifier New = 37,// ES2017 Null = 38,// ES Of = 39, Override = 40, Package = 41,// ES2017 non-lexical Private = 42,// ES2017 non-lexical Protected = 43,// ES2017 non-lexical Public = 44,// ES2017 non-lexical Readonly = 45, Return = 46,// ES2017 Set = 47, Static = 48,// ES2017 non-lexical Super = 49,// ES2017 Switch = 50,// ES2017 This = 51,// ES2017 Throw = 52,// ES2017 True = 53,// ES Try = 54,// ES2017 Type = 55,// AS possible identifier TypeOf = 56,// ES2017 Var = 57,// ES2017 Void = 58,// ES2017 While = 59,// ES2017 With = 60,// ES2017 Yield = 61,// ES2017 OpenBrace = 62, CloseBrace = 63, OpenParen = 64, CloseParen = 65, OpenBracket = 66, CloseBracket = 67, Dot = 68, Dot_Dot_Dot = 69, Semicolon = 70, Comma = 71, LessThan = 72, GreaterThan = 73, LessThan_Equals = 74, GreaterThan_Equals = 75, Equals_Equals = 76, Exclamation_Equals = 77, Equals_Equals_Equals = 78, Exclamation_Equals_Equals = 79, Equals_GreaterThan = 80, Plus = 81, Minus = 82, Asterisk_Asterisk = 83, Asterisk = 84, Slash = 85, Percent = 86, Plus_Plus = 87, Minus_Minus = 88, LessThan_LessThan = 89, GreaterThan_GreaterThan = 90, GreaterThan_GreaterThan_GreaterThan = 91, Ampersand = 92, Bar = 93, Caret = 94, Exclamation = 95, Tilde = 96, Ampersand_Ampersand = 97, Bar_Bar = 98, Question = 99, Colon = 100, Equals = 101, Plus_Equals = 102, Minus_Equals = 103, Asterisk_Equals = 104, Asterisk_Asterisk_Equals = 105, Slash_Equals = 106, Percent_Equals = 107, LessThan_LessThan_Equals = 108, GreaterThan_GreaterThan_Equals = 109, GreaterThan_GreaterThan_GreaterThan_Equals = 110, Ampersand_Equals = 111, Bar_Equals = 112, Caret_Equals = 113, At = 114, Identifier = 115, StringLiteral = 116, IntegerLiteral = 117, FloatLiteral = 118, TemplateLiteral = 119, Invalid = 120, EndOfFile = 121 } export const enum IdentifierHandling { Default = 0, Prefer = 1, Always = 2 } export function tokenFromKeyword(text: string): Token; export function tokenIsAlsoIdentifier(token: Token): boolean; export function isIllegalVariableIdentifier(name: string): boolean; export function operatorTokenToString(token: Token): string; /** Handler for intercepting comments while tokenizing. */ export type CommentHandler = (kind: CommentKind, text: string, range: Range) => void; enum OnNewLine { No = 0, Yes = 1, Unknown = 2 } /** Tokenizes a source to individual {@link Token}s. */ export class Tokenizer extends DiagnosticEmitter { source: Source; end: number; pos: number; token: Token; tokenPos: number; nextToken: Token; nextTokenPos: number; nextTokenOnNewLine: OnNewLine; onComment: CommentHandler | null; /** Constructs a new tokenizer. */ constructor(source: Source, diagnostics?: DiagnosticMessage[] | null); next(identifierHandling?: IdentifierHandling): Token; private unsafeNext; peek(identifierHandling?: IdentifierHandling, maxCompoundLength?: number): Token; peekOnNewLine(): boolean; skipIdentifier(identifierHandling?: IdentifierHandling): boolean; skip(token: Token, identifierHandling?: IdentifierHandling): boolean; mark(): State; discard(state: State): void; reset(state: State): void; clearNextToken(): void; range(start?: number, end?: number): Range; readIdentifier(): string; readingTemplateString: boolean; readStringStart: number; readStringEnd: number; readString(quote?: number, isTaggedTemplate?: boolean): string; readEscapeSequence(isTaggedTemplate?: boolean): string; readRegexpPattern(): string; readRegexpFlags(): string; testInteger(): boolean; readInteger(): i64; readHexInteger(): i64; readDecimalInteger(): i64; readOctalInteger(): i64; readBinaryInteger(): i64; readFloat(): number; readDecimalFloat(): number; /** Reads past one section of a decimal float literal. Returns the number of separators encountered. */ private readDecimalFloatPartial; readHexFloat(): number; readHexadecimalEscape(remain?: number, startIfTaggedTemplate?: number): string; checkForIdentifierStartAfterNumericLiteral(): void; readUnicodeEscape(startIfTaggedTemplate?: number): string; private readExtendedUnicodeEscape; } /** Tokenizer state as returned by {@link Tokenizer#mark} and consumed by {@link Tokenizer#reset}. */ export class State { /** Current position. */ pos: number; /** Current token. */ token: Token; /** Current token's position. */ tokenPos: number; constructor( /** Current position. */ pos: number, /** Current token. */ token: Token, /** Current token's position. */ tokenPos: number); } export {}; } declare module "types:assemblyscript/src/types" { /** * @fileoverview Mappings from AssemblyScript types to WebAssembly types. * @license Apache-2.0 */ import { Class, Program, OperatorKind, Function } from "types:assemblyscript/src/program"; import { TypeRef } from "types:assemblyscript/src/module"; /** Indicates the kind of a type. */ export const enum TypeKind { /** A 1-bit unsigned integer. */ Bool = 0, /** An 8-bit signed integer. */ I8 = 1, /** A 16-bit signed integer. */ I16 = 2, /** A 32-bit signed integer. */ I32 = 3, /** A 64-bit signed integer. */ I64 = 4, /** A 32-bit/64-bit signed integer, depending on the target. */ Isize = 5, /** An 8-bit unsigned integer. */ U8 = 6, /** A 16-bit unsigned integer. */ U16 = 7, /** A 32-bit unsigned integer. Also the base of function types. */ U32 = 8, /** A 64-bit unsigned integer. */ U64 = 9, /** A 32-bit/64-bit unsigned integer, depending on the target. Also the base of class types. */ Usize = 10, /** A 32-bit float. */ F32 = 11, /** A 64-bit double. */ F64 = 12, /** A 128-bit vector. */ V128 = 13, /** External reference. */ Extern = 14, /** Function reference. */ Func = 15, /** Any reference. */ Any = 16, /** Equatable reference. */ Eq = 17, /** Struct reference. */ Struct = 18, /** Array reference. */ Array = 19, /** 31-bit integer reference. */ I31 = 20, /** String reference. */ String = 21, /** WTF8 string view. */ StringviewWTF8 = 22, /** WTF16 string view. */ StringviewWTF16 = 23, /** String iterator. */ StringviewIter = 24, /** No return type. */ Void = 25 } /** Indicates capabilities of a type. */