Showing preview only (3,092K chars total). Download the full file or copy to clipboard to get everything.
Repository: web-devkits/Wasmnizer-ts
Branch: main
Commit: 228cb803eb71
Files: 499
Total size: 2.9 MB
Directory structure:
gitextract_uq_06no8/
├── .c8rc.json
├── .clang-format
├── .clang-tidy
├── .devcontainer/
│ ├── .dockerignore
│ ├── Dockerfile
│ ├── devcontainer.json
│ └── docker-compose.yml
├── .dockerignore
├── .eslintignore
├── .eslintrc.json
├── .github/
│ └── workflows/
│ ├── benchmark.yml
│ ├── build_llvm_libraries.yml
│ ├── libdyntype_ci.yaml
│ ├── ts2wasm_aot.yml
│ ├── ts2wasm_ci.yaml
│ ├── ts2wasm_macos.yml
│ └── ts2wasm_windows.yml
├── .gitignore
├── .mocharc.json
├── .prettierignore
├── .prettierrc.json
├── ATTRIBUTIONS.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── cli/
│ ├── options.json
│ └── ts2wasm.ts
├── config/
│ ├── config_mgr.ts
│ └── log4js.ts
├── doc/
│ ├── additonal_sematic_check.md
│ ├── architecture.md
│ ├── dev_environment.md
│ ├── developer-guide/
│ │ ├── any_object.md
│ │ ├── basic_concepts.md
│ │ ├── class.md
│ │ ├── expose_host_API.md
│ │ ├── fallback.md
│ │ ├── feature_list.md
│ │ ├── function.md
│ │ ├── generic.md
│ │ ├── import_export.md
│ │ ├── index.md
│ │ ├── interface.md
│ │ └── wasmType_usage.md
│ ├── environment_variables.md
│ ├── faq.md
│ ├── getting_started.md
│ ├── libdyntype_api_spec.md
│ ├── libstruct_indirect_api_spec.md
│ ├── standard-library/
│ │ ├── array.md
│ │ ├── console.md
│ │ ├── index.md
│ │ ├── math.md
│ │ └── string.md
│ └── validation_strategy.md
├── example/
│ └── app-framework/
│ ├── CMakeLists.txt
│ ├── app/
│ │ ├── connection.ts
│ │ ├── request_handler.ts
│ │ ├── request_sender.ts
│ │ └── timer.ts
│ ├── build.sh
│ ├── lib/
│ │ ├── attr_container.ts
│ │ ├── connection.ts
│ │ ├── request.ts
│ │ ├── timer.ts
│ │ └── utils.ts
│ ├── profiles/
│ │ ├── host-aot/
│ │ │ └── wamr_config_wasmnizer_ts.cmake
│ │ └── host-interp/
│ │ └── wamr_config_wasmnizer_ts.cmake
│ └── src/
│ ├── iwasm_main.c
│ └── main.c
├── lib/
│ └── builtin/
│ ├── builtin_name.ts
│ ├── lib.type.d.ts
│ └── lib_builtin.ts
├── package.json
├── runtime-library/
│ ├── CMakeLists.txt
│ ├── LICENSE
│ ├── README.md
│ ├── build.sh
│ ├── deps/
│ │ ├── .gitignore
│ │ └── download.sh
│ ├── libdyntype/
│ │ ├── CMakeLists.txt
│ │ ├── README.md
│ │ ├── dynamic-qjs/
│ │ │ ├── context.c
│ │ │ ├── fallback.c
│ │ │ ├── object.c
│ │ │ ├── pure_dynamic.h
│ │ │ └── type.h
│ │ ├── dynamic-simple/
│ │ │ ├── README.md
│ │ │ ├── context.c
│ │ │ ├── dyn-value/
│ │ │ │ ├── README.md
│ │ │ │ ├── class/
│ │ │ │ │ ├── date.c
│ │ │ │ │ ├── dyn_class.c
│ │ │ │ │ ├── dyn_class.h
│ │ │ │ │ ├── object.c
│ │ │ │ │ └── string.c
│ │ │ │ ├── dyn_value.c
│ │ │ │ └── dyn_value.h
│ │ │ ├── fallback.c
│ │ │ ├── object.c
│ │ │ └── pure_dynamic.h
│ │ ├── extref/
│ │ │ ├── extref.c
│ │ │ └── extref.h
│ │ ├── lib_dyntype_wrapper.c
│ │ ├── libdyntype.c
│ │ ├── libdyntype.cmake
│ │ ├── libdyntype.h
│ │ ├── libdyntype_export.h
│ │ └── test/
│ │ ├── CMakeLists.txt
│ │ ├── dump.cc
│ │ ├── object_property_test.cc
│ │ ├── operator_test.cc
│ │ ├── prototype_test.cc
│ │ ├── test_app.h
│ │ └── types_test.cc
│ ├── main.c
│ ├── stdlib/
│ │ ├── lib_array.c
│ │ ├── lib_console.c
│ │ └── lib_timer.c
│ ├── stringref/
│ │ ├── README.md
│ │ ├── stringref_qjs.c
│ │ └── stringref_simple.c
│ ├── struct-indirect/
│ │ ├── lib_struct_indirect.c
│ │ └── lib_struct_indirect.h
│ ├── utils/
│ │ ├── object_utils.c
│ │ ├── object_utils.h
│ │ ├── type_utils.c
│ │ ├── type_utils.h
│ │ ├── wamr_utils.c
│ │ └── wamr_utils.h
│ └── wamr_config.cmake
├── scripts/
│ ├── LICENSE.txt
│ ├── copy_lib_files.js
│ ├── gdb/
│ │ ├── .gitignore
│ │ ├── constants.py
│ │ ├── utils.py
│ │ ├── wamr_dbg.py
│ │ ├── wamr_exec_env.py
│ │ ├── wamr_objects.py
│ │ └── wamr_types.py
│ ├── hooks/
│ │ └── pre-commit
│ └── link_hooks.js
├── security.md
├── src/
│ ├── backend/
│ │ ├── README.md
│ │ ├── binaryen/
│ │ │ ├── glue/
│ │ │ │ ├── LICENSE
│ │ │ │ ├── NOTICE
│ │ │ │ ├── binaryen.d.ts
│ │ │ │ ├── binaryen.js
│ │ │ │ ├── packType.ts
│ │ │ │ ├── transform.ts
│ │ │ │ └── utils.ts
│ │ │ ├── index.ts
│ │ │ ├── lib/
│ │ │ │ ├── array_utils.ts
│ │ │ │ ├── dyntype/
│ │ │ │ │ └── utils.ts
│ │ │ │ ├── env_init.ts
│ │ │ │ ├── init_builtin_api.ts
│ │ │ │ └── interface/
│ │ │ │ └── meta.c
│ │ │ ├── memory.ts
│ │ │ ├── utils.ts
│ │ │ ├── wasm_expr_gen.ts
│ │ │ ├── wasm_stmt_gen.ts
│ │ │ └── wasm_type_gen.ts
│ │ └── index.ts
│ ├── dump_ast.ts
│ ├── error.ts
│ ├── expression.ts
│ ├── frontend.ts
│ ├── import_resolve.ts
│ ├── log.ts
│ ├── scope.ts
│ ├── semantic_check.ts
│ ├── semantics/
│ │ ├── builder_context.ts
│ │ ├── builtin.ts
│ │ ├── dump.ts
│ │ ├── expression_builder.ts
│ │ ├── flatten.ts
│ │ ├── index.ts
│ │ ├── internal.ts
│ │ ├── ir/
│ │ │ ├── data_pool.ts
│ │ │ ├── function.ts
│ │ │ ├── ir_context.ts
│ │ │ ├── ircode.ts
│ │ │ └── irmodule.ts
│ │ ├── predefined_types.ts
│ │ ├── runtime.ts
│ │ ├── semantics_nodes.ts
│ │ ├── statement_builder.ts
│ │ ├── type_creator.ts
│ │ ├── value.ts
│ │ └── value_types.ts
│ ├── statement.ts
│ ├── type.ts
│ ├── utils.ts
│ └── variable.ts
├── tests/
│ ├── benchmark/
│ │ ├── README.md
│ │ ├── any_basic_type_access.js
│ │ ├── any_basic_type_access.ts
│ │ ├── any_complex_type_access.js
│ │ ├── any_complex_type_access.ts
│ │ ├── array_access.js
│ │ ├── array_access.ts
│ │ ├── array_access_i32.js
│ │ ├── array_access_i32.ts
│ │ ├── binarytrees_class.js
│ │ ├── binarytrees_class.ts
│ │ ├── binarytrees_interface.js
│ │ ├── binarytrees_interface.ts
│ │ ├── class_access.js
│ │ ├── class_access.ts
│ │ ├── class_allocation.js
│ │ ├── class_allocation.ts
│ │ ├── compile_benchmark.js
│ │ ├── fibonacci.js
│ │ ├── fibonacci.ts
│ │ ├── interface_access_field_fastpath.js
│ │ ├── interface_access_field_fastpath.ts
│ │ ├── interface_access_field_slowpath.js
│ │ ├── interface_access_field_slowpath.ts
│ │ ├── interface_access_method_fastpath.js
│ │ ├── interface_access_method_fastpath.ts
│ │ ├── interface_access_method_slowpath.js
│ │ ├── interface_access_method_slowpath.ts
│ │ ├── mandelbrot.js
│ │ ├── mandelbrot.ts
│ │ ├── mandelbrot_i32.js
│ │ ├── mandelbrot_i32.ts
│ │ ├── merkletrees.js
│ │ ├── merkletrees.ts
│ │ ├── nbody_class.js
│ │ ├── nbody_class.ts
│ │ ├── nbody_interface.js
│ │ ├── nbody_interface.ts
│ │ ├── quicksort.js
│ │ ├── quicksort.ts
│ │ ├── quicksort_float.js
│ │ ├── quicksort_float.ts
│ │ ├── run.sh
│ │ ├── run_benchmark.js
│ │ ├── run_benchmark_on_chrome.html
│ │ ├── run_benchmark_on_chrome.js
│ │ ├── spectral_norm.js
│ │ ├── spectral_norm.ts
│ │ ├── spectral_norm_i32.js
│ │ └── spectral_norm_i32.ts
│ ├── samples/
│ │ ├── add_shorthand_prop.ts
│ │ ├── any_as_string.ts
│ │ ├── any_binary_operation.ts
│ │ ├── any_box_any.ts
│ │ ├── any_box_array.ts
│ │ ├── any_box_boolean.ts
│ │ ├── any_box_interface.ts
│ │ ├── any_box_null.ts
│ │ ├── any_box_number.ts
│ │ ├── any_box_obj.ts
│ │ ├── any_box_obj_as_return_value.ts
│ │ ├── any_box_string.ts
│ │ ├── any_box_undefind.ts
│ │ ├── any_cast_class.ts
│ │ ├── any_func_call.ts
│ │ ├── any_nested_literal_value.ts
│ │ ├── any_obj_prop_get.ts
│ │ ├── any_obj_prop_get_as_string.ts
│ │ ├── any_obj_prop_set.ts
│ │ ├── any_operate_with_static.ts
│ │ ├── array_concat.ts
│ │ ├── array_contain_closure.ts
│ │ ├── array_contain_func.ts
│ │ ├── array_copyWithin.ts
│ │ ├── array_elem_get.ts
│ │ ├── array_elem_set.ts
│ │ ├── array_every.ts
│ │ ├── array_fill.ts
│ │ ├── array_filter.ts
│ │ ├── array_find.ts
│ │ ├── array_findIndex.ts
│ │ ├── array_foreach.ts
│ │ ├── array_includes.ts
│ │ ├── array_indexOf.ts
│ │ ├── array_join.ts
│ │ ├── array_lastIndexOf.ts
│ │ ├── array_map.ts
│ │ ├── array_nested_array.ts
│ │ ├── array_nested_literal.ts
│ │ ├── array_nested_literal_array.ts
│ │ ├── array_new_array.ts
│ │ ├── array_new_array_number.ts
│ │ ├── array_new_array_string.ts
│ │ ├── array_new_literal_any.ts
│ │ ├── array_new_literal_boolean.ts
│ │ ├── array_new_literal_number.ts
│ │ ├── array_new_literal_string.ts
│ │ ├── array_pop.ts
│ │ ├── array_push.ts
│ │ ├── array_reduce.ts
│ │ ├── array_reduceRight.ts
│ │ ├── array_reverse.ts
│ │ ├── array_shift.ts
│ │ ├── array_slice.ts
│ │ ├── array_some.ts
│ │ ├── array_sort.ts
│ │ ├── array_specialization.ts
│ │ ├── array_splice.ts
│ │ ├── array_unshift.ts
│ │ ├── array_wasm_basic_type.ts
│ │ ├── arraybuffer_basic.ts
│ │ ├── assign_different_type.ts
│ │ ├── auto_box_unbox.ts
│ │ ├── base_function_call.ts
│ │ ├── block_closure.ts
│ │ ├── block_inner_block.ts
│ │ ├── boolean_basic.ts
│ │ ├── boolean_logic_operator.ts
│ │ ├── boolean_not.ts
│ │ ├── builtin_array.ts
│ │ ├── builtin_console.ts
│ │ ├── builtin_math.ts
│ │ ├── builtin_string.ts
│ │ ├── call_expression_function_hoisting.ts
│ │ ├── call_expression_get_value.ts
│ │ ├── call_expression_param.ts
│ │ ├── cast_any_to_static.ts
│ │ ├── class_accessor.ts
│ │ ├── class_basic.ts
│ │ ├── class_direct_call.ts
│ │ ├── class_extend.ts
│ │ ├── class_field_assign.ts
│ │ ├── class_field_is_array.ts
│ │ ├── class_static_prop.ts
│ │ ├── class_type.ts
│ │ ├── class_vtable_accessor.ts
│ │ ├── class_vtable_call.ts
│ │ ├── closure_basic.ts
│ │ ├── closure_first_class_func.ts
│ │ ├── closure_inner_func.ts
│ │ ├── closure_set_ctx_value.ts
│ │ ├── comments_not_entry.ts
│ │ ├── comments_with_export.ts
│ │ ├── comments_with_import.ts
│ │ ├── complexType_case1.ts
│ │ ├── complexType_case2.ts
│ │ ├── complexType_case3.ts
│ │ ├── complexType_case4.ts
│ │ ├── complexType_case5.ts
│ │ ├── compound_assignment_operator.ts
│ │ ├── dataview_basic.ts
│ │ ├── decimalization.ts
│ │ ├── declare_class.ts
│ │ ├── declare_func.ts
│ │ ├── declare_namespace.ts
│ │ ├── declare_var.ts
│ │ ├── default_param.ts
│ │ ├── enum.ts
│ │ ├── exception_catch_error.ts
│ │ ├── exception_custom_error.ts
│ │ ├── exception_throw_error.ts
│ │ ├── exception_try_structure.ts
│ │ ├── export_alias_identifier.ts
│ │ ├── export_alias_imported_identifier.ts
│ │ ├── export_class.ts
│ │ ├── export_expression_number_literal.ts
│ │ ├── export_expression_obj_literal.ts
│ │ ├── export_from/
│ │ │ ├── classB.ts
│ │ │ └── libA/
│ │ │ ├── index.ts
│ │ │ └── lib/
│ │ │ └── classA.ts
│ │ ├── export_func.ts
│ │ ├── export_func2.ts
│ │ ├── export_func_invoked.ts
│ │ ├── export_implicit_type.ts
│ │ ├── export_namespace.ts
│ │ ├── export_re_export.ts
│ │ ├── export_type.ts
│ │ ├── export_var.ts
│ │ ├── expression_binary.ts
│ │ ├── expression_binary_select.ts
│ │ ├── expression_condition.ts
│ │ ├── expression_unary.ts
│ │ ├── fallback_quickjs.ts
│ │ ├── fallback_quickjs_Date.ts
│ │ ├── fallback_quickjs_JSON.ts
│ │ ├── for_in.ts
│ │ ├── for_of.ts
│ │ ├── func_cast_interface.ts
│ │ ├── function_declaration.ts
│ │ ├── function_expression.ts
│ │ ├── function_scope_var.ts
│ │ ├── generic_class.ts
│ │ ├── generic_func.ts
│ │ ├── generic_param.ts
│ │ ├── global_generics_function.ts
│ │ ├── global_value.ts
│ │ ├── global_variables.ts
│ │ ├── if_statement_case1.ts
│ │ ├── ignore_parameter_in_variable.ts
│ │ ├── import_alias_identifier.ts
│ │ ├── import_alias_reexport_identifier.ts
│ │ ├── import_alias_scope_identifier.ts
│ │ ├── import_class.ts
│ │ ├── import_expression.ts
│ │ ├── import_func.ts
│ │ ├── import_implicit_type.ts
│ │ ├── import_namespace.ts
│ │ ├── import_type.ts
│ │ ├── import_var.ts
│ │ ├── infc_assign_class.ts
│ │ ├── infc_assign_infc.ts
│ │ ├── infc_assign_obj.ts
│ │ ├── infc_case18.ts
│ │ ├── infc_field_assign.ts
│ │ ├── infc_method.ts
│ │ ├── infc_parameter.ts
│ │ ├── infc_return_value.ts
│ │ ├── infc_with_array.ts
│ │ ├── inner_generics_function.ts
│ │ ├── instanceof.ts
│ │ ├── lib.ts
│ │ ├── loop_do_while.ts
│ │ ├── loop_for.ts
│ │ ├── loop_while.ts
│ │ ├── map_callback.ts
│ │ ├── mixed_type.ts
│ │ ├── module-case/
│ │ │ ├── export_declare.ts
│ │ │ ├── export_normal.ts
│ │ │ └── import_case1.ts
│ │ ├── module_start_A.ts
│ │ ├── module_start_B.ts
│ │ ├── module_start_C.ts
│ │ ├── namespace_func.ts
│ │ ├── namespace_generics_function.ts
│ │ ├── namespace_nest.ts
│ │ ├── namespace_var.ts
│ │ ├── nest_generic.ts
│ │ ├── non_null_expression.ts
│ │ ├── null_type_case1.ts
│ │ ├── obj_literal.ts
│ │ ├── obj_method_call.ts
│ │ ├── obj_property_access.ts
│ │ ├── obj_property_dynamic_access.ts
│ │ ├── op_ref_type.ts
│ │ ├── optional_method.ts
│ │ ├── optional_param.ts
│ │ ├── optional_property_access.ts
│ │ ├── parenthesized_expression_case1.ts
│ │ ├── percentToken.ts
│ │ ├── primitiveType.ts
│ │ ├── promise_chain.ts
│ │ ├── promise_constructor.ts
│ │ ├── promise_immediate.ts
│ │ ├── promise_throw.ts
│ │ ├── prototype.ts
│ │ ├── rec_types.ts
│ │ ├── ref_type_cmp.ts
│ │ ├── rest_param_interface.ts
│ │ ├── rest_param_number.ts
│ │ ├── return_statement.ts
│ │ ├── sample_cases.test.ts
│ │ ├── scoped_variables.ts
│ │ ├── shorthand_prop_assign.ts
│ │ ├── spread_operator.ts
│ │ ├── string_binary_operation.ts
│ │ ├── string_or.ts
│ │ ├── string_type.ts
│ │ ├── switch_case_statement.ts
│ │ ├── this_in_closure.ts
│ │ ├── this_in_method.ts
│ │ ├── toString.ts
│ │ ├── top_level_statements.ts
│ │ ├── tuple.ts
│ │ ├── typealias.ts
│ │ ├── typeof.ts
│ │ ├── unary_operator.ts
│ │ ├── undefined_test.ts
│ │ ├── union_assign.ts
│ │ ├── union_field_get.ts
│ │ ├── union_func_call.ts
│ │ ├── unsigned_value.ts
│ │ ├── wasmType_basic.ts
│ │ ├── wasmType_heapType.ts
│ │ └── wasmType_in_otherType.ts
│ ├── unit/
│ │ ├── comment.test.ts
│ │ ├── expression.test.ts
│ │ ├── scope.test.ts
│ │ ├── statement.test.ts
│ │ ├── type.test.ts
│ │ └── variable.test.ts
│ └── utils/
│ └── test_helper.ts
├── tools/
│ └── validate/
│ ├── run_module/
│ │ ├── import_object.js
│ │ ├── readme.md
│ │ ├── run_module_on_chrome.html
│ │ ├── run_module_on_chrome.js
│ │ └── run_module_on_node.js
│ └── wamr/
│ ├── .gitignore
│ ├── README.md
│ ├── create_validation_items.ts
│ ├── index.ts
│ ├── package.json
│ ├── tsconfig.json
│ └── validation.json
├── tsconfig.json
└── tsconfig.release.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .c8rc.json
================================================
{
"all": true,
"include": [
"src/**/*.ts"
],
"exclude": [
"src/backend/binaryen/glue/*.ts"
],
"reporter":[
"text-summary",
"html",
"lcovonly"
],
"report-dir": ".test_output/coverage"
}
================================================
FILE: .clang-format
================================================
# using [clang-formt-12 options](https://releases.llvm.org/12.0.0/tools/clang/docs/ClangFormatStyleOptions.html)
RawStringFormats:
- Language: Cpp
Delimiters:
- c
- C
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
- h
- hpp
CanonicalDelimiter: ''
BasedOnStyle: Mozilla
Language: Cpp
BasedOnStyle: Mozilla
# 6.1
IndentWidth: 4
ContinuationIndentWidth: 4
# 6.2
TabWidth: 4
UseTab: Never
# 6.3
ColumnLimit: 80
# 6.9
AlignAfterOpenBracket: Align
BinPackArguments: true
BinPackParameters: true
# 6.10
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: false
SplitEmptyNamespace: true
# 6.27
BreakBeforeBinaryOperators: NonAssignment
# additional
AlignEscapedNewlines: Left
AllowAllParametersOfDeclarationOnNextLine: false
AllowAllArgumentsOnNextLine: false
PointerAlignment: Right
SpaceAroundPointerQualifiers: After
SortIncludes: false
================================================
FILE: .clang-tidy
================================================
# refer to https://clang.llvm.org/extra/clang-tidy/checks/list.html
Checks: '-*, readability-identifier-naming, clang-analyzer-core.*,'
WarningsAsErrors: '-*'
HeaderFilterRegex: ''
FormatStyle: file
InheritParentConfig: false
AnalyzeTemporaryDtors: false
User: wamr
CheckOptions:
- key: readability-identifier-naming.VariableCase
value: lower_case
- key: readability-identifier-naming.ParameterCase
value: lower_case
- key: readability-identifier-naming.MacroDefinitionCase
value: UPPER_CASE
================================================
FILE: .devcontainer/.dockerignore
================================================
node_modules
================================================
FILE: .devcontainer/Dockerfile
================================================
#
# Copyright (C) 2023 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
FROM node:16.16.0
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# node may come with an older version of npm. Ensure we have a specific npm.
RUN npm install -g npm@8.11.0
################################################################################
# Install prerequisites
RUN apt update
RUN apt install -y \
lsb-release vim \
curl wget
RUN apt install -y \
build-essential cmake g++-multilib libgcc-8-dev lib32gcc-8-dev
## lsb-release allows us to find out which distro we run inside the dev container
# Add binaryen
RUN wget https://github.com/WebAssembly/binaryen/releases/download/version_114/binaryen-version_114-x86_64-linux.tar.gz
RUN tar zxvf binaryen-version_114-x86_64-linux.tar.gz
RUN ln -s binaryen-version_114/bin/wasm-as /usr/local/bin/wasm-as
RUN ln -s binaryen-version_114/bin/wasm-opt /usr/local/bin/wasm-opt
RUN ln -s binaryen-version_114/bin/wasm-shell /usr/local/bin/wasm-shell
# Create the non-root user
RUN userdel -r -f node \
&& groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& usermod --shell /bin/bash vscode \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
USER $USERNAME
================================================
FILE: .devcontainer/devcontainer.json
================================================
{
"name": "DevContainers", // dev container name
"dockerComposeFile": [
"docker-compose.yml" // docker-compose configure
],
// The name of the following service has to match one of the services in docker-compose.yml
"service": "devcontainer", // the name of the “service”
"workspaceFolder": "/ts2wasm",
"extensions": [
"firsttris.vscode-jest-runner",
"esbenp.prettier-vscode",
"eamodio.gitlens",
"ms-vscode.vscode-typescript-tslint-plugin",
"ms-vsliveshare.vsliveshare",
"rtbenfield.vscode-jest-test-adapter",
"dbaeumer.vscode-eslint"
],
"shutdownAction": "stopCompose", // tells VS Code what to do when we close the folder or VS Code
"remoteUser": "vscode"
}
================================================
FILE: .devcontainer/docker-compose.yml
================================================
version: '3.7' # which syntax version the file uses.
services:
devcontainer:
image: acme/workspace:0.1 # the image tag
build: . # specifies the build context for docker-compose
container_name: ts2wasm-container
hostname: ts2wasm-dev.local # gives the dev container a hostname it should use
working_dir: /ts2wasm
volumes:
- ..:/ts2wasm
command: sleep infinity # instructs docker which command to start when the dev container is running
================================================
FILE: .dockerignore
================================================
**/node_modules/
================================================
FILE: .eslintignore
================================================
# cant test switch-case-statement.ts because of eslint checking, add the line temporarily
tests/samples/*
runtime-library/*
build/*
**/dist/*
tools/playground/server/assets/samples/*
lib/builtin/lib.type.d.ts
fuzz/*
================================================
FILE: .eslintrc.json
================================================
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"warnOnUnsupportedTypeScriptVersion": false,
"ecmaVersion": 6,
"sourceType": "module"
},
"env": {
"browser": false,
"node": true,
"es6": true
},
"plugins": [
"@typescript-eslint/eslint-plugin",
"no-null",
"import",
"prettier"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"rules": {
// eslint-plugin-import
// deal with import/export package
"import/no-extraneous-dependencies": ["error", { "optionalDependencies": false }],
"@typescript-eslint/no-this-alias": ["off"],
"@typescript-eslint/no-namespace": ["off"]
// eslint-plugin-no-null
// restricts using null as explicit values for variables or function arguments.
// "no-null/no-null": "error"
}
}
================================================
FILE: .github/workflows/benchmark.yml
================================================
# Copyright (C) 2023 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: ts2wasm_benchmark
on:
# will be triggered on PR events
pull_request:
types:
- opened
- synchronize
paths-ignore:
- "doc/**"
- "README.md"
# will be triggered on push events
push:
branches:
- main
paths-ignore:
- "doc/**"
- "README.md"
# allow to be triggered manually
workflow_dispatch:
# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_llvm_libraries_on_ubuntu_2204:
uses: ./.github/workflows/build_llvm_libraries.yml
with:
os: "ubuntu-22.04"
arch: "X86"
execute_benchmarks:
needs:
[build_llvm_libraries_on_ubuntu_2204]
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-22.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
steps:
- name: checkout
uses: actions/checkout@v3
- name: download wamr repo
run: |
./download.sh
working-directory: runtime-library/deps
# since jobs.id can't contain the dot character
# it is hard to use `format` to assemble the cache key
- name: Get LLVM libraries
id: retrieve_llvm_libs
uses: actions/cache@v3
with:
path: |
./runtime-library/deps/wamr-gc/core/deps/llvm/build/bin
./runtime-library/deps/wamr-gc/core/deps/llvm/build/include
./runtime-library/deps/wamr-gc/core/deps/llvm/build/lib
./runtime-library/deps/wamr-gc/core/deps/llvm/build/libexec
./runtime-library/deps/wamr-gc/core/deps/llvm/build/share
key: ${{ matrix.llvm_cache_key }}
- name: Quit if cache miss
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: Build wamrc
run: |
mkdir build && cd build
cmake .. -DWAMR_BUILD_GC_BINARYEN=1
cmake --build . --config Release --parallel 4
working-directory: ./runtime-library/deps/wamr-gc/wamr-compiler
- name: Install apt packages
run: sudo apt update && sudo apt install g++-multilib -y
- name: Build runtime
run: |
mkdir build && cd build
cmake .. && make -j$(nproc)
working-directory: runtime-library/
- name: Build quickjs
run: |
make -j$(nproc)
working-directory: runtime-library/deps/quickjs
- name: Build compilar
run: |
npm install
npm run release
- name: run benchmarks
run: |
node run_benchmark.js --times=5
working-directory: tests/benchmark
================================================
FILE: .github/workflows/build_llvm_libraries.yml
================================================
# Copyright (C) 2023 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: Reusable workflow-build_llvm_libraries
on:
workflow_call:
inputs:
os:
required: true
type: string
arch:
required: true
type: string
outputs:
cache_key:
description: "A cached key of LLVM libraries"
value: ${{ jobs.build_llvm_libraries.outputs.key}}
jobs:
build_llvm_libraries:
runs-on: ${{ inputs.os }}
outputs:
key: ${{ steps.create_lib_cache_key.outputs.key}}
steps:
- name: checkout
uses: actions/checkout@v3
- name: download wamr repo
run: |
./download.sh
working-directory: runtime-library/deps
- name: install dependencies
run: /usr/bin/env python3 -m pip install -r requirements.txt
working-directory: runtime-library/deps/wamr-gc/build-scripts
- name: retrive the last commit ID
id: get_last_commit
run: echo "last_commit=$(GH_TOKEN=${{ secrets.GITHUB_TOKEN }} /usr/bin/env python3 ./build_llvm.py --llvm-ver)" >> $GITHUB_OUTPUT
working-directory: runtime-library/deps/wamr-gc/build-scripts
# Bump the prefix number to evict all previous caches and
# enforce a clean build, in the unlikely case that some
# weird build error occur and llvm/build becomes a potential
# suspect.
- name: form the cache key of libraries
id: create_lib_cache_key
run: echo "key=0-llvm-libraries-${{ inputs.os }}-${{ inputs.arch }}-${{ steps.get_last_commit.outputs.last_commit }}" >> $GITHUB_OUTPUT
- name: Cache LLVM libraries
id: retrieve_llvm_libs
uses: actions/cache@v3
with:
path: |
./runtime-library/deps/wamr-gc/core/deps/llvm/build/bin
./runtime-library/deps/wamr-gc/core/deps/llvm/build/include
./runtime-library/deps/wamr-gc/core/deps/llvm/build/lib
./runtime-library/deps/wamr-gc/core/deps/llvm/build/libexec
./runtime-library/deps/wamr-gc/core/deps/llvm/build/share
key: ${{ steps.create_lib_cache_key.outputs.key}}
- uses: actions/cache@v3
with:
path: ~/.ccache
key: 0-ccache-${{ inputs.os }}-${{ steps.get_last_commit.outputs.last_commit }}
restore-keys: |
0-ccache-${{ inputs.os }}
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && inputs.os == 'ubuntu-20.04'
- uses: actions/cache@v3
with:
path: ~/.cache/ccache
key: 0-ccache-${{ inputs.os }}-${{ steps.get_last_commit.outputs.last_commit }}
restore-keys: |
0-ccache-${{ inputs.os }}
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && inputs.os == 'ubuntu-22.04'
- run: sudo apt install -y ccache ninja-build
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && startsWith(inputs.os, 'ubuntu')
- uses: actions/cache@v3
with:
path: ~/Library/Caches/ccache
key: 0-ccache-${{ inputs.os }}-${{ steps.get_last_commit.outputs.last_commit }}
restore-keys: |
0-ccache-${{ inputs.os }}
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && startsWith(inputs.os, 'macos')
- run: brew install ccache ninja
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && startsWith(inputs.os, 'macos')
- name: Build LLVM libraries
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
run: /usr/bin/env python3 ./build_llvm.py --arch ${{ inputs.arch }}
working-directory: runtime-library/deps/wamr-gc/build-scripts
================================================
FILE: .github/workflows/libdyntype_ci.yaml
================================================
#
# Copyright (C) 2023 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
name: libdyntype CI
on:
push:
paths:
- "runtime-library/**"
pull_request:
paths:
- "runtime-library/**"
# allow to be triggered manually
workflow_dispatch:
jobs:
build_and_test:
name: 'Libdyntype Build and Test'
runs-on: ubuntu-latest
defaults:
run:
working-directory: runtime-library/libdyntype
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 5
submodules: true
- name: download dependencies
run: |
./download.sh
working-directory: runtime-library/deps
- name: Dyntype Build
run: |
mkdir build && cd build
cmake .. && make
- name: Dyntype Test
run: |
cd test
mkdir build && cd build
cmake .. -DUNITTEST_USE_SANITIZER=1
make
make test
================================================
FILE: .github/workflows/ts2wasm_aot.yml
================================================
# Copyright (C) 2023 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: ts2wasm_aot
on:
# will be triggered on PR events
pull_request:
types:
- opened
- synchronize
paths-ignore:
- "doc/**"
- "README.md"
# will be triggered on push events
push:
branches:
- main
paths-ignore:
- "doc/**"
- "README.md"
# allow to be triggered manually
workflow_dispatch:
# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_llvm_libraries_on_ubuntu_2204:
uses: ./.github/workflows/build_llvm_libraries.yml
with:
os: "ubuntu-22.04"
arch: "X86"
validate_aot_execution:
needs:
[build_llvm_libraries_on_ubuntu_2204]
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-22.04
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
target: [
"X86_64", "X86_32"
]
simple_libdyntype: [
1, 0
]
# node-version: [10.x, 12.x, 14.x, 15.x, 16.x]
# Test the latest version of Node.js plus the last two LTS versions.
# node-version:
# - "*"
# - lts/*
# - lts/-1
node-version: [16.x]
steps:
- name: checkout
uses: actions/checkout@v3
- name: Use node version ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: download wamr repo
run: |
./download.sh
working-directory: runtime-library/deps
# since jobs.id can't contain the dot character
# it is hard to use `format` to assemble the cache key
- name: Get LLVM libraries
id: retrieve_llvm_libs
uses: actions/cache@v3
with:
path: |
./runtime-library/deps/wamr-gc/core/deps/llvm/build/bin
./runtime-library/deps/wamr-gc/core/deps/llvm/build/include
./runtime-library/deps/wamr-gc/core/deps/llvm/build/lib
./runtime-library/deps/wamr-gc/core/deps/llvm/build/libexec
./runtime-library/deps/wamr-gc/core/deps/llvm/build/share
key: ${{ matrix.llvm_cache_key }}
- name: Quit if cache miss
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: Build wamrc
run: |
mkdir build && cd build
cmake .. -DWAMR_BUILD_GC_BINARYEN=1
cmake --build . --config Release --parallel 4
working-directory: ./runtime-library/deps/wamr-gc/wamr-compiler
- name: Install apt packages
run: sudo apt update && sudo apt install g++-multilib -y
- name: Build runtime
run: |
mkdir build && cd build
cmake .. -DWAMR_BUILD_TARGET=${{ matrix.target }} -DUSE_SIMPLE_LIBDYNTYPE=${{ matrix.simple_libdyntype }} -DWAMR_GC_IN_EVERY_ALLOCATION=1 -DUSE_SANITIZER=1 && make -j$(nproc)
working-directory: runtime-library/
- name: Validate execution
run:
SIMPLE_LIBDYNTYPE=${{ matrix.simple_libdyntype }} AOT=1 TARGET_ARCH=${{ matrix.target }} npm start
working-directory: tools/validate/wamr
================================================
FILE: .github/workflows/ts2wasm_ci.yaml
================================================
#
# Copyright (C) 2023 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
name: ts2wasm-compiler CI
on:
push:
paths-ignore:
- "doc/**"
- "README.md"
pull_request:
types:
- opened
- synchronize
paths-ignore:
- "doc/**"
- "README.md"
# allow to be triggered manually
workflow_dispatch:
# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
install_dependencies:
runs-on: ubuntu-latest
strategy:
matrix:
# node-version: [10.x, 12.x, 14.x, 15.x, 16.x]
# Test the latest version of Node.js plus the last two LTS versions.
# node-version:
# - "*"
# - lts/*
# - lts/-1
node-version: [16.x]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 5
- name: Use node version ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- name: Linter
run: npx lint-staged
validate_compilation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 5
- run: npm install
- name: Test compilation
run:
npm run test
validate_execution:
needs:
[install_dependencies]
runs-on: ubuntu-latest
strategy:
matrix:
target: [
"X86_64", "X86_32"
]
simple_libdyntype: [
1, 0
]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 5
- name: Use node version 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: download dependencies
run: |
./download.sh
sudo apt update && sudo apt install g++-multilib -y
working-directory: runtime-library/deps
- name: Build runtime
run: |
mkdir build && cd build
cmake .. -DWAMR_BUILD_TARGET=${{ matrix.target }} -DUSE_SIMPLE_LIBDYNTYPE=${{ matrix.simple_libdyntype }} -DWAMR_GC_IN_EVERY_ALLOCATION=1 -DUSE_SANITIZER=1 && make -j$(nproc)
working-directory: runtime-library/
- name: Validate execution
run:
SIMPLE_LIBDYNTYPE=${{ matrix.simple_libdyntype }} npm start
working-directory: tools/validate/wamr
================================================
FILE: .github/workflows/ts2wasm_macos.yml
================================================
#
# Copyright (C) 2023 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
name: ts2wasm-compiler CI MacOS
on:
push:
paths-ignore:
- "doc/**"
- "README.md"
pull_request:
types:
- opened
- synchronize
paths-ignore:
- "doc/**"
- "README.md"
# allow to be triggered manually
workflow_dispatch:
# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
install_dependencies:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# node-version: [10.x, 12.x, 14.x, 15.x, 16.x]
# Test the latest version of Node.js plus the last two LTS versions.
# node-version:
# - "*"
# - lts/*
# - lts/-1
node-version: [16.x, 18.x]
os: [macos-12]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 5
- name: Use node version ${{ matrix.node-version }}
uses: actions/setup-node@v3
- run: npm install
- name: Linter
run: npx lint-staged
validate_compilation:
strategy:
matrix:
# node-version: [10.x, 12.x, 14.x, 15.x, 16.x]
# Test the latest version of Node.js plus the last two LTS versions.
# node-version:
# - "*"
# - lts/*
# - lts/-1
os: [macos-12]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 5
- run: npm install
- name: build the compiler
run: npm run build
- name: compile single file
run: node build/cli/ts2wasm.js tests/samples/any_as_string.ts -o test.wasm
- name: Test compilation
run:
npm run test
validate_execution:
needs:
[install_dependencies]
runs-on: macos-latest
strategy:
matrix:
target: [
"X86_64"
]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 5
- name: Use node version node-16
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: download dependencies
run: |
./download.sh
working-directory: runtime-library/deps
- name: Build runtime
run: |
mkdir build && cd build
cmake .. -DWAMR_BUILD_PLATFORM="darwin" -DWAMR_BUILD_TARGET=${{ matrix.target }} -DWAMR_GC_IN_EVERY_ALLOCATION=1 && make -j$(nproc)
working-directory: runtime-library/
# TODO: fix validation for MacOS CI
# - name: Validate execution
# run:
# npm start
# working-directory: tools/validate/wamr
================================================
FILE: .github/workflows/ts2wasm_windows.yml
================================================
#
# Copyright (C) 2023 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
name: ts2wasm-compiler windows
on:
push:
paths-ignore:
- "doc/**"
- "README.md"
pull_request:
types:
- opened
- synchronize
paths-ignore:
- "doc/**"
- "README.md"
# allow to be triggered manually
workflow_dispatch:
# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
install_dependencies:
runs-on: windows-latest
strategy:
matrix:
# node-version: [10.x, 12.x, 14.x, 15.x, 16.x]
# Test the latest version of Node.js plus the last two LTS versions.
# node-version:
# - "*"
# - lts/*
# - lts/-1
node-version: [16.x]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 5
- name: Use node version ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
validate_compilation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 5
- run: npm install
- name: Test compilation
run:
npm run test
================================================
FILE: .gitignore
================================================
node_modules
build
dist
out
.nyc_output
coverage
c-backend
logs
lib/builtin/watFile/
logs
*.swp
*.wat
*.wasm
*.log
*.swo
example/app-framework/cmake-build/
example/app-framework/out/
.vscode/
tests/benchmark/compile_output/
================================================
FILE: .mocharc.json
================================================
{
"extension": ["ts"],
"loader": "ts-node/esm",
"spec": "tests/**/**.test.ts"
}
================================================
FILE: .prettierignore
================================================
runtime-library/*
tests/samples/*
tools/playground/server/assets/samples/*
fuzz/*
================================================
FILE: .prettierrc.json
================================================
{
"printWidth": 80,
"tabWidth": 4,
"useTabs": false,
"semi": true,
"singleQuote": true,
"quoteProps": "as-needed",
"trailingComma": "all",
"bracketSpacing": true,
"arrowParens": "always",
"requirePragma": false,
"insertPragma": false,
"proseWrap": "preserve",
"endOfLine": "lf",
"embeddedLanguageFormatting": "auto"
}
================================================
FILE: ATTRIBUTIONS.md
================================================
Wasmnizer-ts Attributions
======================================
Wasmnizer-ts project reused some components from other open source project:
- **WebAssembly Micro Runtime**: for building a runtime with WasmGC support
- **QuickJS**: for implementing libdyntype to manage dynamic objects
- **AssemblyScript**: use some declaration files for exposing C-APIs from binaryen.js
- **TypeScript**: use some scripts for project setup
- **Programming Language Benchmarks**: use some code snippets as benchmarks
- **The Benchmarks Game**: use some code snippets as benchmarks
## Licenses
### WebAssembly Micro Runtime
[LICENSE](./runtime-library/LICENSE) (Apache-2.0 WITH LLVM-exception)
### QuickJS
[LICENSE](https://github.com/bellard/quickjs/blob/master/LICENSE)
### AssemblyScript
[LICENSE](./src/backend/binaryen/glue/LICENSE) (Apache-2.0)
[NOTICE](./src/backend/binaryen/glue/NOTICE)
### TypeScript
[LICENSE](./scripts/LICENSE.txt) (Apache-2.0)
### Programming Language Benchmarks
[LICENSE](./tests/benchmark/MIT_LICENSE.txt) (MIT)
### The Benchmarks Game
[LICENSE](./tests/benchmark/BSD_LICENSE.txt) (3-Clause BSD)
## Contributors for initial version
- [xujuntwt95329](https://github.com/xujuntwt95329) - **Jun Xu**, <jun1.xu@intel.com> (Architect, Project champion)
- [coderebot](https://github.com/coderebot) - **Junjie Dong**, <dongjunjie@xiaomi.com> (Architect)
- [brucehuke](https://github.com/brucehuke) - **Ke Hu**, <huke@xiaomi.com>
- [LevelCA](https://github.com/LevelCA) - **Liangyu Zhang**, <zhangliangyu3@xiaomi.com>
- [lum1n0us](https://github.com/lum1n0us) - **Liang He**, <liang.he@intel.com>
- [penghuizhen347](https://github.com/penghuizhen347) - **Huizhen Peng**, <penghuizhen@xiaomi.com>
- [Shanks0224](https://github.com/Shanks0224) - **Jing Gan**, <ganjing@xiaomi.com>
- [shubulan](https://github.com/shubulan) - **Yulong Gao**, <gaoyulong@xiaomi.com>
- [WenLY1](https://github.com/WenLY1) - **LingYun Wen**, <wenlingyun1@xiaomi.com>
- [wenyongh](https://github.com/wenyongh) - **Wenyong Huang**, <wenyong.huang@intel.com>
- [xwang98](https://github.com/xwang98) - **Xin Wang**, <xin.wang@intel.com>
- [yviansu](https://github.com/yviansu) - **Yihan Su**, <yihan.su@intel.com>
- [zhenweijin](https://github.com/zhenweijin) - **Zhenwei Jin**, <zhenwei.jin@intel.com>
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
CommunityCodeOfConduct AT intel DOT com.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of
actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the
community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
================================================
FILE: CONTRIBUTING.md
================================================
# Contributing
### License
`Wasmnizer-ts` is licensed under the terms in [LICENSE](./LICENSE). By contributing to the project, you agree to the license and copyright terms therein and release your contribution under these terms.
### How to contribute
We welcome contributions to Wasmnizer-ts. You can:
- Log a bug or provide feedback with an [issue].
- Submit your changes directly with a [pull request].
### Pull requests
This project follows a simple workflow with contributions delivered as [pull requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) (PR) against the main branch.
To submit your change:
- Make sure your code is in line with our coding conventions by running `npm run lint` to format the
code.
- Create an [issue] describing the bug the PR fixes or the feature you intend to implement.
- Submit a [pull request] into the main branch.
Your PR will then be reviewed by one or more maintainers. Your PR will be automatically merged
(assuming no conflicts) with one approving review. Maintainers may suggest changes to a PR before
approving.
### Testing
#### Test compilation
This will compile our samples and check if the compiler exit normally, it doesn't guarantee the correctness of the generated wasm module.
``` bash
npm run test
```
#### Validate execution on WAMR
See [validate/wamr](./tools/validate/wamr/README.md) for how to validate results on WAMR
### Code Formatting
Code is required to be formatted with `npm run lint`.
### Sign your work
Please use the sign-off line at the end of the patch. Your signature certifies that you wrote the patch or otherwise have the right to pass it on as an open-source patch. The rules are pretty simple: if you can certify
the below (from [developercertificate.org](http://developercertificate.org/)):
```
Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
660 York Street, Suite 102,
San Francisco, CA 94110 USA
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
```
Then you just add a line to every git commit message:
Signed-off-by: Joe Smith <joe.smith@email.com>
Use your real name (sorry, no pseudonyms or anonymous contributions.)
If you set your `user.name` and `user.email` git configs, you can sign your
commit automatically with `git commit -s`.
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--- LLVM Exceptions to the Apache 2.0 License ----
As an exception, if, as a result of your compiling your source code, portions
of this Software are embedded into an Object form of such source code, you
may redistribute such embedded portions in such Object form without complying
with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
In addition, if you combine or link compiled forms of this Software with
software that is licensed under the GPLv2 ("Combined Software") and if a
court of competent jurisdiction determines that the patent provision (Section
3), the indemnity provision (Section 9) or other Section of the License
conflicts with the conditions of the GPLv2, you may retroactively and
prospectively choose to deem waived or otherwise exclude such Section(s) of
the License, but only in their entirety and only with respect to the Combined
Software.
================================================
FILE: README.md
================================================
<div align="center">
<h1><code>Wasmnizer-ts</code></h1>
<p>
<strong>Toolchain for compiling TypeScript to WasmGC</strong>
</p>
<p>
<a href="https://github.com/WebAssembly/gc"><img src="https://img.shields.io/badge/-WasmGC-brightgreen"></a>
</p>
</div>
## Overview
`Wasmnizer-ts` utilizes [WasmGC](https://github.com/WebAssembly/gc) to compile TypeScript source code into WebAssembly bytecode, and support dynamic type (such as any) through host APIs. The `Wasmnizer-ts` now supports a strict subset of TypeScript and continuously strives to accommodate more semantics.
There are three components in `Wasmnizer-ts`:
- `ts2wasm-compiler`: a compiler for compiling TypeScript source code into WasmGC bytecode.
- `ts2wasm-stdlib`: standard library implemented in ts source code, will be compiled with application together. See [standard library](./doc/standard-library/index.md).
- `ts2wasm-runtime-library`: runtime libraries for exposing host APIs required for running the generated wasm module, including:
1. `libdyntype`: support dynamic objects, see API spec [here](./doc/libdyntype_api_spec.md). We have proposed a [WASI proposal](https://github.com/WebAssembly/WASI/issues/552).
2. `libstruct-indirect`: access WasmGC struct fields through index calculated during runtime, see API spec [here](./doc/libstruct_indirect_api_spec.md). These APIs are used to emulate the behaviour of the [proposed struct.get/set_indirect opcode](https://github.com/WebAssembly/gc/issues/397).
3. `libstd`: standard library implemented in native, such as `console.log`, see [standard library](./doc/standard-library/index.md).
> **Note**: **This project is highly experimental and under active development, DO NOT use in production**
## Features
- **garbage collection**. `ts2wasm-compiler` leverage WebAssembly GC proposal, which can benefit from runtime's GC capability.
- **optimization**. `ts2wasm-compiler` uses binaryen as backend, which can benefit from binaryen's powerful optimization capabilities.
- **small footprint**. Data structures in source code is represented as WasmGC types, which avoids the requirement for `memory allocator` and `garbage collector` inside wasm module.
- **static compilation**. Type information in TypeScript source code is used to create static WasmGC types, which avoids the overhead of dynamic type checking.
- **dynamic typing**. `any` and other dynamic types in TypeScript source code are supported by host APIs.
## Execution environment
The wasm module generated by `ts2wasm-compiler` is designed to be executed in a WasmGC runtime environment. The runtime should provide the following capabilities:
- **WebAssembly proposals:**
- **[WasmGC](https://github.com/WebAssembly/gc) (mandatory)**: WasmGC proposal, which is a garbage collection mechanism for WebAssembly.
> Note: the GC opcode generated by binaryen is slightly different than [GC MVP](https://github.com/WebAssembly/gc/blob/main/proposals/gc/MVP.md), please see [here](https://docs.google.com/document/d/1DklC3qVuOdLHSXB5UXghM_syCh-4cMinQ50ICiXnK3Q/edit#heading=h.9dwoku9340md) for details.
- **[Exception handling](https://github.com/WebAssembly/exception-handling) (required by try-catch statements)**: exception handling proposal, which adds exception handling mechanism to WebAssembly.
- **[stringref](https://github.com/WebAssembly/stringref) (required by stringref feature)**: reference-typed strings proposal, provide a language independent string representation.
- **APIs:**
- **[libdyntype API](./doc/libdyntype_api_spec.md) (required by dynamic typing)**: APIs for supporting dynamic objects.
- **[libstruct-indirect API](./doc/libstruct_indirect_api_spec.md) (required by `interface` type)**: APIs for accessing WasmGC struct fields through index calculated during runtime.
- **libstd API (required by standard libraries)**: APIs for providing standard libraries from host environment.
`Wasmnizer-ts` currently implemented host APIs on multiple environments:
- [WebAssembly Micro Runtime (WAMR)](https://github.com/bytecodealliance/wasm-micro-runtime/tree/dev/gc_refactor): `libdyntype API`, `libstruct-indirect API` and `libstd API`
- chrome browser and nodejs (20.6.1+): part of `libdyntype API` implemented with JavaScript
Please see [feature list](./doc/developer-guide/feature_list.md) for supporting status of each feature.
Please goto [Getting Started](./doc/getting_started.md) for how to use the project and [Introduction](./doc/developer-guide/index.md) for more details.
## Contributing
We welcome contributions to Wasmnizer-ts. You can find more details in
[CONTRIBUTING.md](CONTRIBUTING.md) .
## License
`Wasmnizer-ts` uses the same license as LLVM: the Apache 2.0 license with the LLVM exception. See the [LICENSE](./LICENSE) file for details. Any contributions you make will be under the same license.
================================================
FILE: cli/options.json
================================================
{
"version": {
"category": "General",
"description": "Print the compiler's version.",
"alias": "v"
},
"help": {
"category": "General",
"description": "Print the help information of this compiler.",
"alias": "h"
},
"output": {
"category": "Output",
"description": "Generate the WebAssembly binary output file (.wasm).",
"alias": "o"
},
"wat": {
"category": "Output",
"description": "Generate the WebAssembly text output file (.wat).",
"default": false
},
"dumpast": {
"category": "Output",
"description": "Dump the AST Tree",
"default": false
},
"validate": {
"category": "Validation",
"description": "Validate the specified function of the generated wasm File using WAMR."
},
"baseDir": {
"category": "Output",
"description": "Specify base directory for storing output files.",
"default": "."
},
"opt": {
"category": "Compile",
"description": "Specify optimization level",
"default": 0
},
"debug": {
"category": "Compile",
"description": "Enable debug mode",
"default": true
},
"sourceMap": {
"category": "Compile",
"description": "Specify source map information",
"default": true
},
"enableException": {
"category": "Compile",
"description": "Enable exception feature",
"default": true
},
"enableStringRef": {
"category": "Compile",
"description": "Enable stringref to represent typescript string",
"default": true
},
"entry": {
"category": "Compile",
"description": "Specify the entry function, default is _entry",
"default": "_entry"
},
"startSection": {
"category": "Compile",
"description": "Whether to use start section to do initialization, default is false",
"default": false
},
"dumpSemanticTree": {
"category": "Debug",
"description": "dump semantic tree, default is false",
"default": false
}
}
================================================
FILE: cli/ts2wasm.ts
================================================
/*
* Copyright (C) 2023 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
import minimist from 'minimist';
import cp from 'child_process';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import { ParserContext } from '../src/frontend.js';
import log4js from 'log4js';
import { Logger, consoleLogger } from '../src/log.js';
import { Ts2wasmBackend } from '../src/backend/index.js';
import { WASMGen } from '../src/backend/binaryen/index.js';
import { default as logConfig } from '../config/log4js.js';
import { SyntaxError } from '../src/error.js';
import { DumpAST } from '../src/dump_ast.js';
import { ConfigMgr, setConfig } from '../config/config_mgr.js';
interface HelpMessageCategory {
General: string[];
Compile: string[];
Output: string[];
Validation: string[];
Other: string[];
}
function isRegularFile(filePath: string) {
fs.lstat(filePath, function (err, stats) {
if (stats.isSymbolicLink() || stats.nlink > 1) {
throw new Error(`${filePath} is not a regular file`);
}
});
}
function validateFilePath(filePath: string) {
if (!fs.existsSync(filePath)) {
throw new Error(`${filePath} not exist`);
}
isRegularFile(filePath);
}
function parseOptions() {
const dirname = path.dirname(fileURLToPath(import.meta.url));
const optionPath = path.join(dirname, '..', '..', 'cli', 'options.json');
validateFilePath(optionPath);
const helpFile = fs.readFileSync(optionPath, 'utf8');
const helpConfig = JSON.parse(helpFile);
return helpConfig;
}
function showVersion() {
const dirname = path.dirname(fileURLToPath(import.meta.url));
const packagePath = path.join(dirname, '..', '..', 'package.json');
validateFilePath(packagePath);
const packageFile = fs.readFileSync(packagePath, 'utf8');
const packageConfig = JSON.parse(packageFile);
const version = packageConfig.version;
console.log('Version ' + version);
process.exit(0);
}
function showHelp(helpConfig: any) {
const printOption = {
indent: 4,
padding: 28,
eol: '\n',
};
const categories: HelpMessageCategory = {
General: [],
Compile: [],
Output: [],
Validation: [],
Other: [],
};
Object.keys(helpConfig).forEach((commandKey) => {
const helpMessage: string[] = [];
const option = helpConfig[commandKey];
let comment = '';
while (comment.length < printOption.indent) {
comment += ' ';
}
comment += '--' + commandKey;
if (option.alias) {
comment += ', -' + option.alias;
}
while (comment.length < printOption.padding) {
comment += ' ';
}
comment += option.description;
helpMessage.push(comment);
if (option.category) {
const categoryKey = <keyof HelpMessageCategory>option.category;
categories[categoryKey].push(helpMessage[0]);
} else {
categories['Other'].push(helpMessage[0]);
}
});
const optionMessage: string[] = [];
Object.keys(categories).forEach((category) => {
const categoryKey = <keyof HelpMessageCategory>category;
optionMessage.push(
printOption.eol + ' ' + categoryKey + printOption.eol,
);
optionMessage.push(categories[categoryKey].join(printOption.eol));
});
optionMessage.join(printOption.eol);
const otherMessage = [
'EXAMPLES\n',
' ' + 'node' + ' build/cli/ts2wasm.js' + ' --help',
' ' +
'node' +
' build/cli/ts2wasm.js' +
' sample.ts' +
' --output' +
' sample.wasm',
' ' +
'node' +
' build/cli/ts2wasm.js' +
' sample.ts' +
' --output' +
' sample.wasm' +
' --wat',
' ' +
'node' +
' build/cli/ts2wasm.js' +
' sample.ts' +
' --output' +
' sample.wasm' +
' --validate' +
' functionName' +
' param1' +
' param2',
'\n',
'OPTIONS',
];
const outMessage = otherMessage.concat(optionMessage);
console.log(outMessage.join(printOption.eol));
process.exit(0);
}
export function writeFile(filename: string, contents: any, baseDir = '.') {
if (!contents) {
throw new Error('content is not valid');
}
const dirPath = path.normalize(
path.resolve(baseDir, path.dirname(filename)),
);
const filePath = path.normalize(
path.join(dirPath, path.basename(filename)),
);
fs.mkdirSync(dirPath, { recursive: true });
fs.writeFileSync(filePath, contents);
}
function getAbsolutePath(filename: string, baseDir = '') {
const dirPath = path.normalize(
path.resolve(baseDir, path.dirname(filename)),
);
const filePath = path.normalize(
path.join(dirPath, path.basename(filename)),
);
return filePath;
}
function validateByWAMR(cmdArgs: string[]) {
const dirname = path.dirname(fileURLToPath(import.meta.url));
const iwasm = path.join(dirname, 'iwasm_gc');
if (!fs.existsSync(iwasm)) {
throw new Error('iwasm_gc exec file not exist');
}
const result = cp.execFileSync(iwasm, cmdArgs).toString();
console.log('WebAssembly output is: ' + result);
}
function createBackend(args: any, parserCtx: ParserContext): Ts2wasmBackend {
return new WASMGen(parserCtx);
}
/** read configs from cli */
function readCfgFromCli(args: minimist.ParsedArgs) {
const cfgs: Partial<ConfigMgr> = {};
for (const key in args) {
// eslint-disable-next-line no-prototype-builtins
if (args.hasOwnProperty(key)) {
cfgs[key as keyof ConfigMgr] = args[key];
}
}
setConfig(cfgs);
}
function main() {
try {
const args = minimist(process.argv.slice(2));
const optionConfig = parseOptions();
const optionKey: string[] = [];
Object.keys(optionConfig).forEach((commandKey) => {
optionKey.push(commandKey);
if (optionConfig[commandKey].alias) {
optionKey.push(optionConfig[commandKey].alias);
}
});
Object.keys(args).forEach((arg) => {
if (arg !== '_' && optionKey.indexOf(arg) === -1) {
console.warn("WARNING: Unknown option '" + arg + "'");
}
});
readCfgFromCli(args);
if (args.help || args.h) {
showHelp(optionConfig);
}
if (args.version || args.v) {
showVersion();
}
const sourceFileList: string[] = [];
const params: string[] = [];
for (let i = 0; i < args._.length; i++) {
const arg = args._[i];
if (typeof arg === 'string' && fs.statSync(arg).isFile()) {
fs.accessSync(arg, fs.constants.R_OK);
sourceFileList.push(arg);
} else {
params.push(arg);
}
}
if (!sourceFileList.length) {
showHelp(optionConfig);
}
if (!sourceFileList.length) {
throw new Error('No ts file to be handled.');
}
if (args.dumpast) {
DumpAST(sourceFileList);
return;
}
/* Step1: Semantic checking, construct scope tree */
const parserCtx = new ParserContext();
parserCtx.parse(sourceFileList);
/* Step2: Backend codegen */
const backend = createBackend(args, parserCtx);
backend.codegen();
/* Step3: output */
/* Set up specified base directory */
const baseDir = path.normalize(args.baseDir || '.');
let generatedWasmFile = '';
if (args.output || args.o) {
if (args.output) {
generatedWasmFile = args.output;
}
if (args.o) {
generatedWasmFile = args.o;
}
if (!generatedWasmFile.endsWith('.wasm')) {
throw new Error('output must be a wasm file');
}
const options = {
name_prefix: generatedWasmFile.split('.')[0],
};
const output = backend.emitBinary(options);
writeFile(generatedWasmFile, output, baseDir);
console.log(
"The wasm file '" + generatedWasmFile + "' has been generated.",
);
if (args.sourceMap) {
const sourceMap = backend.emitSourceMap(options.name_prefix);
writeFile(
`${options.name_prefix}.wasm.map`,
sourceMap,
baseDir,
);
console.log(
`The source map file ${options.name_prefix}.wasm.map has been generated.`,
);
}
if (args.validate) {
const validateArgs: string[] = [
'-f',
args.validate,
getAbsolutePath(generatedWasmFile),
];
validateByWAMR(validateArgs.concat(params));
}
if (args.wat) {
let generatedWatFile = '';
if (generatedWasmFile.endsWith('.wasm')) {
generatedWatFile = generatedWasmFile.replace(
'.wasm',
'.wat',
);
} else {
generatedWatFile = generatedWasmFile.concat('.wat');
}
const output = backend.emitText();
writeFile(generatedWatFile, output, baseDir);
console.log(
"The wat file '" +
generatedWatFile +
"' has been generated.",
);
}
} else if (args.wat || args.validate) {
console.warn('WARNING: No wasm file specified.');
} else {
console.log(backend.emitText());
}
backend.dispose();
} catch (e) {
if (e instanceof SyntaxError) {
/* Syntax error are reported by frontend.ts */
console.log(e.message);
process.exit(1);
} else {
/* TODO: print line number in error message */
let errorMessage = (<Error>e).message.concat(
`\nError details is in '${logConfig.appenders.errorFile.filename}'`,
);
if (process.env.NODE_ENV !== 'production') {
errorMessage = errorMessage.concat(
`\nLog details is in '${logConfig.appenders.traceFile.filename}'`,
);
}
consoleLogger.error(errorMessage);
Logger.error(e);
log4js.shutdown(() => process.exit(1));
}
}
}
main();
================================================
FILE: config/config_mgr.ts
================================================
/*
* Copyright (C) 2023 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
export interface ConfigMgr {
opt: number;
debug: boolean;
sourceMap: boolean;
enableException: boolean;
enableStringRef: boolean;
entry: string;
startSection: boolean;
dumpSemanticTree: boolean;
}
const defaultConfig: ConfigMgr = {
opt: 0,
debug: false,
sourceMap: false,
enableException: false,
enableStringRef: true,
entry: '_entry',
startSection: false,
dumpSemanticTree: false,
};
let currentConfig: ConfigMgr = { ...defaultConfig };
export function setConfig(config: Partial<ConfigMgr>): void {
currentConfig = { ...currentConfig, ...config };
}
export function getConfig(): ConfigMgr {
return currentConfig;
}
================================================
FILE: config/log4js.ts
================================================
/*
* Copyright (C) 2023 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
import os from 'os';
import fs from 'fs';
import path from 'path';
const logDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ts2wasm-log-'));
const logConfig = {
appenders: {
console: {
type: 'console',
},
traceFile: {
type: 'file',
filename: `${path.join(logDir, 'trace.log')}`,
backups: 3,
},
errorFile: {
type: 'file',
filename: `${path.join(logDir, 'error.log')}`,
backups: 3,
},
filterFile: {
type: 'logLevelFilter',
level: 'ERROR',
appender: 'errorFile',
},
},
categories: {
default: {
appenders: ['traceFile', 'filterFile'],
level: 'trace',
},
production: {
appenders: ['filterFile'],
level: 'error',
},
console: {
appenders: ['console'],
level: 'error',
},
},
};
export default logConfig;
================================================
FILE: doc/additonal_sematic_check.md
================================================
# Additional Sematic Check
## Motivation
Due to the partially features of TypeScript and the current limitations of WebAssembly, the compiler has imposed some restrictions on the usage of TypeScript syntax. This doc records additional sematic checking information of the `Wasmnizer-ts`.
## Items
The following terms outline specific additional sematic checks.
| item | description |
| ------------------------------- | ------------------------------------------------------------ |
| nominal class | the operation between two nomial classes(different class name, or t the two classes do not have a subtyping relationship) |
| closure with default parameters | innter function or closure with default parameters |
| invoke any object | treat any type as an object and access its properties |
| array without a specified element type | declare `Array` without a typeargument, for exampe `new Array()` |
| void type value as variable, or as function argument | `const a: void = undefined` |
If those rules above are triggered, an error will be throwed, the details will be dump to the log file.
Note that the most of these terms are implemented in the `sematic_check` file except the check of `array without a specified element type`, because we lost the AST information when traversing `Expression`, it will be handled when parsing on sematic tree.
## Details
Here are some examples and details about additional sematic checking.
+ the format of error message
`[error type]: in [function name where the error occurred], error flag: xxx , message: xxx`
For example
``` shell
[closure with default parameters]: in [test|foo|bar], error flag: '2', message: 'inner function has default parameters'
```
this message shows that in function `test|foo|bar`, there occurs a inner function with defalut parameters error, its error flag is 2.
+ meaning of error flags
**\[0]: BinaryOperationOnNominalClass**
`Wasmnizer-ts` treats class type as nominal, because different named class types have distinct meanings and purposes. So operating on different types will not pass through the additional semantic checks.
For example:
```typescript
class Foo {
x: number;
constructor(xx: number) {
this.x = xx;
}
}
class Bar {
x: number;
constructor(xx: number) {
this.x = xx;
}
}
const f = new Foo(0);
const b: Bar = f; // not pass
```
**\[1]: ReturnTypesAreNominalClass**
The reason is the same as mentioned in `BinaryOperationOnNominalClass` above, here is an example:
```typescript
class Foo {
x: number;
constructor(xx: number) {
this.x = xx;
}
}
class Bar {
x: number;
constructor(xx: number) {
this.x = xx;
}
}
export function baz(): Bar {
return new Foo(0); // not pass
}
```
**\[2]: ArgsAndParamsTypesAreNominalClass**
The reason is the same as mentioned in `BinaryOperationOnNominalClass` above, here is an example:
```typescript
class Foo {
x: number;
constructor(xx: number) {
this.x = xx;
}
}
class Bar {
x: number;
constructor(xx: number) {
this.x = xx;
}
}
export function baz(f: Foo) {
// ...
}
baz(new Bar());
```
**\[3]: ClosureOrInnerFuncHasDefaultParams**
Currently in `Wasmnizer-ts`, only top-level functions are allowed to have default parameters. so inner function or closure with default parameters will not pass the checks.
```typescript
function foo() {
// inner function 'bar' has default parameters, so it won't pass the check.
function bar(x = 10) {
//
}
}
```
**\[4]: InvokeAnyObject**
`Wasmnizer-ts` provides the capability to work with dynamic types, but it imposes restrictions on accessing properties of dynamic types and assigning them to static types. For exmaple:
```typescript
class Foo {
x: number;
constructor(xx: number) {
this.x = xx;
}
}
const f: any = new Foo(0);
const x: number = f.x; // not pass
```
it requires type casting if want to access the property of dynamic types and assign it to static types:
```typescript
// ...
const x: number = f.x as number; // passed
```
**\[5]: VoidTypeAsVarType**
`Wasmnizer-ts` does not yet support 'void' as a variable type, so using 'void' as a variable type will not pass the check:
```typescript
const v: void = undefined; // not pass
function foo(v: void) { // not pass
// ...
}
```
**array without a specified element type**
```typescript
const arr: number[] = new Array(); // not pass
const arr = new Array(); // passed, `arr` has type any[]
const arr: number[] = new Array<number>(); // passed
const arr = new Array<number>(); // passed, `arr` has type number[]
```
================================================
FILE: doc/architecture.md
================================================

================================================
FILE: doc/dev_environment.md
================================================
# ts2wasm development environment
A VSCode dev-container is available for this project.
### Enter the container
After openning the project using VSCode, click the Green area at the left-bottom corner and select "reopen in container", it may take some time to build the docker image at the first time.
### Update the container
If any modification is made to the files under `.devcontainer`, then press `crtl + shift + P` to call out the command palette, search and select `Remote-Containers: Rebuild Container`
### User in the container
There is a non-root user named `vscode`, it is mapped to the first non-root user in host system, and this user has been enabled to use `sudo` without password
> Note: if you want to use apt to install other softwares, you may get a timeout error if you are behind a proxy. This is because the sudo environment will clear all the environment variables including the proxy related ones. To solve this problem, simply add one line to `/etc/sudoers` **inside the container** `Defaults env_keep+="http_proxy ftp_proxy all_proxy https_proxy no_proxy"`
> ``` bash
> vscode@ts2wasm-dev:/ts2wasm$ sudo cat /etc/sudoers
> #
> # This file MUST be edited with the 'visudo' command as root.
> #
> # Please consider adding local content in /etc/sudoers.d/ instead of
> # directly modifying this file.
> #
> # See the man page for details on how to write a sudoers file.
> #
> Defaults env_reset
> Defaults mail_badpass
> Defaults env_keep+="http_proxy ftp_proxy all_proxy https_proxy no_proxy" # Add this line
> Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
> ```
================================================
FILE: doc/developer-guide/any_object.md
================================================
# Any-objects
If the type of a variable is not decided, you can use `any` as the type annotation, and this variable will be treated as a pure JavaScript object.
``` TypeScript
let obj: any = { x: 1 };
```
You can later assign other types to this variable, or add new fields to it.
``` TypeScript
obj = 1;
obj = "string";
obj = true;
obj = { x: 1, y: 2 };
obj.z = 3;
```
> Note: any-objects works with low performance, it is always recommended to use statically typed variables whenever possible.
## boundary between static and dynamic world
Since any-objects are managed by external environment, there is a boundary between static and dynamic world. Assigning a static variable to an `any-object` requires a boxing operation, while the reverse operation necessitates an unboxing process.
### box to any
``` TypeScript
let static_number = 123;
let static_object = { x: 1 };
let any_number: any = static_number; // box by value
let any_object: any = static_object; // box by ref
```
box to any follow these rules:
1. primitive types (`number`, `boolean`, `string`) are boxed by value, the value of these variables are copied to external world, and further modification on these boxed any-objects will not affect the original value.
2. other types are boxed by reference. The external world will hold a reference to the original object, and modification on these boxed any-objects will be visible to the static world if the operated field exists in static world.
``` TypeScript
let static_object = { x: 1 };
let any_object: any = static_object; // box by ref
any_object.x = 2; // modify property
console.log(static_object.x); // 2
console.log(any_object.x); // 2
```
### mixed type
if new properties are added to these boxed any-objects, the newly added properties are managed by the external world, and not visible to the static world, these any-objects are called `mixed type` because they have both static and dynamic part.
``` TypeScript
let static_object = { x: 1 };
let any_object: any = static_object; // box by ref
any_object.y = 2; // add new property
console.log(static_object.y); // compile error
console.log(any_object.y); // 2
```
### unbox from any
bring any-objects back to static world is called unboxing, in TypeScript this kind of operation will cause type unsoundness because the compiler will not apply type checking for any-objects involved assignment.
In ts2wasm-compiler, additional instructions will be generated to do runtime type checking for these operations, and throw runtime error if the type is not matched.
``` TypeScript
class A {
x: number = 1;
}
class B {
x: number = 1;
y = 1;
}
let any_number: any = 123;
let any_string : any = 'Hello';
let any_object: any = { x: 1 };
let any_object2: any = new A();
let static_number: number = any_number; // OK
static_number = any_string; // runtime error
let static_object: A = any_object; // runtime error
static_object = any_object2; // OK
let static_object2: B = any_object2; // runtime error
```
unbox any follow these rules:
1. primitive types (`number`, `boolean`, `string`) can be unboxed as long as their actual types are matched with the static ones.
2. other types can only be unboxed if they are previously boxed from the same static type, it is not possible to unbox a dynamic object to static world.
## Any-objects involved operations
ts2wasm-compiler doesn't define operation between any-objects, when any-objects are involved in operations, the compiler will auto unbox them to static primitive values, and then perform the operation in static world.

``` TypeScript
let any_number: any = 123;
let any_string : any = 'Hello';
let any_object: any = { x: 1 };
let any_object2: any = new A();
let static_number: number = any_number + 1; // OK, any_number is unboxed to number
static_number = any_number + any_number; // OK, any_number is unboxed to number
static_number = any_string + 1; // runtime error, unbox any_string to number failed
let static_object: A = any_object + any_object2; // runtime error, any_object and any_object2 are not primitive types
```
================================================
FILE: doc/developer-guide/basic_concepts.md
================================================
# Basic concepts
## Types in TypeScript
In TypeScript, every variable is associated with a type annotation, these annotations can be divided into two categories:
1. `typed`
This kind of annotation contains the type information for the corresponding variables, it can be subdivided into the following categories:
1. `fully typed`
Provide sufficient type information for static compilation, the memory layout can be decided by the compiler. E.g. `number`, `string` and `class` are treated as this category.
2. `incompletely typed`
Provide limited information about the type, but these information is not enough for defining the memory layout at compile time. E.g. `interface` defines least required fields of the type, but the field layout is not defined; `union` defines the possible types of a variable, but we can't know what it will be during compilation.
2. `any`
`any` is a pure JavaScript dynamic object, compiler have no information about `any-objects` (any-typed objects)

As shown in the graph above, the fundamental processing principles for different type categories in ts2wasm-compiler following these rules:
- `fully typed`: statically compiled and represented as Wasm value types or WasmGC types
- `any`: represented as `externref`, and any operation on the `any-objects` will be compiled as invoking pre-defined APIs, which means the dynamic objects are managed by external environment.
- `incompletely typed`: each specific type requires individual analysis based on the particular circumstances, e.g.:
- `union` is actually a dynamic type because the type can change during runtime, so it's treated as `any`
- `user defined interface` is widely used in TypeScript, treating it as dynamic will largely influence the performance, so we introduced `meta` to apply static compilation
- `builtin objects` are objects provided by JavaScript runtime, TypeScript defines them as interface for type checking purpose.
- Implementing these built-in objects demands a significant amount of effort, so we treat them as `any` by default, this allows us to immediately use the standard library implementation already available in external environment. (see [fallback](./fallback.md))
- Simultaneously, we are working on static compilation solutions for selected built-in objects (e.g. `String`, `Array`) to improve performance. The priority of static compilation for these objects is determined based on their actual usage frequency.
## Type system overview
Ts2wasm compiler treats TypeScript as a mixed typed language, there are static types such as `Class`, `Primitives`, as well as dynamic types such as `any` and `union`, the developers should be aware that different types will have different performance impact, it is always recommended to reduce the usage of dynamic types.
| ts type | category | wasm type | access strategy | performance overhead |
| :----: | :----: | :----: | :----: | :----: |
| boolean | fully typed | i32 | static | low |
| number | fully typed |f64 | static | low |
| string | fully typed |struct / stringref | static | low |
| class | fully typed |struct | static | low |
| function | fully typed |func | static | low |
| interface | incompletely typed |struct | static + reflection | medium |
| union | incompletely typed |externref | dynamic | high |
| any | any |externref | dynamic | high |
================================================
FILE: doc/developer-guide/class.md
================================================
# Class
Classes are declared using the `class` keyword
## Class fields
``` TypeScript
class Car {
price: number = 0; // field with initializer
color: string; // field without initializer, must be initialized in constructor
private owner: string; // field with visibility modifier
readonly producer: string; // field with readonly modifier
static isCar: boolean = true; // static field
isNew? : boolean; // optional field
method: (x: number) => number; // field with function type
constructor(color: string) { // constructor
this.color = color;
this.owner = "B";
this.producer = "C";
this.isNew = true;
this.method = (x: number) => x + 1;
}
}
```
## Class method
``` TypeScript
class Car {
private speed_: number = 0;
mileage = 0;
// method with visibility modifier
public drive(second: number) {
this.mileage += this.speed_ * second;
}
// static method
static isCar() {
return true;
}
// getter
get speed() {
return this.speed_;
}
// setter
set speed(sp: number){
this.speed_ = sp;
}
}
```
## Inheritance
``` TypeScript
class Car {
price: number = 0;
color: string;
constructor(color: string) {
this.color = color;
}
drive() {
console.log("drive");
}
}
class Bus extends Car {
height: number;
constructor(color: string, height: number) {
super(color);
this.height = height;
}
drive() {
console.log("bus drive");
super.drive();
}
}
```
## Instantiate class
``` TypeScript
let car = new Car("red");
```
derived class can be assigned to base class
``` TypeScript
let bus: Car = new Bus("blue", 10);
```
## Capture `this`
Functions defined inside non-static method can capture `this`
``` TypeScript
class A {
n: number = 10;
say(){
let anonymousFunc = () => console.log(this.n);
return anonymousFunc;
}
}
let a = new A();
a.say()(); // 10
```
## Limitations
- ##### declare field in constructor parameter list is **not supported**
``` TypeScript
class Car {
// Not Supported
constructor(private owner: string) { // field in constructor parameter list
}
}
```
- ##### Assign a function to a class method is **not supported**
``` TypeScript
let car = new Car();
// Not Supported
car.drive = (second: number) => { }
```
- ##### Class method with `this` parameter is **not supported**
``` TypeScript
class Car {
// Not Supported
drive(this: Car, second: number) { }
}
```
- ##### Use class as value is **not supported**
``` TypeScript
// Not Supported
let car = Car;
```
- ##### Index signatures for class is **not supported**
``` TypeScript
class MyClass {
// Not Supported
[s: string]: boolean | ((s: string) => boolean);
check(s: string) {
return this[s] as boolean;
}
}
```
- ##### Assign to different class with same structure is **not supported by design**
In ts2wasm-compiler, classes are treated as **nominal typing**. This is because class names represent abstractions of real-world entities, and defining class relationships based on structure rather than names can introduce error-prone code.
``` TypeScript
class Person {
name: string = '';
age: number = 0;
}
class Employee {
name: string = '';
age: number = 0;
salary: number = 0;
}
class Employee1 extends Person {
salary: number = 0;
}
// Not Supported
const p: Person = new Employee();
// OK
const p1: Person = new Employee1();
```
================================================
FILE: doc/developer-guide/expose_host_API.md
================================================
# ts2wasm-compiler host API mechanism
ts2wasm-compiler allows developer to expose their own native APIs to the application.
## Host implemented functions
The `declare` keyword in TypeScript is used to declare a host function. When a function is marked as `declare`, ts2wasm-compiler will generate a wasm import entry into the final wasm module
``` TypeScript
declare function native_func(x: number, msg: string): number;
```
This will generate:
``` wat
(import "env" "native_func" (func $test|native_func-declare (type $f64_ref?|$string_type|_=>_f64) (param f64 (ref null $string_type)) (result f64)))
```
In the native world, the developer should implement the native API like this:
``` C
double native_func_wrapper(wasm_exec_env_t exec_env, double x, wasm_struct_obj_t msg) {
/* ... */
}
```
And then register this API to runtime:
``` C
REG_NATIVE_FUNC(native_func, "(Fr)F"),
```
> Please refer to [WAMR export_native_api guide](https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/export_native_api.md) for more details.
> Please refer to [WAMR GC API](https://github.com/bytecodealliance/wasm-micro-runtime/blob/dev/gc_refactor/core/iwasm/include/gc_export.h) to learn how to access the GC objects from native.
## Host implemented class
It's also possible to declare a whole class to be host implemented:
``` TypeScript
declare class DeclaredClass {
grade: number;
constructor(grade: number);
sayHello(): void;
static whoSayHi(name: string): number;
get value(): any;
set value(v: number);
}
```
This will generate:
``` wat
(import "env" "DeclaredClass_constructor" (func $test|DeclaredClass|constructor-declare (type $ref?|{}|_f64_=>_ref?|$cls-struct5|) (param (ref null ${}) f64) (result (ref null $cls-struct5))))
(import "env" "DeclaredClass_sayHello" (func $test|DeclaredClass|sayHello-declare (type $function0) (param (ref null ${}))))
(import "env" "DeclaredClass_@whoSayHi" (func $test|DeclaredClass|@whoSayHi-declare (type $ref?|$string_type|_=>_f64) (param (ref null $string_type)) (result f64)))
(import "env" "DeclaredClass_get_value" (func $test|DeclaredClass|get_value-declare (type $ref?|{}|_=>_anyref) (param (ref null ${})) (result anyref)))
(import "env" "DeclaredClass_set_value" (func $test|DeclaredClass|set_value-declare (type $ref?|{}|_anyref_=>_none) (param (ref null ${}) anyref)))
```
The native implementation is similar to function, but remember that instance methods' first parameter should be `this` which pointing to the class instance.
> Refer to [lib_console](../../runtime-library/stdlib/lib_console.c) as an example.
### Destructor
When creating a class instance provided by host, the lifecycle should also be managed by native. WAMR provide a `wasm_obj_set_gc_finalizer` for setting a custom finalizer function on a certain object, so the developer can set a finalizer in the constructor API, then the native resource can be freed once the corresponding wasm object is claimed.
## Naming convention
It is important to use a correct name when registering host APIs, assume the function name in ts source code is denoted as `$func`, and class name is denoted as `$cls`, then the host API should follow this naming convention:
| category | import name |
| :----: | :----: |
| function | `$func` |
| class constructor | `$cls`_constructor |
| instance method | `$cls`_`$func` |
| static method | `$cls`_@`$func` |
| getter | `$cls`\_get_`$func` |
| setter | `$cls`\_set_`$func` |
> Currently the import module name is always `env`, customizable module name is not supported yet because there are no existing TypeScript syntax to describe this. We may introduce some configuration entries to support this later.
================================================
FILE: doc/developer-guide/fallback.md
================================================
# ts2wasm-compiler fallback mechanism
The strategy of ts2wasm-compiler is to apply static compilation as much as possible, but there are circumstances where statization is not available, including:
1. The effort to implement static compilation for some object is relatively large, which isn't on high priority (e.g. `Map`, `Set`).
2. Accessing efficiency of some object is not critical to the application's overall performance (e.g. `Date`, `JSON`).
In this case, ts2wasm-compiler supports a `fallback` mechanism
- for scenario 1, this serves as a temporary workaround before the statical support is ready.
- for scenario 2, this will be a formal solution to bridge common used JavaScript builtin method to TypeScript application.
## Example
``` TypeScript
export function JSONTest() {
let json = '{"result":true, "count":42}';
// The JSON.parse and JSON.stringify are implemented by JS runtime
let obj = JSON.parse(json);
let str: string = JSON.stringify(obj) as string;
console.log(obj.count);
console.log(str);
}
```
## Fallback whitelist
- JSON object and all methods
- Map constructor and all methods
- Set constructor and all methods
- Date constructor and all methods
- Promise constructor, object and all methods
> Note: The list of objects allowed to be fallbacked is restricted by the compiler to reduce test pressure, please contact the developer team if you need more fallback objects
================================================
FILE: doc/developer-guide/feature_list.md
================================================
# Wasmnizer-ts feature list
Table column definition:
- `feature`
TypeScript keyword/type/syntax/concepts
- `WAMR`
Whether this feature is supported on [WebAssembly Micro Runtime (WAMR)](https://github.com/bytecodealliance/wasm-micro-runtime)
- `chrome`
Whether this feature is supported on chrome browser
- `popularity`
The frequency of the feature used in TypeScript.
- empty means less used, or not evaluated
- :star: means frequently used by experienced TypeScript developers
- :star::star: means frequently used by both experienced and begging TypeScript developers
## Primitives
| feature | WAMR | chrome | popularity |
| :---: | :---: | :---: | :---: |
| boolean | :heavy_check_mark: | :heavy_check_mark: | :star::star: |
| number | :heavy_check_mark: | :heavy_check_mark: | :star::star: |
| string | :heavy_check_mark: | :heavy_check_mark: | :star::star: |
| string template | :heavy_check_mark: | :heavy_check_mark: | :star::star: |
| bigint | :x: | :x: | |
| symbol | :x: | :x: | |
## [Class](./class.md)
| feature | WAMR | chrome | popularity |
| :---: | :---: | :---: | :---: |
| declaration | :heavy_check_mark: | :heavy_check_mark: | :star::star: |
| inherit | :heavy_check_mark: | :heavy_check_mark: | :star::star: |
| method overwrite | :heavy_check_mark: | :heavy_check_mark: | :star::star: |
| static field/method | :heavy_check_mark: | :heavy_check_mark: | :star::star: |
| field initializer | :heavy_check_mark: | :heavy_check_mark: | :star::star: |
| visibility control | :heavy_check_mark: | :heavy_check_mark: | :star::star: |
| getter/setter | :heavy_check_mark: | :heavy_check_mark: |
| [class as value](./class.md#use-class-as-value-is-not-supported) | :x: | :x: |
## [Function](./function.md)
| feature | WAMR | chrome | popularity |
| :---: | :---: | :---: | :---: |
| closure | :heavy_check_mark: | :heavy_check_mark: | :star::star: |
| optional parameter | :heavy_check_mark: | :heavy_check_mark: | :star::star: |
| function default parameter | :heavy_check_mark: | :heavy_check_mark: | :star::star: |
| method default parameter | :heavy_check_mark: | :heavy_check_mark: | :star::star: |
| closure default parameter | :x: | :x: | |
| destructor parameter | :x: | :x: | :star::star: |
| rest parameter | :heavy_check_mark: | :heavy_check_mark: | :star: |
| this binding | :x: | :x: | :star: |
| overload | :x: | :x: | :star: |
## [Interface](./interface.md)
| feature | WAMR | chrome | popularity |
| :---: | :---: | :---: | :---: |
| explicitly implemented interface | :heavy_check_mark: | :heavy_check_mark: | :star::star: |
| implicitly implemented interface | :heavy_check_mark: | :x: | :star::star: |
| readonly fields | :heavy_check_mark: | :x: | |
| function signature | :x: | :x: | |
| indexed signature | :x: | :x: | |
## Enum
| feature | WAMR | chrome | popularity |
| :---: | :---: | :---: | :---: |
| numeric enum | :heavy_check_mark: | :heavy_check_mark: | :star::star: |
| string enum | :heavy_check_mark: | :heavy_check_mark: | :star::star: |
| heterogeneous enum | :x: | :x: | |
## [Built-in objects/method](../standard-library/index.md)
| feature | WAMR | chrome | popularity | note |
| :---: | :---: | :---: | :---: | :---: |
| [console](../standard-library/console.md) | :heavy_check_mark: | :x: | :star::star: | only support `log` |
| Object | :x: | :x: | :star: | |
| Function | :x: | :x: | | |
| JSON | :heavy_check_mark: | :x: | :star::star: | [fallback to dynamic](./fallback.md) |
| Date | :heavy_check_mark: | :x: | :star::star: | [fallback to dynamic](./fallback.md) |
| [Math](../standard-library/math.md) | :heavy_check_mark: | :heavy_check_mark: | :star::star: | only support `pow`, `max`, `min`, `sqrt`, `abs`, `ceil`, `floor` |
| Number | :x: | :x: | :star::star: | |
| [String](../standard-library/string.md) | :heavy_check_mark: | :heavy_check_mark: | :star::star: | |
| [Array](../standard-library/array.md) | :heavy_check_mark: | :x: | :star::star: | |
| Map | :heavy_check_mark: | :x: | :star::star: | [fallback to dynamic](./fallback.md) |
| Set | :heavy_check_mark: | :x: | :star: | [fallback to dynamic](./fallback.md) |
| ArrayBuffer | :x: | :x: | :star: | |
| RegExp | :x: | :x: | :star: | |
| ... others | :x: | :x: | | |
## Wasm runtime capabilities
| feature | WAMR | chrome | popularity | note |
| :---: | :---: | :---: | :---: | :---: |
| exception handling | :x: | :heavy_check_mark: | :star::star: | |
| promise | :heavy_check_mark: | :x: | :star::star: | [fallback to dynamic](./fallback.md) |
| source debugging | :x: | :heavy_check_mark: | :star::star: | |
| AoT compilation | :x: | :x: | | |
| async/await | :x: | :x: | :star::star: | |
| import host API | :heavy_check_mark: | :heavy_check_mark: | | [import host API](./expose_host_API.md) |
## [Dynamics](./any_object.md)
| feature | WAMR | chrome | popularity | note |
| :---: | :---: | :---: | :---: | :---: |
| any | :heavy_check_mark: | :heavy_check_mark: | :star: | |
| unknown | :x: | :x: | | |
| never | :x: | :x: | | |
| assign static to any | :heavy_check_mark: | :heavy_check_mark: | | |
| assign any to static | :heavy_check_mark: | :heavy_check_mark: | | |
| property access | :heavy_check_mark: | :heavy_check_mark: | :star::star: | |
| prototype | :heavy_check_mark: | :heavy_check_mark: | :star: | |
| comparison | :heavy_check_mark: | :x: | :star: | |
| arithmetic operation | :heavy_check_mark: | :heavy_check_mark: | :star::star: | only support `number` and `string` |
| mixed type | :heavy_check_mark: | :x: | | Box static object to any and add new property on it |
| dynamic function | :x: | :x: | | |
| eval | :x: | :x: | | |
## Type casting
| feature | WAMR | chrome | popularity | note |
| :---: | :---: | :---: | :---: | :---: |
| static to static | :heavy_check_mark: | :heavy_check_mark: | | static type checking |
| static to dynamic | :heavy_check_mark: | :heavy_check_mark: | |always success |
| dynamic to static | :heavy_check_mark: | :heavy_check_mark: | |runtime type checking |
| dynamic to dynamic | :heavy_check_mark: | :heavy_check_mark: | | no check |
## Misc
| feature | WAMR | chrome | popularity | note |
| :---: | :---: | :---: | :---: | :---: |
| typeof | :heavy_check_mark: | :x: | :star: | |
| instanceof | :heavy_check_mark: | :heavy_check_mark: | :star: | |
| toString | :heavy_check_mark: | :x: | :star::star: | |
| for ... of | :heavy_check_mark: | :heavy_check_mark: | :star::star: | |
| for ... in | :x: | :x: | :star::star: | |
| generic | :x: | :x: | | |
| module (static import) | :heavy_check_mark: | :heavy_check_mark: | :star::star: | |
| module (dynamic import) | :x: | :x: | | |
================================================
FILE: doc/developer-guide/function.md
================================================
# Function and closure
## Declaration
There are three kind of syntax to define a function:
1. Function declaration syntax
``` TypeScript
function add(x: number, y: number): number {
return x + y;
}
```
- if this is in global scope
- This defines a function with name `add`, and it can be directly called through the name `add`.
- if this is inside another function scope
- This defines a function with a mangled name which can not be directly invoked, the compiler will implicitly create a closure with the given name `add` in the outer scope,
2. Function expression syntax
``` TypeScript
let add = function(x: number, y: number): number {
return x + y;
}
```
> This defines an anonymous function, and assigned to variable `add` as a `closure`
3. Arrow function syntax
``` TypeScript
let add = (x: number, y: number): number => {
return x + y;
}
let add1 = (x: number, y: number): number => x + y;
```
> This defines two anonymous functions, and assigned to variable `add` and `add1` as `closure`
## Parameters
### Optional parameter
``` TypeScript
function add(x: number, y: number, z?: number): number {
if (z) {
// type narrowing not supported, currently must explicitly cast the type
let z_value: number = z;
return x + y + z_value;
} else {
return x + y;
}
}
```
### Default parameter
``` TypeScript
function add(x: number, y: number, z: number = 0): number {
return x + y + z;
}
```
> Note: Default parameter is not supported in `class static method` and `closure`
### Rest parameter
``` TypeScript
function add(x: number, y: number, ...z: number[]): number {
let sum = x + y;
for (let i = 0; i < z.length; i++) {
sum += z[i];
}
return sum;
}
```
## Function type and type alias
``` TypeScript
type Add = (x: number, y: number) => number;
let add: (x: number, y: number) => number = function(x: number, y: number): number {
return x + y;
}
let add1: Add = function(x: number, y: number): number {
return x + y;
}
```
# Limitations
- Function overload is **not supported**
``` TypeScript
function add(x: number, y: number): number;
function add(x: string, y: string): string;
function add(x: any, y: any): any {
return x + y;
}
```
================================================
FILE: doc/developer-guide/generic.md
================================================
# Generic Type Process
## Generic Types
At present, the processing of generic types mainly focuses on generic functions and generic classes.
### generic function
```
function genericFunc<T>(param: T): T {
return param;
}
export function numberFunc() {
console.log(genericFunc(100));
}
```
### generic class
```
class GenericClass<X> {
x: X;
constructor(x: X) {
this.x = x;
}
echo(param: X) {
return param;
}
}
const a = new GenericClass('string');
console.log(a.echo('hello world'));
```
## Type Process
This compiler will perform multiple scans during the `syntax` processing stage, the processing of types runs through these scans.
After the `syntax` processing stage, basic types (such as ***number***, ***string***) will be passed directly to the next processing stage; complex types (such as ***class***, ***function***) will generate `Scope`s (such as ***ClassScope***, ***FunctionScope***) for processing in the `semantic` processing stage.
The creation of each `Scope` relies on the corresponding ***DeclarationNode*** in AST tree. Take the following case as an example to explain how the compiler processes generic types.
- - -
```
// example.ts
function genericFunc<T>(param: T): T {
return param;
}
class GenericClass<X> {
x: X;
constructor(x: X) {
this.x = x;
}
echo(param: X) {
return param;
}
}
const ret = genericFunc(100);
console.log(ret);
const a = new GenericClass('string');
const echoWord = a.echo('hello world');
console.log(echoWord);
```
- - -
### Scope Scan
Starting from the root node of the syntax tree, traverse the entire AST:
- when a ***SourceFile*** node is scanned, a `GlobalScope` is created
- when a ***ClassDeclaration*** node is scanned, a `ClassScope` is created
- when a ***FunctionDeclaration*** node is scanned, a `FunctionScope` is created
After this scan, the compiler will create a scope tree with `GlobalScope` as the root for each ts source file to organize the file content.
<div align=center>
<img src="./img/scope_tree.png"/>
</div>
- - -
### Type Scan
In this scanning phase, the compiler mainly processes the following nodes in the AST:
- **VariableDeclarationNode**: create a type based on the initialization expression of the variable
- **Parameter**: create a type based on the type information of the parameter
- **ClassDeclarationNode**: create a `TSClass` type
- **InterfaceDeclarationNode**: create a `TSInterface` type
- **FunctionDeclarationNode**: create a `TSFunction` type
After creating a new type, the type information will be stored in parent scope's ***namedTypeMap***.
<div align=center>
<img src="./img/type_scan.png"/>
</div>
- - -
### Variable scan
In the variable scan phase, the compiler will analyze and process the ***VariableDeclarationNode*** and ***Parameter*** starting from the root of the AST. At this time, the specialization of generic types may be performed.
- - -
#### Specialization of Generic Function
When processing the global variable `const ret = genericFunc(100);`, the specialization of the generic function will be performed.
```
The time for specializing a generic function is when the function is called.
```
Specialization of generic functions mainly performs the following two operations:
- generate a new `TSFunction` type based on the type arguments and the generic `TSFunction` type
- generate a new `FunctionScope` based on the type arguments and the generic `FunctionScope`
<div align=center>
<img src="./img/generic_function_specialization.png"/>
</div>
The parameters and local variables in the new `FunctionScope` will not be processed at this time. We will process them uniformly when processing statements.
- - -
#### Specialization of Generic Class
When processing the global variable `const a = new GenericClass('string');`, the specialization of the generic class will be performed.
```
The time for specializing a generic class is when creating an class instance.
```
Specialization of generic classes mainly performs the following two operations:
- generate a new `TSClass` type based on the type arguments and the generic `TSClass` type
- generate a new `ClassScope` based on the type arguments and the generic `ClassScope`
<div align=center>
<img src="./img/generic_class_specialization.png"/>
</div>
- - -
### Statement Scan
In this scanning phase, the compiler generates the statements in `FunctionScope` based on the content of **FunctionDeclarationNode**.
<div align=center>
<img src="./img/statement_scan.png"/>
</div>
- - -
Since the specialized function does not have a corresponding **FunctionDeclarationNode** on the AST tree, the generation of its statements relies on the generic `FunctionScope`:
- generate a specialized **ParameterArray** based on **ParameterArray** and type arguments of generic `FunctionScope`
- generate a specialized **VariableArray**(such as ***context***, ***this***) based on **VariableArray** and type arguments of generic `FunctionScope`
- generate new statements based on the **StatementArray** and type arguments of the generic `FunctionScope`. When processing a VariableStatement, after specializing this statement, add the local variable represented by the statement to **VariableArray**.
<div align=center>
<img src="./img/specialized_statement_gen.png"/>
</div>
- - -
### specialized type generation
After these scanning phases, the specialization of a generic type is completed.
================================================
FILE: doc/developer-guide/import_export.md
================================================
# import and export
In ts2wasm-compiler, every file can import/export element from/to other files. The dependencies are resolved at compile time, any missing dependency will cause a compile error.
If no error occurs during dependency resolving, the compiler will generate a **single wasm module** for all the files.
Dynamic import is not possible yet.
## export function
``` TypeScript
export function add(x: number, y: number): number {
return x + y;
}
```
## export class
``` TypeScript
export class A {
x: number = 1;
y: number = 2;
}
```
## export variable
``` TypeScript
export let x: number = 1;
```
## default export
``` TypeScript
export default function add(x: number, y: number): number {
return x + y;
}
```
## export alias
``` TypeScript
export { add as add1, A, x };
```
## re-export
``` TypeScript
export { add as add1, A, x } from "./export";
```
> Note: re-export all is not supported
## import
``` TypeScript
import { add, A, x } from "./export";
```
## import all
``` TypeScript
import * as exp from "./export";
```
## import alias
``` TypeScript
import { add as add1, A, x } from "./export";
```
## import default
``` TypeScript
import def from "./export";
```
================================================
FILE: doc/developer-guide/index.md
================================================
# Wasmnizer-ts developer guide
TypeScript is a typed superset of JavaScript, its rich type information has been employed by numerous tools to facilitate tasks such as refactoring and linting. However, TypeScript code must be transpiled into pure JavaScript before execution, resulting in the loss of all type information.
The ts2wasm compiler works like a backend to the TypeScript Compiler (tsc), it utilize the power of WebAssembly Garbage Collection proposal (WasmGC) to perform static compilation wherever possible. It also provides some escape hatches to accommodate dynamic types. The ts2wasm-compiler now supports a strict subset of TypeScript and continuously strives to accommodate more semantics.
This document serves as an overview of the supported language features and highlights certain known limitations.
## Suggestions for reading
1. read [basic concepts](./basic_concepts.md) to understand the fundamental design principal of ts2wasm.
2. go through [feature list](./feature_list.md) to understand the supported language features.
3. jump to the detail through the link of specific feature in [feature list](./feature_list.md) if you are interested.
## Supported features
Please refer to [feature list](./feature_list.md)
It's hard to enumerate every detailed syntax in the list, please refer to our [test cases](../../tests/samples/) for more samples.
================================================
FILE: doc/developer-guide/interface.md
================================================
# interface
## Interface declaration
``` TypeScript
interface I {
x: number;
readonly z: string; // field with readonly modifier
foo: () => number; // method
set m(v: number); // setter
get m(); // getter
}
```
## Implement interface
``` TypeScript
class C implements I {
x: number = 0;
z: string = "z";
get m() {
return this.x;
}
set m(v: number) {
this.x = v;
}
foo(): number {
return 0;
}
}
```
In TypeScript, `implements` is not required, any objects satisfies the fields defined by the interface are treated implemented those interfaces. But it is recommended to use `implements` when using ts2wasm-compiler since the compiler may apply further optimization according to these information.
## Assign to interface
interface can be assigned from an object literal or class instance.
``` TypeScript
interface I {
x: number;
}
let obj: I = {
x: 10,
}
class A {
y: number = 2;
x: number = 1;
}
obj = new A();
```
## Optional fields
``` TypeScript
interface I {
x: number;
y?: number;
}
let i : I = { x: 1 };
```
Reading an un-exist optional field will return `undefined`. Writing an un-exist optional field will cause an error since it's not possible to add a new field to an static object.
``` TypeScript
console.log(i.y); // undefined
i.y = 1; // runtime error
```
# Limitations
- interface extends is **not supported**
``` TypeScript
interface I1 {
x: number;
}
// Not Supported
interface I2 extends I1 {
y: number;
}
```
- indexed signature interface is **not supported**
``` TypeScript
interface I {
[index: number]: number;
}
```
- function signature interface is **not supported**
``` TypeScript
interface I {
(x: number): number;
}
```
================================================
FILE: doc/developer-guide/wasmType_usage.md
================================================
# Use wasmType in typescript
## wasmType declaration
Now we support use wasmType directly in typescript, these below types are supported:
### wasm basic type
- `i32`
- `i64`
- `f32`
- `f64`
- `anyref`
### wasm heap type
- `array`
- `struct`
## wasmType usage
During usage, we must follow some rules. And the wasm basic type rules is differ from wasm heap type rules.
### wasm basic type
We can use the wasm basic type as ts type name directly.
### wasm heap type
We should set a special comment to indicate that a wasm heap type structure will be created.
1. For `array`, we use `comment + array type alias` to represent the raw wasm array type.
```ts
// Wasmnizer-ts: @WASMArray@ <Not_Packed, Mutable, Nullable>
type arrayType1 = string[];
---> will create a raw wasm array type: array<stringref>
// Wasmnizer-ts: @WASMArray@
type arrayType2 = i32[];
---> will create a raw wasm array type: array<i32>
```
**Hint: `// Wasmnizer-ts: @WASMArray@ ` is necessary, and `<Not_Packed, Mutable, Nullable>` is optional. The latter shows that `if the array element is packed`, `if the array element is mutable`, `if the array is nullable`. The default value is `Not_Packed`, `Mutable` and `Nullable`.**
2. For `struct`, we use `comment + tuple type alias` to represent the raw wasm struct type.
```ts
// Wasmnizer-ts: @WASMStruct@ <[Not_Packed, Not_Packed], [Mutable, Mutable], Nullable, NULL>
type structType1 = [arrayType1, i64];
---> will create a raw wasm struct type: struct[array<stringref>, i64]
// Wasmnizer-ts: @WASMStruct@
type structType2 = [i64, i32];
---> will create a raw wasm struct type: struct[i64, i32]
```
**Hint: `// Wasmnizer-ts: @WASMStruct@ ` is necessary, and `<[Not_Packed, ...], [Mutable, ...], Nullable, BaseTypeName>` is optional. The latter shows that `if the struct fields are packed`, `if the struct fields are mutable`, `if the struct is nullable`, `the struct's base type name`. The default value is `[Not_Packed, ...]`, `[Mutable, ...]`, `Nullable` and `NULL`.**
The comments' optional attributes can be one of these enum value:
```ts
export enum PackedTypeKind {
Not_Packed = 'Not_Packed',
I8 = 'I8',
I16 = 'I16',
}
export enum MutabilityKind {
Immutable = 'Immutable',
Mutable = 'Mutable',
}
export enum NullabilityKind {
NonNullable = 'NonNullable',
Nullable = 'Nullable',
}
```
## Example
### Used as basic type
If we define the wasmtype for variables, and the right value is LiteralValue or variables with the same wasmtype, the **no cast** will be generated.
```ts
const a: i32 = 100;
-->
(i32.const 100)
```
```ts
const a: i64 = 100;
-->
(i64.const 100)
```
```ts
const a: f32 = 100;
-->
(f32.const 100)
```
```ts
const a: f64 = 100;
-->
(f64.const 100)
```
```ts
// Wasmnizer-ts: @WASMArray@
type arrayType2 = i32[];
const a: arrayType2 = [100];
-->
(array.new_fixed $array0 1
(i32.const 100)
)
```
```ts
// Wasmnizer-ts: @WASMStruct@
type structType2 = [i64, i32];
const a: structType2 = [100, 200]
--->
(struct.new $45
(i64.const 100)
(i32.const 200)
)
```
If we don't define the wasmtype explicitly, then the variable will be regard as `number` type, **one cast** will be occurs.
```ts
const a = 100 as i32;
--->
(f64.convert_i32_s
(i32.const 100)
)
```
### Used as array element type
The array type should be explicitly specified too.
```ts
const a: i32[] = [1, 2];
-->
a will be regarded as i32[], the elements in right value are both i32.
since we use struct to represent ts array, so the wasm structure is struct[array<i32>, i32].
```
```ts
const x: arrayType2 = [100];
const y: arrayType2 = [200];
const a: arrayType2[] = [x, y];
-->
a will be regarded as arrayType2[], the elements in right value are both arrayType2.
since we use struct to represent ts array, so the wasm structure is struct[array<array<i32>>, i32].
```
If array's type is not explicitly specified, then left value is regarded as number[], compilation error will occur.
```ts
let a1: i32 = 1;
let a2: i32 = 2;
let a = [a1, a2];
-->
a will be regarded as number[], compile will fail.
```
### Used as class property type
Each property's wasm type should be explicitly specified.
```ts
class A {
a: i32 = 1;
b: i64 = 2;
c: f32 = 3;
d: f64 = 4;
e: arrayType2 = [5];
}
-->
The properties type are i32, i64, f32, f64, array<i32> type.
```
If property's type is not explicitly specified, they will be regarded as original ts type, and **one cast** will occur.
```ts
class A {
a = 1 as i32;
b = 2 as i64;
c = 3 as f32;
d = 4 as f64;
}
-->
The properties type are both number type, and a, b, c all will be cast to f64.
```
Wasm heap type can not be used as casted target since the ts original type `number[]` can not be casted to `WASMArrayType`:
```ts
class A {
e = [5] as arrayType2
}
-->
Will cause compilation error since `cannot make cast value from "Array<NUMBER(6)(OBJECT)>(-1)" to "WASM_ARRAY(58)"`
```
### Used as interface property type
Each property's wasm type should be explicitly specified.
```ts
interface I {
a: i32;
b: i64;
c: f32;
d: f64;
e: arrayType2;
}
-->
The properties type are i32, i64, f32, f64, array<i32> type.
```
### Used as object literal property type
Since object literal's properties' type can not be defined, we only provide its value, so we judge properties' type by its real value type.
```ts
const x: arrayType2 = [5];
const obj = {
a: 1 as i32,
b: 2 as i64,
c: 3 as f32,
d: 4 as f64,
e: x as arrayType2,
}
-->
The properties type are i32, i64, f32, f64, array<i32> type.
```
So, if we assign the obj's type to an interface type which has wasmtype, then we should ensure that the properties' value type should be wasmtype too.
```ts
interface I {
a: i32;
b: i64;
c: f32;
d: f64;
e: arrayType2;
}
const x: arrayType2 = [5];
const obj: I = {
a: 1 as i32,
b: 2 as i64,
c: 3 as f32,
d: 4 as f64,
e: x as arrayType2,
}
--->
compile success
```
```ts
interface I {
a: i32;
b: i64;
c: f32;
d: f64;
e: arrayType2;
}
const obj: I = {
a: 1,
b: 2,
c: 3,
d: 4,
e: [5],
}
--->
compile fail
```
### Used as funtion param type & return type
The parameter's type and return type should be explicitly specified when using wasmtype.
```ts
function test(): i32 {
return 100 as i32;
}
-->
The return type is i32
```
```ts
function test() {
return 100 as i32;
}
-->
One cast will occur, the return type is number.
(return
(f64.convert_i32_s
(i32.const 100)
)
)
```
```ts
function test(): arrayType2 {
const x: arrayType2 = [100];
return x;
}
-->
The return type is array<i32>.
```
### type casting in binary operations
If two operators with wasm type operate binary operations, they will cast to the larger type, and operate.
```ts
const a: i32 = 100;
const b: f32 = 80.75;
const c = a + b;
--->
(local.set $0
(i32.const 100)
)
(local.set $1
(f32.const 80.75)
)
(local.set $2
(f64.promote_f32
(f32.add
(f32.convert_i32_s
(local.get $0)
)
(local.get $1)
)
)
)
```
================================================
FILE: doc/environment_variables.md
================================================
# ts2wasm environment variables
This document record useful environment variables used during development, these variables may or may not be included in final release.
- **TS2WASM_DUMP_SCOPE**
if not none, ts2wasm will dump the scope information before code generation
- **TS2WASM_VALIDATE**
if not none, ts2wasm will run binaryen's validation function to print any error found in the generated wasm module
================================================
FILE: doc/faq.md
================================================
# Frequently Asked Questions (FAQ)
This document provides answers to some of the most frequently asked questions about Wasmnizer-ts. It is designed to help users understand the project better.
Please note that this document is continually updated and improved. If your question is not addressed here, feel free to raise an issue or contribute to the project.
### Q: Is the end goal support for the full TypeScript language? What about JavaScript?
We are trying to support more language features, but since WebAssembly opcode is statically compiled, a full coverage of TypeScript not possible. For example, `eval` and `function bind` are not supported. This may change as the Wasm specification evolves.
As for JavaScript, it's not in the scope of Wasmnizer-ts. In Wasmnizer-ts we are trying to use the type information in source code to do static compilation. The more type information in the source code, the better performance for the generated wasm module. Since JavaScript contains no type information, then Wasmnizer-ts can't get any information for static compilation.
For executing pure JavaScript in WebAssembly, maybe the VM-in-VM approach (build a JavaScript VM to WebAssembly) is more suitable.
### Q: What's an appropriate usecase for Wasmnizer-ts?
Wasmnizer-ts brings a subset of TypeScript to WebAssembly, so it can be used in many areas as long as they need programming capabilities, some typical scenarios include:
- Application programming language for IoT devices.
Wasmnizer-ts leverages WasmGC, so there is need to compile a whole language runtime inside WebAssembly, making the generated wasm module very small;
- Application programming language for function computing (FaaS)
Wasmnizer-ts brings a new choice for developers;
- A more friendly WebAssembly targeted language for frontend developers
In frontend projects, it's very common to build some CPU intensive logic to WebAssembly to get better performance.
Currently some statically typed languages such as C/C++/Rust can be successfully compiled to WebAssembly and work well, but the frontend developers may not be familiar with these languages. Wasmnizer-ts provides a new choice: the frontend developers can write TypeScript, building on their experience with JavaScript, then compile to WebAssembly.
### Q: What's the difference between Wasmnizer-ts and devicescript (https://github.com/microsoft/devicescript) ?
DeviceScript is a very interesting project which we evaluated, as well as Static TypeScript, before we started Wasmnizer-ts. We got lots of ideas about which syntax to support thanks to these projects. We're really happy to see that DeviceScript has so many useful features and APIs added.
There are some fundamental difference between Wasmnizer-ts and DeviceScript: from what we can tell, DeviceScript uses a self-defined bytecode, while Wasmnizer-ts uses WasmGC opcode. Currently WasmGC is in an early stage, so there are challenges for us to implement some features. However, as a standard bytecode format, we can gradually benefit from the new spec proposals (e.g. WasmGC Post-MVP, ESM-integration, etc), and we may even reuse some standard WASI APIs or even re-use more wasm ecosystem components in the future.
In addition we contribute to WAMR, where we implemented the WasmGC proposal but we find that there isn't too many toolchains ready for WasmGC (at time of writing, Kotlin and Dart have experimental support), so this project is also an exploration to understand how WasmGC can be used in real languages so that we can optimize our runtime implementation and even propose more useful opcodes.
We are determined and interested in driving the development of Wasmnizer-ts. It's great to see projects like DeviceScript which provide developer friendly experience in the embedded space.
================================================
FILE: doc/getting_started.md
================================================
# Getting Started
## Build the compiler
1. clone the repo
``` bash
git clone https://github.com/intel/Wasmnizer-ts.git
```
2. install the dependencies
``` bash
cd Wasmnizer-ts
npm install
```
3. build
``` bash
npm run build
```
## Build ts source code
``` bash
cd build
node cli/ts2wasm.js --opt=3 <source> -o out.wasm
```
## Build wasm module to AoT module
``` bash
# Build WAMR AoT compiler
cd runtime-library/deps/wamr-gc/wamr-compiler
## Follow the instructions in the README.md to build wamrc (please add -DWAMR_BUILD_GC_BINARYEN=1 during cmake configuration)
# Generate AoT module
/path/to/wamrc --enable-gc -o out.aot out.wasm
```
Please refer to [developer guide](./developer-guide/index.md) for feature description.
## Execute the generated module
- Execute on WAMR
Refer to [iwasm_gc](../runtime-library/README.md)
## Source debugging (browser only)
To debug the generated wasm module, use `--debug --sourceMap` command line options to generate wasm module containing source map.
```bash
node cli/ts2wasm.js <source> -o out.wasm --debug --sourceMap
```
================================================
FILE: doc/libdyntype_api_spec.md
================================================
# libdyntype API spec
## Overview
`libdyntype` is a library for supporting dynamic objects for WebAssembly. It provides APIs for creating, accessing and manipulating dynamic objects. The dynamic objects are represented as `externref` in WebAssembly, the actual memory space is created and managed by external environment.
> Note: in current implementation, we use `anyref` rather than `externref` to avoid `internalize` and `externalize` operations, we will switch to `externref` once we confirm the overhead of `internalize/externalize` is acceptable.

The dynamic objects managed by `libdyntype` are called `any-object`, it can be divided into two categories:
1. `pure dynamic type`: these objects are originally created from libdyntype.
2. `extref`: these objects are created when some static objects are assigned to an `any-object`. It's still a dynamic object, but it has some special properties to store references to the static object.

For `extref`, there are two levels for the implementation:
- level-1:
- Support creating `extref` when assigning static object to any-object, but can't access the static fields through libdyntype APIs, the `extref` must be cast back to static type before accessing.
> level-1 is not bound to a specific source language to be compiled to WebAssembly, libdyntype developer don't need to learn details of the language design and wasm runtime APIs.
- level-2 (**mixed-type**):
- Based on level 1, additional support for accessing static fields through libdyntype APIs. Also support add new dynamic properties to the `extref`.
> level-2 is bound to a specific source language as well as the target wasm runtime, libdyntype developer must know:
- the object layout of the specific languages
- the wasm runtime APIs for accessing the fields of these static objects, or APIs for invoking wasm functions
## Dependent status
These APIs are required by `dynamic types`, the absence of this set of APIs would prevent apps utilizing dynamic types from functioning correctly.
> Note: some standard libraries may depends on libdyntype, e.g. `console.log`, so it is likely most apps will not work if libdyntype is not provided.
## Concepts
- **dyntype context**
An opaque pointer provided by the libdyntype implementer, this pointer will be stored in application once startup, and passed to all APIs as the first argument. If the libdyntype implementation doesn't need a context, it can be `NULL`.
- **extref**
In `ts2wasm-compiler` there are both static and dynamic types, if a statically-typed variable is assigned to an any-typed one, then the dynamic object actually hold a reference to the static world, this kind of object is called `extref`.
> Note that the world `extref` here is different from the `externref` in WebAssembly, it is viewed from the libdyntype's perspective.
The extref must record two things:
1. A tag to indicate whether the static object is an `object`, `array` or `closure`
2. A reference to the static object, the reference is a table element index inside wasm table
The actual representation of `extref` is implementer-defined, it doesn't need to be a new type. A possible representation is a normal `object` with specific fields to store the tag and reference to static object.
- **thread-safety**
`libdyntype` assumes applications are executed in a single thread environment, no thread safety is guaranteed.
- **WasmGC string**
string represented by WasmGC array + WasmGC struct, the struct contains two fields:
1. `flag: i32`: a reserved field for encoding and other future use
2. `data: array<i8>`: the array to store string content
## Module name
`libdyntype`
## APIs
- **dyntype_get_context**
- **Description**
- Get the dyntype context
- **Parameters**
- None
- **Return**
- `externref`: the dyntype context
- **dyntype_new_number**
- **Description**
- Create a dynamic typed number
- **Parameters**
- `externref`: the dyntype context
- `f64`: the number value
- **Return**
- `externref`: the created number
- **dyntype_new_boolean**
- **Description**
- Create a dynamic typed boolean
- **Parameters**
- `externref`: the dyntype context
- `i32`: the boolean value
- **Return**
- `externref`: the created boolean
- **dyntype_new_string**
- **Description**
- Create a dynamic typed string
- **Parameters**
- `externref`: the dyntype context
- `structref`: the wasm represented string
- **Return**
- `externref`: the created string
- **dyntype_new_undefined**
- **Description**
- Create a dynamic typed undefined
- **Parameters**
- `externref`: the dyntype context
- **Return**
- `externref`: the created undefined
- **dyntype_new_null**
- **Description**
- Create a dynamic typed null
- **Parameters**
- `externref`: the dyntype context
- **Return**
- `externref`: the created null
- **dyntype_new_object**
- **Description**
- Create a dynamic typed object
- **Parameters**
- `externref`: the dyntype context
- **Return**
- `externref`: the created object
- **dyntype_new_object_with_proto**
- **Description**
- Create a dynamic typed object with prototype
- **Parameters**
- `externref`: the dyntype context
- `externref`: the prototype of the object
- **Return**
- `externref`: the created object
- **dyntype_new_object_with_class**
- **Description**
- Create a dynamic typed object with class
- **Parameters**
- `externref`: the dyntype context
- `i32`: the class name (string)
- `externref`: rest parameters array
- **Return**
- `externref`: the created object
- **dyntype_new_array**
- **Description**
- Create a dynamic typed array with length
- **Parameters**
- `externref`: the dyntype context
- `i32`: the length of the array
- **Return**
- `externref`: the created array
- **dyntype_new_extref**
- **Description**
- Create a dynamic typed extref
- **Parameters**
- `externref`: the dyntype context
- `i32`: the tag to indicate the static object is `object`|`array`|`closure`
- `i32`: the reference to the static object (wasm table element index)
- **Return**
- `externref`: the created extref
- **dyntype_set_elem**
- **Description**
- if it's a dynamic typed array:
- Set an element to the dynamic typed array
- if it's an extref:
- Level 1: raise exception: `libdyntype: unsupport operation for extref: set_elem`
- Level 2: set an element to the boxed static typed array
- **Parameters**
- `externref`: the dyntype context
- `externref`: the array
- `i32`: the index of the element to be set
- `externref`: the element to be set
- **Return**
- None
- **dyntype_get_elem**
- **Description**
- if it's a dynamic typed array:
- Get an element from the dynamic typed array
- if it's an extref:
- Level 1: raise exception: `libdyntype: unsupport operation for extref: get_elem`
- Level 2: get an element to the boxed static typed array
- **Parameters**
- `externref`: the dyntype context
- `externref`: the array
- `i32`: the index of the element to be get
- **Return**
- `externref`: the element
- **dyntype_set_property**
- **Description**
- if it's a dynamic typed object:
- Set the property of the dynamic typed object
- if it's an extref:
- Level 1: raise exception: `libdyntype: unsupport operation for extref: set_property`
- Level 2: set the field value of the boxed static typed object if the field exists in the static object, otherwise add a dynamic property
- **Parameters**
- `externref`: the dyntype context
- `externref`: the object
- `i32`: the property name (string)
- `externref`: the property value
- **Return**
- `i32`: result, 0 for success, -1 otherwise
- **dyntype_get_property**
- **Description**
- if it's a dynamic typed object:
- Get the property of the dynamic typed object
- if it's an extref:
- Level 1: raise exception: `libdyntype: unsupport operation for extref: get_property`
- Level 2: get the field value of the boxed static typed object if the field exists in the static object, otherwise return `undefined`
- **Parameters**
- `externref`: the dyntype context
- `externref`: the object
- `i32`: the property name (string)
- **Return**
- `externref`: the property value
- **dyntype_get_own_property**
- **Description**
- if it's a dynamic typed object:
- Get the own property of the dynamic typed object
- if it's an extref:
- Level 1: raise exception: `libdyntype: unsupport operation for extref: get_own_property`
- Level 2: get the field value of the boxed static typed object if the field exists in the static object, otherwise return `undefined`
- **Parameters**
- `externref`: the dyntype context
- `externref`: the object
- `i32`: the property name (string)
- **Return**
- `externref`: the property value
- **dyntype_define_property**
- **Description**
- if it's a dynamic typed object:
- Define the property of the dynamic typed object
- if it's an extref:
- raise exception: `libdyntype: unsupport operation for extref: define_property`
- **Parameters**
- `externref`: the dyntype context
- `externref`: the object
- `i32`: the property name (string)
- `externref`: the property descriptor
- **Return**
- `i32`: result, 0 for success, -1 otherwise
- **dyntype_has_property**
- **Description**
- if it's a dynamic typed object:
- Check if the dynamic typed object has the property
- if it's an extref:
- Level 1: raise exception: `libdyntype: unsupport operation for extref: has_property`
- Level 2: check if the field exists in the static typed object
- **Parameters**
- `externref`: the dyntype context
- `externref`: the object
- `i32`: the property name (string)
- **Return**
- `i32`: result, 1 if property exists, 0 otherwise
- **dyntype_delete_property**
- **Description**
- if it's a dynamic typed object:
- Delete the property of the dynamic typed object
- if it's an extref:
- Level 1: raise exception: `libdyntype: unsupport operation for extref: delete_property`
- Level 2: if the field exists in the boxed static object, raise exception: `libdyntype: delete property on static type object`, otherwise delete the dynamic property of the mixed type
- **Parameters**
- `externref`: the dyntype context
- `externref`: the object
- `i32`: the property name (string)
- **Return**
- `i32`: result, 0 for success, -1 otherwise
- **dyntype_is_number**
- **Description**
- Check if the dynamic typed value is a number
- **Parameters**
- `externref`: the dyntype context
- `externref`: the value
- **Return**
- `i32`: result, 1 if it is a number, 0 otherwise
- **dyntype_is_bool**
- **Description**
- Check if the dynamic typed value is a boolean
- **Parameters**
- `externref`: the dyntype context
- `externref`: the value
- **Return**
- `i32`: result, 1 if it is a boolean, 0 otherwise
- **dyntype_is_string**
- **Description**
- Check if the dynamic typed value is a string
- **Parameters**
- `externref`: the dyntype context
- `externref`: the value
- **Return**
- `i32`: result, 1 if it is a string, 0 otherwise
- **dyntype_is_undefined**
- **Description**
- Check if the dynamic typed value is an undefined
- **Parameters**
- `externref`: the dyntype context
- `externref`: the value
- **Return**
- `i32`: result, 1 if it is an undefined, 0 otherwise
- **dyntype_is_null**
- **Description**
- Check if the dynamic typed value is a null
- **Parameters**
- `externref`: the dyntype context
- `externref`: the value
- **Return**
- `i32`: result, 1 if it is a null, 0 otherwise
- **dyntype_is_object**
- **Description**
- Check if the dynamic typed value is an object
- **Parameters**
- `externref`: the dyntype context
- `externref`: the value
- **Return**
- `i32`: result, 1 if it is an object, 0 otherwise
- **dyntype_is_array**
- **Description**
- Check if the dynamic typed value is an array
- **Parameters**
- `externref`: the dyntype context
- `externref`: the value
- **Return**
- `i32`: result, 1 if it is an array, 0 otherwise
- **dyntype_is_function**
- **Description**
- Check if the dynamic typed value is a function
- **Parameters**
- `externref`: the dyntype context
- `externref`: the value
- **Return**
- `i32`: result, 1 if it is a function, 0 otherwise
- **dyntype_is_extref**
- **Description**
- Check if the dynamic typed value is an extref
- **Parameters**
- `externref`: the dyntype context
- `externref`: the value
- **Return**
- `i32`: result, 1 if it is an extref, 0 otherwise
- **dyntype_to_number**
- **Description**
- Convert the dynamic typed value to a static number
- **Parameters**
- `externref`: the dyntype context
- `externref`: the value
- **Return**
- `f64`: the converted number
- **dyntype_to_bool**
- **Description**
- Convert the dynamic typed value to a static boolean
- **Parameters**
- `externref`: the dyntype context
- `externref`: the value
- **Return**
- `i32`: the converted boolean
- **dyntype_to_string**
- **Description**
- Convert the dynamic typed value to a static string
- **Parameters**
- `externref`: the dyntype context
- `externref`: the value
- **Return**
- `structref`: the converted string
- **dyntype_to_extref**
- **Description**
- Get the static object reference from extref
- **Parameters**
- `externref`: the dyntype context
- `externref`: the extref value
- **Return**
- `i32`: the static object reference (wasm table element index)
- **dyntype_is_exception**
- **Description**
- Check if the dynamic typed value is an exception
- **Parameters**
- `externref`: the dyntype context
- `externref`: the value
- **Return**
- `i32`: result, 1 if it is an exception, 0 otherwise
- **dyntype_is_falsy**
- **Description**
- Check if the dynamic typed value is a falsy value
- **Parameters**
- `externref`: the dyntype context
- `externref`: the value
- **Return**
- `i32`: 1 if it is a falsy value, 0 otherwise
- **dyntype_typeof**
- **Description**
- Get the type of the dynamic typed value
- **Parameters**
- `externref`: the dyntype context
- `externref`: the value
- **Return**
- `structref`: the type of the value (WasmGC string)
- **dyntype_type_eq**
- **Description**
- Check if the given dynamic typed objects are equal
- **Parameters**
- `externref`: the dyntype context
- `externref`: the lhs value
- `externref`: the lhs value
- **Return**
- `i32`: 1 if the object is equal, 0 otherwise
- **dyntype_toString**
- **Description**
- Convert the dynamic typed value to a string
- **Parameters**
- `externref`: the dyntype context
- `externref`: the value
- **Return**
- `structref`: the converted string (WasmGC string)
- **dyntype_cmp**
- **Description**
- Compare two dynamic typed values
- **Parameters**
- `externref`: the dyntype context
- `externref`: the lhs value
- `externref`: the rhs value
- `i32`: operator, 29 for `<`, 31 for `>`, 32 for `<=`, 33 for `>=`, 34 for `==`, 35 for `!=`, 36 for `===`, 37 for `!==
- **Return**
- `i32`: the comparison result, 1 for true, 0 otherwise
- **dyntype_set_prototype**
- **Description**
- if it's a dynamic typed object:
- Set the prototype of the dynamic typed object
- if it's an extref:
- raise exception: `libdyntype: unsupport operation for extref: set_prototype`
- **Parameters**
- `externref`: the dyntype context
- `externref`: the object
- `externref`: the prototype
- **Return**
- `i32`: result, 0 for success, -1 for failure
- **dyntype_get_prototype**
- **Description**
- if it's a dynamic typed object:
- Get the prototype of the dynamic typed object
- if it's an extref:
- raise exception: `libdyntype: unsupport operation for extref: get_prototype`
- **Parameters**
- `externref`: the dyntype context
- `externref`: the object
- **Return**
- `externref`: the prototype
- **dyntype_instanceof**
- **Description**
- Check if the dynamic typed value is an instance of the given value
- **Parameters**
- `externref`: the dyntype context
- `externref`: the lhs value
- `externref`: the rhs value
- **Return**
- `i32`: 1 if true, 0 otherwise
- **dyntype_invoke**
- **Description**
- if it's a dynamic typed object:
- Invoke method of the given dynamic object if name is not NULL, otherwise invoke the given dynamic object
- if it's an extref:
- Level 1: raise exception: `libdyntype: unsupport operation for extref: invoke`
- Level 2: invoke the boxed wasm function (name is NULL) or class method (name is not NULL)
- **Parameters**
- `externref`: the dyntype context
- `i32`: method name (string)
- `externref`: the given dynamic object
- `externref`: the arguments array
- **Return**
- `externref`: the return value
- **dyntype_get_global**
- **Description**
- Get a global dynamic variable
- **Parameters**
- `externref`: the dyntype context
- `i32`: global variable name (string)
- **Return**
- `externref`: the global variable
- **dyntype_get_keys**
- **Description**
- Get the enumerable properties of the given object
- **Parameters**
- `externref`: the dyntype context
- `externref`: the object
- **Return**
- `externref`: dynamic array which store all property names
================================================
FILE: doc/libstruct_indirect_api_spec.md
================================================
# libstruct_indirect API spec
## Overview
The `libstruct_indirect` API is used to access WasmGC struct fields through index calculated during runtime. The API is designed to be used by `ts2wasm-compiler` to support `interface` type.
These APIs are used to emulate the behaviour of the [proposed struct.get/set_indirect opcode](https://github.com/WebAssembly/gc/issues/397), if these opcodes are accepted by the proposal and supported by runtime, the `libstruct_indirect` API will no longer be required.
## Dependent status
These APIs are required by `interface` type, the absence of this set of APIs would prevent apps utilizing `interface` type from functioning correctly.
## Module name
`libstruct_indirect`
## API
- **struct_get_indirect_i32**
- **Description**
- Get i32 field from WasmGC struct
- **Parameters**
- `structref`: the WasmGC struct
- `i32`: field index
- **Return**
- `i32`: the field value
- **struct_get_indirect_i64**
- **Description**
- Get i64 field from WasmGC struct
- **Parameters**
- `structref`: the WasmGC struct
- `i32`: field index
- **Return**
- `i64`: the field value
- **struct_get_indirect_f32**
- **Description**
- Get f32 field from WasmGC struct
- **Parameters**
- `structref`: the WasmGC struct
- `i32`: field index
- **Return**
- `f32`: the field value
- **struct_get_indirect_f64**
- **Description**
- Get f64 field from WasmGC struct
- **Parameters**
- `structref`: the WasmGC struct
- `i32`: field index
- **Return**
- `f64`: the field value
- **struct_get_indirect_anyref**
- **Description**
- Get anyref field from WasmGC struct
- **Parameters**
- `structref`: the WasmGC struct
- `i32`: field index
- **Return**
- `anyref`: the field value
- **struct_get_indirect_funcref**
- **Description**
- Get funcref field from WasmGC struct
- **Parameters**
- `structref`: the WasmGC struct
- `i32`: field index
- **Return**
- `funcref`: the field value
- **struct_set_indirect_i32**
- **Description**
- Set i32 field of WasmGC struct
- **Parameters**
- `structref`: the WasmGC struct
- `i32`: field index
- `i32`: field value
- **struct_set_indirect_i64**
- **Description**
- Set i64 field of WasmGC struct
- **Parameters**
- `structref`: the WasmGC struct
- `i32`: field index
- `i64`: field value
- **struct_set_indirect_f32**
- **Description**
- Set f32 field of WasmGC struct
- **Parameters**
- `structref`: the WasmGC struct
- `i32`: field index
- `f32`: field value
- **struct_set_indirect_f64**
- **Description**
- Set f64 field of WasmGC struct
- **Parameters**
- `structref`: the WasmGC struct
- `i32`: field index
- `f64`: field value
- **struct_set_indirect_anyref**
- **Description**
- Set anyref field of WasmGC struct
- **Parameters**
- `structref`: the WasmGC struct
- `i32`: field index
- `anyref`: field value
- **struct_set_indirect_funcref**
- **Description**
- Set funcref field of WasmGC struct
- **Parameters**
- `structref`: the WasmGC struct
- `i32`: field index
- `funcref`: field value
================================================
FILE: doc/standard-library/array.md
================================================
# Array API
The standard array APIs are implemented by `native`. Here we list the APIs supported by `Wasmnizer-ts`.
Please note that specific implementations may differ slightly from libraries like JavaScript Core Library. For uniform APIs, hyperlinks to their descriptions will be provided. In situations where there are variations, this document offers API descriptions along with explanations for the differences.
+ [**`push(...items: T[]): number`**](https://github.com/microsoft/TypeScript/blob/eb374c28d6810e317b0c353d9b1330b0595458f4/src/lib/es5.d.ts#L1313-L1317)
+ [**`join(separator?: string): string`**](https://github.com/microsoft/TypeScript/blob/eb374c28d6810e317b0c353d9b1330b0595458f4/src/lib/es5.d.ts#L1330-L1334)
+ [**`reverse(): T[]`**](https://github.com/microsoft/TypeScript/blob/eb374c28d6810e317b0c353d9b1330b0595458f4/src/lib/es5.d.ts#L1335-L1339)
+ [**`slice(start?: number, end?: number): T[]`**](https://github.com/microsoft/TypeScript/blob/eb374c28d6810e317b0c353d9b1330b0595458f4/src/lib/es5.d.ts#L1345-L1354)
+ [**`unshift(...items: T[]): number`**](https://github.com/microsoft/TypeScript/blob/eb374c28d6810e317b0c353d9b1330b0595458f4/src/lib/es5.d.ts#L1381-L1385)
+ [**`indexOf(searchElement: T, fromIndex?: number): number`**](https://github.com/microsoft/TypeScript/blob/eb374c28d6810e317b0c353d9b1330b0595458f4/src/lib/es5.d.ts#L1386-L1391)
+ [**`lastIndexOf(searchElement: T, fromIndex?: number): number`**](https://github.com/microsoft/TypeScript/blob/eb374c28d6810e317b0c353d9b1330b0595458f4/src/lib/es5.d.ts#L1392-L1397)
+ [**`reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T`**](https://github.com/microsoft/TypeScript/blob/eb374c28d6810e317b0c353d9b1330b0595458f4/src/lib/es5.d.ts#L1449-L1455)
+ [**`reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T`**](https://github.com/microsoft/TypeScript/blob/eb374c28d6810e317b0c353d9b1330b0595458f4/src/lib/es5.d.ts#L1462-L1468)
+ [**`fill(value: T, start?: number, end?: number): T[]`**](https://github.com/microsoft/TypeScript/blob/eb374c28d6810e317b0c353d9b1330b0595458f4/src/lib/es2015.core.d.ts#L25-L33)
+ [**`includes(searchElement: T, fromIndex?: number): boolean`**](https://github.com/microsoft/TypeScript/blob/eb374c28d6810e317b0c353d9b1330b0595458f4/src/lib/es2016.array.include.d.ts#L2-L7)
+ **`pop(): T`**
**Description**: Remove and return the last element from array.
In `Wasmnizer-ts`, we will regard the union type `T | undefined` as any type, so we only define `T` as return type here.
+ **`concat(...items: T[]): T[]`**
**Description**: Concatenate multiple arrays and returns a new array containing the merged elements.
We simply set the `items`'s type to `T[]`.
+ **`shift(): T`**
**Description**: Remove and return the first element from array.
In `Wasmnizer-ts`, we will regard the union type `T | undefined` as any type, so we only define `T` as return type here.
+ **`sort(compareFn: (a: T, b: T) => number): T[]`**
**Description**: Sort the elements of an array in place and return the sorted array by a comparison function `compareFn`.
In `Wasmnizer-ts`, `this` represents class instance, so the return type is set to `T[]` not `this`.
+ **`splice(start: number, deleteCount?: number, ...items: T[]): T[]`**
**Description**: Change the contents of an array by removing, replacing, or adding elements.
Combines two standard APIs: `splice(start: number, deleteCount?: number): T[];` and `splice(start: number, deleteCount: number, ...items: T[]): T[];`.
+ **`every(predicate: (value: T, index: number, array: T[]) => boolean): boolean`**
**Description**: Applies a provided callback function `predicate` to each element in the array and returns `true` if the callback returns `true` for every element, otherwise, it returns `false`.
We set the `predicate callback function`'s return type to boolean, and the second parameter `thisArg` in the standard library has been deleted.
+ **`some(predicate: (value: T, index: number, array: T[]) => boolean): boolean`**
**Description**: Applies a provided callback function `predicate` to each element in the array and returns `true` if the callback returns `true` for at least one element, otherwise, it returns `false`.
We set the `predicate callback function`'s return type to boolean, and the second parameter `thisArg` in the standard library has been deleted.
+ **`forEach(callbackfn: (value: T, index: number, array: T[]) => void): void`**
**Description**: Iterate over the elements of an array and apply provided callback function `callbackfn` to each element.
The second parameter `thisArg` in the standard library has been deleted.
+ **`map<U>(callbackfn: (value: T, index: number, array: T[]) => U): U[]`**
**Description**: Return a new array containing the results of applying the callback function `callbackfn` to each element.
The second parameter `thisArg` in the standard library has been deleted.
+ **`filter(predicate: (value: T, index: number, array: T[]) => boolean): T[]`**
**Description**: Return a new array containing elements that satisfy the condition specified in the callback function `predicate`.
We set the `predicate callback function`'s return type to boolean, and the second parameter `thisArg` in the standard library has been deleted.
+ `find(predicate: (value: T, index: number, obj: T[]) => boolean): any`**
**Description**: Search for and return the first element in an array that satisfies a specified condition defined by a provided callback function `predicate`, otherwise, return `undefined`.
We set the `predicate callback function`'s return type to boolean, the second parameter `thisArg` in the standard library has been deleted, since `find` is always return `undefined`, so we set `any` type to represent `T | undefined`.
+ **`findIndex(predicate: (value: T, index: number, obj: T[]) => boolean): number`**
**Description**: Return the index of the first element in an array that satisfies a specified condition defined by a provided callback function `predicate`, otherwise, return -1.
We set the `predicate callback function`'s return type to boolean, and the second parameter `thisArg` in the standard library has been deleted.
+ **`copyWithin(target: number, start: number, end?: number): T[]`**
**Description**: Copy a portion of an array to another location within the same array.
In `Wasmnizer-ts`, `this` represents class instance, so the return type is set to `T[]` not `this`.
================================================
FILE: doc/standard-library/console.md
================================================
# console API
- **[`log(...values: any[]): void`](https://github.com/microsoft/TypeScript/blob/c532603633178c552b9747eef057784db2fc1e23/src/lib/dom.generated.d.ts#L26432C1-L26433C31), `native`**
Print values to console. If the argument is statically typed, it will be auto boxed to any.
================================================
FILE: doc/standard-library/index.md
================================================
# Wasmnizer-ts standard library
TypeScript doesn't introduce its own standard library, instead it relies on APIs provided by JavaScript engine because it is originally designed to be transpiled to JavaScript.
In `Wasmnizer-ts`, there are both static and dynamic type system
- For dynamic part, the [fallback mechanism](../developer-guide/fallback.md) allow us to re-use the standard library from external environment.
- For static part, we need to implement standard library based on static object layout.
Three methods are used to implement standard library in `Wasmnizer-ts`:
1. **native**: implement standard library in native, and expose them to wasm module through host APIs.
2. **source code**: implement standard library in TypeScript source code, and compile them with application code together.
3. **binaryen API**: implement standard library in wasm bytecode through binaryen API, and link them with application code together.
If the standard library API is implemented in `native`, then corresponding `libstd API` is required; if the standard library API is implemented in `source code` or `binaryen API`, then will be contained inside generated wasm module, and don't requre any APIs from runtime environment. Please navigate to below pages to check the API list and implementation method for every APIs.
If those APIs differ from the Core Library or Standard Library, there will be a description provided below to explain its usage.
- [console](./console.md)
- [string](./string.md)
- [array](./array.md)
- [math](./math.md)
================================================
FILE: doc/standard-library/math.md
================================================
# Math API
The standard math APIs are implemented by `source code` and `binaryen API`. Here we list the APIs supported by `Wasmnizer-ts`.
+ [**`pow(x: number, y: number): number`**](https://github.com/microsoft/TypeScript/blob/eb374c28d6810e317b0c353d9b1330b0595458f4/src/lib/es5.d.ts#L712-L717)
+ [**`max(...values: number[]): number`**](https://github.com/microsoft/TypeScript/blob/eb374c28d6810e317b0c353d9b1330b0595458f4/src/lib/es5.d.ts#L702-L706)
+ [**`min(...values: number[]): number`**](https://github.com/microsoft/TypeScript/blob/eb374c28d6810e317b0c353d9b1330b0595458f4/src/lib/es5.d.ts#L707-L711)
+ [**`sqrt(x: number): number`**](https://github.com/microsoft/TypeScript/blob/eb374c28d6810e317b0c353d9b1330b0595458f4/src/lib/es5.d.ts#L730-L734)
+ [**`abs(x: number): number`**](https://github.com/microsoft/TypeScript/blob/eb374c28d6810e317b0c353d9b1330b0595458f4/src/lib/es5.d.ts#L651-L655)
+ [**`ceil(x: number): number`**](https://github.com/microsoft/TypeScript/blob/eb374c28d6810e317b0c353d9b1330b0595458f4/src/lib/es5.d.ts#L677-L681)
+ [**`floor(x: number): number`**](https://github.com/microsoft/TypeScript/blob/eb374c28d6810e317b0c353d9b1330b0595458f4/src/lib/es5.d.ts#L692-L696)
================================================
FILE: doc/standard-library/string.md
================================================
# string API
The standard string APIs are implemented by `binaryen API`. Below are the string APIs supported by `Wasmnizer-ts`.
Please note that specific implementations may differ slightly from libraries like JavaScript Core Library. For uniform APIs, hyperlinks to their descriptions will be provided. In situations where there are variations, this document offers API descriptions along with explanations for the differences.
+ **[`concat(...strings: string[]): string`](https://github.com/microsoft/TypeScript/blob/c532603633178c552b9747eef057784db2fc1e23/src/lib/es5.d.ts#L408C1-L412C42)**
+ **[`slice(start?: number, end?: number): string`](https://github.com/microsoft/TypeScript/blob/c532603633178c552b9747eef057784db2fc1e23/src/lib/es5.d.ts#L460C1-L466C49)**
+ **[`charAt(pos: number): string`](https://github.com/microsoft/TypeScript/blob/c532603633178c552b9747eef057784db2fc1e23/src/lib/es5.d.ts#L396C1-L400C33)**
+ **[`charCodeAt(index: number): number`](https://github.com/microsoft/TypeScript/blob/c532603633178c552b9747eef057784db2fc1e23/src/lib/es5.d.ts#L402C1-L406C39)**
+ **[`substring(start: number, end?: number): string`](https://github.com/microsoft/TypeScript/blob/c532603633178c552b9747eef057784db2fc1e23/src/lib/es5.d.ts#L475C1-L481C52)**
+ **[`trim(): string`](https://github.com/microsoft/TypeScript/blob/c532603633178c552b9747eef057784db2fc1e23/src/lib/es5.d.ts#L495C1-L496C20)**
+ **[`toLowerCase(): string`](https://github.com/microsoft/TypeScript/blob/c532603633178c552b9747eef057784db2fc1e23/src/lib/es5.d.ts#L483C1-L484C27)**
+ **[`toUpperCase(): string`](https://github.com/microsoft/TypeScript/blob/c532603633178c552b9747eef057784db2fc1e23/src/lib/es5.d.ts#L489C1-L490C27)**
+ **`indexOf(searchString: string): number`**
**Description**: Searches for the first occurrence of a specified substring (`searchString`) within a string and returns the index at which it is found, otherwise, returns -1.
Passing the starting search index has not been implemented yet.
+ **`lastIndexOf(str: string): number`**
**Description**: Searches for the last occurrence of a specified substring (`str`) within a string and returns the index (position) at which it is found, otherwise, returns -1.
Passing the starting search index has not been implemented yet.
+ **`split(sep: string): string[]`**
**Description**: Splits a string into an array of substrings based on a specified separator (`sep`).
`RegExp` has not been implemented yet.
+ **`replace(from: string, to: string): string`**
**Description**: Replaces **the first** occurrence of a specified substring (`from`) within a string with another substring (`to`) and returns the resulting modified string.
`RegExp` has not been implemented yet.
+ **`match(pattern: string): string[]`**
**Description**: Searches for **the first** occurrence of a specified regular expression (`pattern`) within a string and returns an array containing the matched substring.
`RegExp` has not been implemented yet.
+ **`search(pattern: string): number`**
**Description**: Searches for a specified regular string (`pattern`) within a string and returns the index of the first occurrence of the matched substring or -1 if no match is found.
`RegExp` has not been implemented yet.
================================================
FILE: doc/validation_strategy.md
================================================
# ts2wasm-compiler validation strategy (WIP)
Ts2wasm-compiler aims to compile TypeScript source code to WebAssembly bytecode while keep the same semantics, the default validation strategy is to compile the same TypeScript source code into both JavaScript (through `tsc`) and WebAssembly (through `ts2wasm-compiler`) and compare the execution results.

## Test case organization
Test cases are organized into three levels:
1. category
- A category is a collection of test suites serving the same goal (e.g. syntax, stdlib, etc)
- Most categories used default validation strategy as shown above, some special categories may have special strategy and they can have their own test framework to execute the cases and validate the results
2. suite
- A suite is a folder containing several sub-folders or files for testing a language feature (e.g. syntax::BinaryenExpression)
- Only folders directly in the category root dir is a suite, sub-folders inside a suite is not a new suite. Validators can use up to **two level** of sub-folders according to the complex of the tested feature, but it's recommended to keep a light folder structure
- Suite should be automatically detected by the test framework of the corresponding category
3. case
- A `standalone` case is an `exported function` inside a source file, it should return something or print something as the result
- `multi-file` cases are stored in an folder containing an `index.ts` as the entry file, it can import any other files inside the `folder` or any level of `sub-folders`
- It's allowed to write several cases inside a single file, but the cases with side effects must be put into one file to avoid influence on other files
## Test case composition
``` TypeScript
/// compile options: xxx
/// auto_parameter: none | single | matrix
export binaryExpressionAdd(x: number, y: number) {
return x + y;
}
export binaryExpressionSub(x: number, y: number) {
return x - y;
}
```
1. Each file can optionally have `front matter` to interact with the `test framework`
- There may be multiple lines in the front matter, each line starts with `///` token
- A file is the minimal compilation unit, so the front matter apply to all the cases in a file
- There are some builtin configs which will be automatically consumed by all test frameworks (such as `compile options`, `auto_parameter`), other configs are defined and consumed by the test framework of each categories
> Note: per-case configuration may be supported in the future if required.
2. Parameters must be `number` or `boolean`, we may support `string` and other type later
- The test framework may randomly generate a group or several groups of parameters as input
3. The test case body can use any supported syntax, but the return type (if has) should be `number` or `boolean`, otherwise the test framework won't be able to validate the result
> If you need to validate complex objects content, use `console.log` rather than `return`
4. A separate json file (with same filename) can be placed besides to the case file to record fixed parameters
- Test framework should always execute based on the fixed parameters (if exists) firstly. (**This ensure the determinacy**)
- If `auto_parameter` is not none, then test framework automatically generate some parameters as input, and record the parameters in the log if failed. (**This helps to discover more corner cases**)
``` json
[
{
"case": "xxxx",
"args": [
{
"x": 1,
"y": 2
},
{
"x": 100,
"y": 1000
}
]
}
]
```
## Reference folder structure
``` Bash
tests/
|--syntax/
|--binary-expression/
|--add.ts
|--add.json
|--sub.ts
|--assign.ts
|--property-access-expression/
|--call-expression/
|--if-statement/
|--loop-statement/
|--...
|--stdlib/
|--array/
|--string/
|--fallthrough
|--map/
|--JSON/
```
================================================
FILE: example/app-framework/CMakeLists.txt
================================================
# Copyright (C) 2023 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
cmake_minimum_required (VERSION 2.9)
project (simple)
################ wamr runtime settings ################
message(STATUS "WAMR_BUILD_SDK_PROFILE=${WAMR_BUILD_SDK_PROFILE}")
# Reset default linker flags
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
if ("$ENV{COLLECT_CODE_COVERAGE}" STREQUAL "1" OR COLLECT_CODE_COVERAGE EQUAL 1)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
endif ()
set (RUNTIMR_DIR ${CMAKE_CURRENT_LIST_DIR}/../../runtime-library)
set (WAMR_ROOT_DIR ${RUNTIMR_DIR}/deps/wamr-gc)
## use library and headers in the SDK
link_directories(${WAMR_ROOT_DIR}/wamr-sdk/out/${WAMR_BUILD_SDK_PROFILE}/runtime-sdk/lib)
include_directories(
${WAMR_ROOT_DIR}/wamr-sdk/out/${WAMR_BUILD_SDK_PROFILE}/runtime-sdk/include
${WAMR_ROOT_DIR}/core/shared/utils
${WAMR_ROOT_DIR}/core/shared/platform/linux
)
################ application related ################
include_directories(${CMAKE_CURRENT_LIST_DIR}/src)
#Note: uncomment below line to use UART mode
#add_definitions (-DCONNECTION_UART)
## wamr
# include(${CMAKE_CURRENT_LIST_DIR}/wamr_config_wasmnizer_ts.cmake)
# add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
set (WAMR_BUILD_PLATFORM "linux")
set (WAMR_BUILD_TARGET X86_64)
set (WAMR_BUILD_INTERP 1)
set (WAMR_BUILD_AOT 1)
set (WAMR_BUILD_JIT 0)
set (WAMR_BUILD_LIBC_BUILTIN 1)
set (WAMR_BUILD_LIBC_WASI 0)
set (WAMR_BUILD_GC 1)
set (WAMR_BUILD_GC_BINARYEN 1)
set (WAMR_BUILD_STRINGREF 1)
set (USE_SIMPLE_LIBDYNTYPE 1)
## stringref
set(STRINGREF_DIR ${RUNTIMR_DIR}/stringref)
set(WAMR_STRINGREF_IMPL_SOURCE
${STRINGREF_DIR}/stringref_simple.c
)
include(${RUNTIMR_DIR}/deps/wamr-gc/build-scripts/runtime_lib.cmake)
## libdyntype
set(LIBDYNTYPE_DIR ${RUNTIMR_DIR}/libdyntype)
include (${LIBDYNTYPE_DIR}/libdyntype.cmake)
## stdlib
set(STDLIB_DIR ${RUNTIMR_DIR}/stdlib)
include_directories(${STDLIB_DIR})
set(STDLIB_SOURCE
${STDLIB_DIR}/lib_console.c
${STDLIB_DIR}/lib_array.c
${STDLIB_DIR}/lib_timer.c
)
## struct-indirect
set(STRUCT_INDIRECT_DIR ${RUNTIMR_DIR}/struct-indirect)
include_directories(${STRUCT_INDIRECT_DIR})
set(STRUCT_INDIRECT_SOURCE
${STRUCT_INDIRECT_DIR}/lib_struct_indirect.c
)
## utils
set(UTILS_DIR ${RUNTIMR_DIR}/utils)
include_directories(${UTILS_DIR})
set(TYPE_UTILS_SOURCE
${UTILS_DIR}/type_utils.c
)
set(OBJECT_UTILS_SOURCE
${UTILS_DIR}/object_utils.c
)
set(WAMR_UTILS_SOURCE
${UTILS_DIR}/wamr_utils.c
)
# Ignore warnings of QuickJS
set_source_files_properties(
${QUICKJS_SOURCE}
PROPERTIES
COMPILE_FLAGS "-w"
)
add_executable (simple src/main.c src/iwasm_main.c
${QUICKJS_SOURCE}
${LIBDYNTYPE_SRC}
${STDLIB_SOURCE}
${STRUCT_INDIRECT_SOURCE}
${TYPE_UTILS_SOURCE}
${OBJECT_UTILS_SOURCE}
${WAMR_UTILS_SOURCE}
)
target_link_libraries (simple vmlib -lm -ldl -lpthread -lrt)
================================================
FILE: example/app-framework/app/connection.ts
================================================
/*
* Copyright (C) 2023 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
import * as connection from '../lib/connection';
import * as timer from '../lib/timer';
import * as request from '../lib/request';
import * as attr_container from '../lib/attr_container';
let num = 0;
let g_conn: connection.wamr_connection | null;
function timer1_update(my_timer: timer.user_timer) {
const message = 'Hello, ' + num;
num++;
connection.send_on_connection(g_conn!, message, message.length);
}
export function on_init(): void {
request.register_resource_handler('/close', (req) => {
if (g_conn !== null) {
timer.timer_cancel(my_timer);
connection.close_connection(g_conn);
}
const resp = request.make_response_for_request(req);
resp.set_response(request.CoAP_Status.DELETED_2_02, 0, null, 0);
request.api_response_send(resp);
});
let args = attr_container.attr_container_create('');
let isSuccess = attr_container.attr_container_set_string(
args,
'address',
'127.0.0.1',
);
if (isSuccess) {
args = attr_container.global_attr_cont;
}
isSuccess = attr_container.attr_container_set_uint16(args, 'port', 7777);
if (isSuccess) {
args = attr_container.global_attr_cont;
}
g_conn = connection.open_connection(
'TCP',
args,
(conn, type, data, len) => {
if (type == connection.CONN_EVENT_TYPE_DATA) {
const message = data;
console.log('Client got a message from server ->' + message);
} else if (type == connection.CONN_EVENT_TYPE_DISCONNECT) {
console.log('connection is close by server!');
} else {
console.log('error: got unknown event type!!!');
}
},
);
if (g_conn == null) {
console.log('connect to server fail!');
return;
}
console.log('connect to server success!');
// const my_timer = new timer.user_timer(timer1_update, 1000, true);
// timer.timer_restart(my_timer, 1000);
const my_timer = timer.setInterval(timer1_update, 2000);
}
export function on_destroy(): void {
// on destory actions
}
================================================
FILE: example/app-framework/app/request_handler.ts
================================================
/*
* Copyright (C) 2023 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
import * as request from '../lib/request';
import { arraybuffer_to_string, string_to_arraybuffer } from '../lib/utils';
export function on_init(): void {
request.register_resource_handler('/test', (req) => {
const payload_string = arraybuffer_to_string(
req.payload,
req.payload_len,
);
console.log('### Req: /test ' + payload_string);
console.log(' request payload:');
console.log(' ' + payload_string + '\n');
const resp = request.make_response_for_request(req);
resp.set_payload(string_to_arraybuffer('OK'), 2);
request.api_response_send(resp);
});
}
export function on_destroy(): void {
// on destory actions
}
================================================
FILE: example/app-framework/app/request_sender.ts
================================================
/*
* Copyright (C) 2023 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
import * as request from '../lib/request';
import { arraybuffer_to_string, string_to_arraybuffer } from '../lib/utils';
export function on_init(): void {
const payload = string_to_arraybuffer('hello, handler');
request.post('/test', payload, payload.byteLength, '', (resp) => {
if (resp != null) {
console.log('Post Success');
if (resp.payload != null) {
console.log(' response payload:');
const resp_payload_string = arraybuffer_to_string(
resp.payload,
resp.payload_len,
);
console.log(' ' + resp_payload_string + '\n');
}
} else console.log('Post Timeout');
});
}
export function on_destroy(): void {
// on destory actions
}
================================================
FILE: example/app-framework/app/timer.ts
================================================
/*
* Copyright (C) 2023 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
import * as timer from '../lib/timer';
let cnt = 0;
export function on_init(): void {
/* The callback function will be called every 2 second,
and will stop after 10 calls */
const my_timer = timer.setInterval((my_timer) => {
cnt++;
console.log((cnt * 2).toString() + ' seconds passed');
if (cnt >= 10) {
timer.timer_cancel(my_timer);
console.log('Stop Timer');
}
}, 2000);
}
export function on_destroy(): void {
// on destory actions
}
================================================
FILE: example/app-framework/build.sh
================================================
#
# Copyright (C) 2023 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#!/bin/bash
CURR_DIR=$PWD
WAMR_DIR=${PWD}/../../runtime-library/deps/wamr-gc
PROFILE_DIR=${PWD}/profiles
OUT_DIR=${PWD}/out
WASM_APPS=${PWD}/app
CLEAN=
CM_BUILD_TYPE="-DCMAKE_BUILD_TYPE=Release"
CM_TOOLCHAIN=""
TS2WASM_SCRIPT=${PWD}/../../build/cli/ts2wasm.js
OPT_LEVEL=3
WAMRC=${WAMR_DIR}/wamr-compiler/build/wamrc
usage ()
{
echo "build.sh [options]"
echo " -p [profile]"
echo " -d [target]"
echo " -c, rebuild SDK"
exit 1
}
while getopts "p:dch" opt
do
case $opt in
p)
PROFILE=$OPTARG
;;
d)
CM_BUILD_TYPE="-DCMAKE_BUILD_TYPE=Debug"
;;
c)
CLEAN="TRUE"
;;
h)
usage
exit 1;
;;
?)
echo "Unknown arg: $arg"
usage
exit 1
;;
esac
done
if [ "$CLEAN" = "TRUE" ]; then
rm -rf $CURR_DIR/cmake-build
fi
while [ ! -n "$PROFILE" ]
do
support_profiles=`ls -l "${PROFILE_DIR}" |grep '^d' | awk '{print $9}'`
read -p "Enter build target profile (default=host-interp) -->
$support_profiles
\>:" read_platform
if [ ! -n "$read_platform" ]; then
PROFILE="host-interp"
else
PROFILE=$read_platform
fi
done
ARG_TOOLCHAIN=""
TOOL_CHAIN_FILE=$PROFILE_DIR/$PROFILE/toolchain.cmake
if [ -f $TOOL_CHAIN_FILE ]; then
CM_TOOLCHAIN="-DCMAKE_TOOLCHAIN_FILE=$TOOL_CHAIN_FILE"
ARG_TOOLCHAIN="-t $TOOL_CHAIN_FILE"
echo "toolchain file: $TOOL_CHAIN_FILE"
fi
SDK_CONFIG_FILE=$PROFILE_DIR/$PROFILE/wamr_config_wasmnizer_ts.cmake
if [ ! -f $SDK_CONFIG_FILE ]; then
echo "SDK config file [$SDK_CONFIG_FILE] doesn't exit. quit.."
exit 1
fi
rm -rf ${OUT_DIR}
mkdir ${OUT_DIR}
mkdir ${OUT_DIR}/wasm-apps
cd ${WAMR_DIR}/core/shared/mem-alloc
PROFILE="simple-$PROFILE"
echo "#####################build wamr sdk"
cd ${WAMR_DIR}/wamr-sdk
./build_sdk.sh -n $PROFILE -x $SDK_CONFIG_FILE $ARG_TOOLCHAIN -c
[ $? -eq 0 ] || exit $?
echo "#####################build simple project"
cd ${CURR_DIR}
mkdir -p cmake-build/$PROFILE
cd cmake-build/$PROFILE
cmake ../.. -DWAMR_BUILD_SDK_PROFILE=$PROFILE $CM_TOOLCHAIN $CM_BUILD_TYPE
make
if [ $? != 0 ];then
echo "BUILD_FAIL simple exit as $?\n"
exit 2
fi
cp -a simple ${OUT_DIR}
echo "#####################build simple project success"
echo -e "\n\n"
echo "#####################build host-tool"
cd ${WAMR_DIR}/test-tools/host-tool
mkdir -p bin
cd bin
cmake .. $CM_TOOLCHAIN $CM_BUILD_TYPE
make
if [ $? != 0 ];then
echo "BUILD_FAIL host tool exit as $?\n"
exit 2
fi
cp host_tool ${OUT_DIR}
echo "#####################build host-tool success"
echo -e "\n\n"
echo "#####################build wasm apps"
cd ${WASM_APPS}
for i in `ls *.ts`
do
APP_SRC="$i"
OUT_WASM_FILE=${i%.*}.wasm
OUT_AOT_FILE=${i%.*}.aot
node ${TS2WASM_SCRIPT} ${APP_SRC} --opt ${OPT_LEVEL} --output ${OUT_DIR}/wasm-apps/${OUT_WASM_FILE} --startSection > tmp.txt
$WAMRC --enable-gc -o ${OUT_DIR}/wasm-apps/${OUT_AOT_FILE} ${OUT_DIR}/wasm-apps/${OUT_WASM_FILE} > tmp.txt
if [ -f ${OUT_DIR}/wasm-apps/${OUT_WASM_FILE} ]; then
echo "build ${OUT_WASM_FILE} success"
else
echo "build ${OUT_WASM_FILE} fail"
fi
if [ -f ${OUT_DIR}/wasm-apps/${OUT_AOT_FILE} ]; then
echo "build ${OUT_AOT_FILE} success"
else
echo "build ${OUT_AOT_FILE} fail"
fi
done
rm tmp.txt
echo "#####################build wasm apps done"
================================================
FILE: example/app-framework/lib/attr_container.ts
================================================
/*
* Copyright (C) 2023 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
import { i32, arraybuffer_to_string, string_to_arraybuffer } from './utils';
const ATTR_TYPE_BEGIN = 0,
ATTR_TYPE_BYTE = 0,
ATTR_TYPE_INT8 = 0,
ATTR_TYPE_SHORT = 0,
ATTR_TYPE_INT16 = 1,
ATTR_TYPE_INT = 2,
ATTR_TYPE_INT32 = 2,
ATTR_TYPE_INT64 = 3,
ATTR_TYPE_UINT8 = 4,
ATTR_TYPE_UINT16 = 5,
ATTR_TYPE_UINT32 = 6,
ATTR_TYPE_UINT64 = 7,
/**
* Why ATTR_TYPE_FLOAT = 10?
* We determine the number of bytes that should be copied through 1<<(type &
* 3). ATTR_TYPE_BYTE = 0, so the number of bytes is 1 << 0 = 1.
* ATTR_TYPE_UINT64 = 7, so the number of bytes is 1 << 3 = 8.
* Since the float type takes up 4 bytes, ATTR_TYPE_FLOAT should be 10.
* Calculation: (1 << (10&3)) = (1 << 2) = 4
*/
ATTR_TYPE_FLOAT = 10,
ATTR_TYPE_DOUBLE = 11,
ATTR_TYPE_BOOLEAN = 12,
ATTR_TYPE_STRING = 13,
ATTR_TYPE_BYTEARRAY = 14,
ATTR_TYPE_END = 14;
const ATTR_CONT_READONLY_SHIFT = 2;
export let global_attr_cont: ArrayBuffer;
export function attr_container_create(tag: string) {
const tag_length = tag.length + 1;
const offset_of_buf = 2;
const length = offset_of_buf + 4 + 2 + tag_length + 100;
const attr_buffer = new ArrayBuffer(length);
const dataview = new DataView(attr_buffer);
for (let i = 0; i < length; i++) {
dataview.setUint8(i, 0);
}
let offset = offset_of_buf;
dataview.setUint32(offset, length - offset_of_buf, true);
offset += 4;
dataview.setUint16(offset, tag_length, true);
offset += 2;
for (let i = 0; i < tag.length; i++) {
dataview.setUint8(i + offset, tag.charCodeAt(i));
}
return attr_buffer;
}
export function attr_container_get_serialize_length(args: ArrayBuffer): i32 {
const dataview = new DataView(args);
const buf_value = dataview.getUint32(2, true);
return 2 + buf_value;
}
export function attr_container_set_string(
attr_cont: ArrayBuffer,
key: string,
value: string,
) {
const value_buffer = string_to_arraybuffer(value);
return attr_container_set_attr(
attr_cont,
key,
ATTR_TYPE_STRING,
value_buffer,
value.length + 1,
);
}
export function attr_container_set_uint16(
attr_cont: ArrayBuffer,
key: string,
value: number,
) {
const value_buffer = new ArrayBuffer(2);
const value_dataview = new DataView(value_buffer);
value_dataview.setUint16(0, value, true);
return attr_container_set_attr(
attr_cont,
key,
ATTR_TYPE_UINT16,
value_buffer,
2,
);
}
function check_set_attr(p_attr_cont: ArrayBuffer, key: string) {
if (key.length === 0) {
console.log('Set attribute failed: invalid input arguments.');
return false;
}
const dataview = new DataView(p_attr_cont);
const flags = dataview.getUint32(0, true);
if (flags & ATTR_CONT_READONLY_SHIFT) {
console.log('Set attribute failed: attribute container is readonly.');
return false;
}
return true;
}
export function attr_container_get_attr_begin(attr_cont: ArrayBuffer) {
let p = 2;
const dataview = new DataView(attr_cont);
/* skip total length */
const total_length = dataview.getUint32(p, true);
p += 4;
/* tag length */
const str_len = dataview.getUint16(p, true);
p += 2;
/* tag content */
p += str_len;
/* attribute num */
const attr_num = dataview.getUint16(p, true);
p += 2;
return p;
}
export function attr_container_get_attr_total_length(attr_cont: ArrayBuffer) {
const p = 2;
const dataview = new DataView(attr_cont);
const total_length = dataview.getUint32(p, true);
return total_length;
}
export function attr_container_get_attr_num(attr_cont: ArrayBuffer) {
let p = 2;
const dataview = new DataView(attr_cont);
/* skip total length */
const total_length = dataview.getUint32(p, true);
p += 4;
/* tag length */
const str_len = dataview.getUint16(p, true);
p += 2;
/* tag content */
p += str_len;
/* attribute num */
const attr_num = dataview.getUint16(p, true);
p += 2;
return attr_num;
}
export function attr_container_get_msg_end(attr_cont: ArrayBuffer) {
const p = 2;
const dataview = new DataView(attr_cont);
return p + dataview.getUint32(p, true);
}
export function attr_container_get_attr_next(
attr_cont: ArrayBuffer,
curr_attr_pos: number,
) {
let p = curr_attr_pos;
const dataview = new DataView(attr_cont);
/* key length and key */
p += 2 + dataview.getUint16(p, true);
const type = dataview.getUint8(p);
p++;
/* Byte type to Boolean type */
if (type >= ATTR_TYPE_BYTE && type <= ATTR_TYPE_BOOLEAN) {
p += 1 << (type & 3);
return p;
} else if (type == ATTR_TYPE_STRING) {
/* String type */
p += 2 + dataview.getUint16(p, true);
return p;
} else if (type == ATTR_TYPE_BYTEARRAY) {
/* ByteArray type */
p += 4 + dataview.getUint32(p, true);
return p;
}
}
export function attr_container_get_attr_end(attr_cont: ArrayBuffer) {
let p = attr_container_get_attr_begin(attr_cont);
const attr_num = attr_container_get_attr_num(attr_cont);
for (let i = 0; i < attr_num; i++) {
const tmp = attr_container_get_attr_next(attr_cont, p);
if (tmp === undefined) {
return -1;
} else {
p = tmp;
}
}
return p;
}
export function attr_container_find_attr(attr_cont: ArrayBuffer, key: string) {
let p = 2;
p = attr_container_get_attr_begin(attr_cont);
const attr_num = attr_container_get_attr_num(attr_cont);
const dataview = new DataView(attr_cont);
for (let i = 0; i < attr_num; i++) {
const str_len = dataview.getUint16(p, true);
if (str_len == key.length + 1) {
for (let i = 0; i < key.length; i++) {
dataview.setUint8(p + 2 + i, key.charCodeAt(i));
}
/* string length also includes /0 in C */
dataview.setUint8(p + str_len - 1, 0);
return p;
}
const tmp = attr_container_get_attr_next(attr_cont, p);
if (tmp === undefined) {
return -1;
} else {
p = tmp;
}
}
return -1;
}
function attr_container_inc_attr_num(attr_cont: ArrayBuffer) {
/* skip total length */
let p = 2 + 4;
const dataview = new DataView(attr_cont);
const str_len = dataview.getUint16(p, true);
/* skip tag length and tag */
p += 2 + str_len;
/* attribute num */
const attr_num = dataview.getUint16(p, true) + 1;
dataview.setUint16(p, attr_num, true);
}
export function attr_container_set_attr(
attr_cont: ArrayBuffer,
key: string,
type: number,
value: ArrayBuffer,
value_length: number,
) {
if (!check_set_attr(attr_cont, key)) {
return false;
}
let p = 2;
const dataview = new DataView(attr_cont);
const value_dataview = new DataView(value);
let total_length = dataview.getUint32(p, true);
const attr_end = attr_container_get_attr_end(attr_cont);
if (attr_end === -1) {
console.log('Set attr failed: get attr end failed.');
return false;
}
const msg_end = attr_container_get_msg_end(attr_cont);
/* key len + key + '\0' + type */
let attr_len = 2 + key.length + 1 + 1;
if (type >= ATTR_TYPE_BYTE && type <= ATTR_TYPE_BOOLEAN)
attr_len += 1 << (type & 3);
else if (type == ATTR_TYPE_STRING) attr_len += 2 + value_length;
else if (type == ATTR_TYPE_BYTEARRAY) attr_len += 4 + value_length;
const attr_buf = new ArrayBuffer(attr_len);
const attr_buf_dataview = new DataView(attr_buf);
p = 0;
/* Set the attr buf */
const str_len = key.length + 1;
attr_buf_dataview.setUint16(p, str_len, true);
p += 2;
for (let i = 0; i < key.length; i++) {
attr_buf_dataview.setUint8(i + p, key.charCodeAt(i));
}
/* string length also includes /0 in C */
attr_buf_dataview.setUint8(p + str_len - 1, 0);
p += str_len;
attr_buf_dataview.setUint8(p, type);
p++;
if (type >= ATTR_TYPE_BYTE && type <= ATTR_TYPE_BOOLEAN) {
const len = 1 << (type & 3);
for (let i = 0; i < len; i++) {
attr_buf_dataview.setUint8(p + i, value_dataview.getUint8(i));
}
} else if (type == ATTR_TYPE_STRING) {
attr_buf_dataview.setUint16(p, value_length, true);
p += 2;
for (let i = 0; i < value_dataview.byteLength; i++) {
attr_buf_dataview.setUint8(p + i, value_dataview.getUint8(i));
}
/* string length also includes /0 in C */
attr_buf_dataview.setUint8(p + value_length - 1, 0);
} else if (type == ATTR_TYPE_BYTEARRAY) {
attr_buf_dataview.setUint32(p, value_length, true);
p += 4;
for (let i = 0; i < value_dataview.byteLength; i++) {
attr_buf_dataview.setUint8(p + i, value_dataview.getUint8(i));
}
/* string length also includes /0 in C */
attr_buf_dataview.setUint8(p + value_length - 1, 0);
}
p = attr_container_find_attr(attr_cont, key);
if (p !== -1) {
/* key found */
const p1 = attr_container_get_attr_next(attr_cont, p)!;
if (p1 - p == attr_len) {
for (let i = 0; i < attr_len; i++) {
dataview.setUint8(i + p, attr_buf_dataview.getUint8(i));
}
global_attr_cont = attr_cont;
return true;
}
if (p1 - p + msg_end - attr_end >= attr_len) {
for (let i = 0; i < attr_end - p1; i++) {
dataview.setUint8(p + i, dataview.getUint8(p1 + i));
}
for (let i = 0; i < attr_len; i++) {
dataview.setUint8(
i + p + (attr_end - p1),
attr_buf_dataview.getUint8(i),
);
}
global_attr_cont = attr_cont;
return true;
}
total_length += attr_len + 100;
const attr_cont1 = new ArrayBuffer(2 + total_length);
const attr_cont1_dataview = new DataView(attr_cont1);
for (let i = 0; i < p; i++) {
attr_cont1_dataview.setUint8(i, dataview.getUint8(i));
}
for (let i = 0; i < attr_end - p1; i++) {
attr_cont1_dataview.setUint8(i + p, dataview.getUint8(i + p1));
}
for (let i = 0; i < attr_len; i++) {
attr_cont1_dataview.setUint8(
i + p + attr_end - p1,
attr_buf_dataview.getUint8(i),
);
}
p = 2;
attr_cont1_dataview.setUint32(p, total_length, true);
global_attr_cont = attr_cont1;
return true;
} else {
/* key not found */
if (msg_end - attr_end >= attr_len) {
for (let i = 0; i < attr_len; i++) {
dataview.setUint8(i + attr_end, attr_buf_dataview.getUint8(i));
}
attr_container_inc_attr_num(attr_cont);
global_attr_cont = attr_cont;
return true;
}
total_length += attr_len + 100;
const attr_cont1 = new ArrayBuffer(2 + total_length);
const attr_cont1_dataview = new DataView(attr_cont1);
for (let i = 0; i < attr_end; i++) {
attr_cont1_dataview.setUint8(i, dataview.getUint8(i));
}
for (let i = 0; i < attr_len; i++) {
attr_cont1_dataview.setUint8(
i + attr_end,
attr_buf_dataview.getUint8(i),
);
}
attr_container_inc_attr_num(attr_cont1);
p = 2;
attr_cont1_dataview.setUint32(p, total_length, true);
global_attr_cont = attr_cont1;
return true;
}
}
================================================
FILE: example/app-framework/lib/connection.ts
================================================
/*
* Copyright (C) 2023 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
import { i32, arraybuffer_to_string, string_to_arraybuffer } from './utils';
import { attr_container_get_serialize_length } from './attr_container';
// Wasmnizer-ts: @NativeSignature@ (i32, i32, i32)=>boolean
declare function wasm_open_connection(
name: string,
args_buf: ArrayBuffer,
args_buf_len: i32,
): i32;
declare function wasm_close_connection(handle: i32): void;
// Wasmnizer-ts: @NativeSignature@ (i32, i32, i32)=>boolean
declare function wasm_send_on_connection(
handle: i32,
data: ArrayBuffer,
data_len: i32,
): i32;
// Wasmnizer-ts: @NativeSignature@ (i32, i32, i32)=>boolean
declare function wasm_config_connection(
handle: i32,
cfg_buf: ArrayBuffer,
cfg_buf_len: i32,
): i32;
export const /* Data is received */
CONN_EVENT_TYPE_DATA = 1,
/* Connection is disconnected */
CONN_EVENT_TYPE_DISCONNECT = 2;
export type on_connection_event_f = (
conn: wamr_connection,
type: number,
data: string,
len: number,
) => void;
export class wamr_connection {
handle: i32;
on_event: on_connection_event_f;
constructor(handle: i32, on_event: on_connection_event_f) {
this.handle = handle;
this.on_event = on_event;
}
}
const connection_list = new Array<wamr_connection>();
export function open_connection(
name: string,
args: ArrayBuffer,
on_event: on_connection_event_f,
): wamr_connection | null {
const args_len: i32 = attr_container_get_serialize_length(args);
const handle = wasm_open_connection(name, args, args_len);
if (handle === -1) {
return null;
}
const conn = new wamr_connection(handle, on_event);
connection_list.push(conn);
return conn;
}
export function close_connection(c: wamr_connection) {
for (let i = 0; i < connection_list.length; i++) {
if (connection_list[i] === c) {
wasm_close_connection(c.handle);
connection_list.splice(i, 1);
return;
}
}
}
export function send_on_connection(
conn: wamr_connection,
data: string,
len: i32,
) {
const data_buffer = string_to_arraybuffer(data);
return wasm_send_on_connection(conn.handle, data_buffer, len);
}
export function config_connection(conn: wamr_connection, cfg: ArrayBuffer) {
const cfg_len: i32 = attr_container_get_serialize_length(cfg);
return wasm_config_connection(conn.handle, cfg, cfg_len);
}
// Wasmnizer-ts: @NativeSignature@ (i32, i32, i32)=>void
// Wasmnizer-ts: @Export@ _on_connection_data
export function on_connection_data(handle: i32, buffer: ArrayBuffer, len: i32) {
for (let i = 0; i < connection_list.length; i++) {
const conn = connection_list[i];
if (conn.handle === handle) {
if (len === 0) {
conn.on_event(conn, CONN_EVENT_TYPE_DISCONNECT, '', len);
} else {
const buffer_str = arraybuffer_to_string(buffer, len);
conn.on_event(conn, CONN_EVENT_TYPE_DATA, buffer_str, len);
}
return;
}
}
}
================================================
FILE: example/app-framework/lib/request.ts
================================================
/*
* Copyright (C) 2023 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
import * as timer from './timer';
import { i32, arraybuffer_to_string, string_to_arraybuffer } from './utils';
// Wasmnizer-ts: @NativeSignature@ (i32, i32)=>boolean
declare function wasm_response_send(buffer: ArrayBuffer, size: i32): boolean;
// Wasmnizer-ts: @NativeSignature@ (i32)=>void
declare function wasm_register_resource(url: ArrayBuffer): void;
// Wasmnizer-ts: @NativeSignature@ (i32, i32)=>void
declare function wasm_post_request(buffer: ArrayBuffer, size: i32): void;
// Wasmnizer-ts: @NativeSignature@ (i32)=>void
declare function wasm_sub_event(url: ArrayBuffer): void;
const COAP_GET = 1;
const COAP_POST = 2;
const COAP_PUT = 3;
const COAP_DELETE = 4;
const COAP_EVENT = COAP_DELETE + 2;
/* CoAP response codes */
export enum CoAP_Status {
NO_ERROR = 0,
CREATED_2_01 = 65 /* CREATED
gitextract_uq_06no8/ ├── .c8rc.json ├── .clang-format ├── .clang-tidy ├── .devcontainer/ │ ├── .dockerignore │ ├── Dockerfile │ ├── devcontainer.json │ └── docker-compose.yml ├── .dockerignore ├── .eslintignore ├── .eslintrc.json ├── .github/ │ └── workflows/ │ ├── benchmark.yml │ ├── build_llvm_libraries.yml │ ├── libdyntype_ci.yaml │ ├── ts2wasm_aot.yml │ ├── ts2wasm_ci.yaml │ ├── ts2wasm_macos.yml │ └── ts2wasm_windows.yml ├── .gitignore ├── .mocharc.json ├── .prettierignore ├── .prettierrc.json ├── ATTRIBUTIONS.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── cli/ │ ├── options.json │ └── ts2wasm.ts ├── config/ │ ├── config_mgr.ts │ └── log4js.ts ├── doc/ │ ├── additonal_sematic_check.md │ ├── architecture.md │ ├── dev_environment.md │ ├── developer-guide/ │ │ ├── any_object.md │ │ ├── basic_concepts.md │ │ ├── class.md │ │ ├── expose_host_API.md │ │ ├── fallback.md │ │ ├── feature_list.md │ │ ├── function.md │ │ ├── generic.md │ │ ├── import_export.md │ │ ├── index.md │ │ ├── interface.md │ │ └── wasmType_usage.md │ ├── environment_variables.md │ ├── faq.md │ ├── getting_started.md │ ├── libdyntype_api_spec.md │ ├── libstruct_indirect_api_spec.md │ ├── standard-library/ │ │ ├── array.md │ │ ├── console.md │ │ ├── index.md │ │ ├── math.md │ │ └── string.md │ └── validation_strategy.md ├── example/ │ └── app-framework/ │ ├── CMakeLists.txt │ ├── app/ │ │ ├── connection.ts │ │ ├── request_handler.ts │ │ ├── request_sender.ts │ │ └── timer.ts │ ├── build.sh │ ├── lib/ │ │ ├── attr_container.ts │ │ ├── connection.ts │ │ ├── request.ts │ │ ├── timer.ts │ │ └── utils.ts │ ├── profiles/ │ │ ├── host-aot/ │ │ │ └── wamr_config_wasmnizer_ts.cmake │ │ └── host-interp/ │ │ └── wamr_config_wasmnizer_ts.cmake │ └── src/ │ ├── iwasm_main.c │ └── main.c ├── lib/ │ └── builtin/ │ ├── builtin_name.ts │ ├── lib.type.d.ts │ └── lib_builtin.ts ├── package.json ├── runtime-library/ │ ├── CMakeLists.txt │ ├── LICENSE │ ├── README.md │ ├── build.sh │ ├── deps/ │ │ ├── .gitignore │ │ └── download.sh │ ├── libdyntype/ │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── dynamic-qjs/ │ │ │ ├── context.c │ │ │ ├── fallback.c │ │ │ ├── object.c │ │ │ ├── pure_dynamic.h │ │ │ └── type.h │ │ ├── dynamic-simple/ │ │ │ ├── README.md │ │ │ ├── context.c │ │ │ ├── dyn-value/ │ │ │ │ ├── README.md │ │ │ │ ├── class/ │ │ │ │ │ ├── date.c │ │ │ │ │ ├── dyn_class.c │ │ │ │ │ ├── dyn_class.h │ │ │ │ │ ├── object.c │ │ │ │ │ └── string.c │ │ │ │ ├── dyn_value.c │ │ │ │ └── dyn_value.h │ │ │ ├── fallback.c │ │ │ ├── object.c │ │ │ └── pure_dynamic.h │ │ ├── extref/ │ │ │ ├── extref.c │ │ │ └── extref.h │ │ ├── lib_dyntype_wrapper.c │ │ ├── libdyntype.c │ │ ├── libdyntype.cmake │ │ ├── libdyntype.h │ │ ├── libdyntype_export.h │ │ └── test/ │ │ ├── CMakeLists.txt │ │ ├── dump.cc │ │ ├── object_property_test.cc │ │ ├── operator_test.cc │ │ ├── prototype_test.cc │ │ ├── test_app.h │ │ └── types_test.cc │ ├── main.c │ ├── stdlib/ │ │ ├── lib_array.c │ │ ├── lib_console.c │ │ └── lib_timer.c │ ├── stringref/ │ │ ├── README.md │ │ ├── stringref_qjs.c │ │ └── stringref_simple.c │ ├── struct-indirect/ │ │ ├── lib_struct_indirect.c │ │ └── lib_struct_indirect.h │ ├── utils/ │ │ ├── object_utils.c │ │ ├── object_utils.h │ │ ├── type_utils.c │ │ ├── type_utils.h │ │ ├── wamr_utils.c │ │ └── wamr_utils.h │ └── wamr_config.cmake ├── scripts/ │ ├── LICENSE.txt │ ├── copy_lib_files.js │ ├── gdb/ │ │ ├── .gitignore │ │ ├── constants.py │ │ ├── utils.py │ │ ├── wamr_dbg.py │ │ ├── wamr_exec_env.py │ │ ├── wamr_objects.py │ │ └── wamr_types.py │ ├── hooks/ │ │ └── pre-commit │ └── link_hooks.js ├── security.md ├── src/ │ ├── backend/ │ │ ├── README.md │ │ ├── binaryen/ │ │ │ ├── glue/ │ │ │ │ ├── LICENSE │ │ │ │ ├── NOTICE │ │ │ │ ├── binaryen.d.ts │ │ │ │ ├── binaryen.js │ │ │ │ ├── packType.ts │ │ │ │ ├── transform.ts │ │ │ │ └── utils.ts │ │ │ ├── index.ts │ │ │ ├── lib/ │ │ │ │ ├── array_utils.ts │ │ │ │ ├── dyntype/ │ │ │ │ │ └── utils.ts │ │ │ │ ├── env_init.ts │ │ │ │ ├── init_builtin_api.ts │ │ │ │ └── interface/ │ │ │ │ └── meta.c │ │ │ ├── memory.ts │ │ │ ├── utils.ts │ │ │ ├── wasm_expr_gen.ts │ │ │ ├── wasm_stmt_gen.ts │ │ │ └── wasm_type_gen.ts │ │ └── index.ts │ ├── dump_ast.ts │ ├── error.ts │ ├── expression.ts │ ├── frontend.ts │ ├── import_resolve.ts │ ├── log.ts │ ├── scope.ts │ ├── semantic_check.ts │ ├── semantics/ │ │ ├── builder_context.ts │ │ ├── builtin.ts │ │ ├── dump.ts │ │ ├── expression_builder.ts │ │ ├── flatten.ts │ │ ├── index.ts │ │ ├── internal.ts │ │ ├── ir/ │ │ │ ├── data_pool.ts │ │ │ ├── function.ts │ │ │ ├── ir_context.ts │ │ │ ├── ircode.ts │ │ │ └── irmodule.ts │ │ ├── predefined_types.ts │ │ ├── runtime.ts │ │ ├── semantics_nodes.ts │ │ ├── statement_builder.ts │ │ ├── type_creator.ts │ │ ├── value.ts │ │ └── value_types.ts │ ├── statement.ts │ ├── type.ts │ ├── utils.ts │ └── variable.ts ├── tests/ │ ├── benchmark/ │ │ ├── README.md │ │ ├── any_basic_type_access.js │ │ ├── any_basic_type_access.ts │ │ ├── any_complex_type_access.js │ │ ├── any_complex_type_access.ts │ │ ├── array_access.js │ │ ├── array_access.ts │ │ ├── array_access_i32.js │ │ ├── array_access_i32.ts │ │ ├── binarytrees_class.js │ │ ├── binarytrees_class.ts │ │ ├── binarytrees_interface.js │ │ ├── binarytrees_interface.ts │ │ ├── class_access.js │ │ ├── class_access.ts │ │ ├── class_allocation.js │ │ ├── class_allocation.ts │ │ ├── compile_benchmark.js │ │ ├── fibonacci.js │ │ ├── fibonacci.ts │ │ ├── interface_access_field_fastpath.js │ │ ├── interface_access_field_fastpath.ts │ │ ├── interface_access_field_slowpath.js │ │ ├── interface_access_field_slowpath.ts │ │ ├── interface_access_method_fastpath.js │ │ ├── interface_access_method_fastpath.ts │ │ ├── interface_access_method_slowpath.js │ │ ├── interface_access_method_slowpath.ts │ │ ├── mandelbrot.js │ │ ├── mandelbrot.ts │ │ ├── mandelbrot_i32.js │ │ ├── mandelbrot_i32.ts │ │ ├── merkletrees.js │ │ ├── merkletrees.ts │ │ ├── nbody_class.js │ │ ├── nbody_class.ts │ │ ├── nbody_interface.js │ │ ├── nbody_interface.ts │ │ ├── quicksort.js │ │ ├── quicksort.ts │ │ ├── quicksort_float.js │ │ ├── quicksort_float.ts │ │ ├── run.sh │ │ ├── run_benchmark.js │ │ ├── run_benchmark_on_chrome.html │ │ ├── run_benchmark_on_chrome.js │ │ ├── spectral_norm.js │ │ ├── spectral_norm.ts │ │ ├── spectral_norm_i32.js │ │ └── spectral_norm_i32.ts │ ├── samples/ │ │ ├── add_shorthand_prop.ts │ │ ├── any_as_string.ts │ │ ├── any_binary_operation.ts │ │ ├── any_box_any.ts │ │ ├── any_box_array.ts │ │ ├── any_box_boolean.ts │ │ ├── any_box_interface.ts │ │ ├── any_box_null.ts │ │ ├── any_box_number.ts │ │ ├── any_box_obj.ts │ │ ├── any_box_obj_as_return_value.ts │ │ ├── any_box_string.ts │ │ ├── any_box_undefind.ts │ │ ├── any_cast_class.ts │ │ ├── any_func_call.ts │ │ ├── any_nested_literal_value.ts │ │ ├── any_obj_prop_get.ts │ │ ├── any_obj_prop_get_as_string.ts │ │ ├── any_obj_prop_set.ts │ │ ├── any_operate_with_static.ts │ │ ├── array_concat.ts │ │ ├── array_contain_closure.ts │ │ ├── array_contain_func.ts │ │ ├── array_copyWithin.ts │ │ ├── array_elem_get.ts │ │ ├── array_elem_set.ts │ │ ├── array_every.ts │ │ ├── array_fill.ts │ │ ├── array_filter.ts │ │ ├── array_find.ts │ │ ├── array_findIndex.ts │ │ ├── array_foreach.ts │ │ ├── array_includes.ts │ │ ├── array_indexOf.ts │ │ ├── array_join.ts │ │ ├── array_lastIndexOf.ts │ │ ├── array_map.ts │ │ ├── array_nested_array.ts │ │ ├── array_nested_literal.ts │ │ ├── array_nested_literal_array.ts │ │ ├── array_new_array.ts │ │ ├── array_new_array_number.ts │ │ ├── array_new_array_string.ts │ │ ├── array_new_literal_any.ts │ │ ├── array_new_literal_boolean.ts │ │ ├── array_new_literal_number.ts │ │ ├── array_new_literal_string.ts │ │ ├── array_pop.ts │ │ ├── array_push.ts │ │ ├── array_reduce.ts │ │ ├── array_reduceRight.ts │ │ ├── array_reverse.ts │ │ ├── array_shift.ts │ │ ├── array_slice.ts │ │ ├── array_some.ts │ │ ├── array_sort.ts │ │ ├── array_specialization.ts │ │ ├── array_splice.ts │ │ ├── array_unshift.ts │ │ ├── array_wasm_basic_type.ts │ │ ├── arraybuffer_basic.ts │ │ ├── assign_different_type.ts │ │ ├── auto_box_unbox.ts │ │ ├── base_function_call.ts │ │ ├── block_closure.ts │ │ ├── block_inner_block.ts │ │ ├── boolean_basic.ts │ │ ├── boolean_logic_operator.ts │ │ ├── boolean_not.ts │ │ ├── builtin_array.ts │ │ ├── builtin_console.ts │ │ ├── builtin_math.ts │ │ ├── builtin_string.ts │ │ ├── call_expression_function_hoisting.ts │ │ ├── call_expression_get_value.ts │ │ ├── call_expression_param.ts │ │ ├── cast_any_to_static.ts │ │ ├── class_accessor.ts │ │ ├── class_basic.ts │ │ ├── class_direct_call.ts │ │ ├── class_extend.ts │ │ ├── class_field_assign.ts │ │ ├── class_field_is_array.ts │ │ ├── class_static_prop.ts │ │ ├── class_type.ts │ │ ├── class_vtable_accessor.ts │ │ ├── class_vtable_call.ts │ │ ├── closure_basic.ts │ │ ├── closure_first_class_func.ts │ │ ├── closure_inner_func.ts │ │ ├── closure_set_ctx_value.ts │ │ ├── comments_not_entry.ts │ │ ├── comments_with_export.ts │ │ ├── comments_with_import.ts │ │ ├── complexType_case1.ts │ │ ├── complexType_case2.ts │ │ ├── complexType_case3.ts │ │ ├── complexType_case4.ts │ │ ├── complexType_case5.ts │ │ ├── compound_assignment_operator.ts │ │ ├── dataview_basic.ts │ │ ├── decimalization.ts │ │ ├── declare_class.ts │ │ ├── declare_func.ts │ │ ├── declare_namespace.ts │ │ ├── declare_var.ts │ │ ├── default_param.ts │ │ ├── enum.ts │ │ ├── exception_catch_error.ts │ │ ├── exception_custom_error.ts │ │ ├── exception_throw_error.ts │ │ ├── exception_try_structure.ts │ │ ├── export_alias_identifier.ts │ │ ├── export_alias_imported_identifier.ts │ │ ├── export_class.ts │ │ ├── export_expression_number_literal.ts │ │ ├── export_expression_obj_literal.ts │ │ ├── export_from/ │ │ │ ├── classB.ts │ │ │ └── libA/ │ │ │ ├── index.ts │ │ │ └── lib/ │ │ │ └── classA.ts │ │ ├── export_func.ts │ │ ├── export_func2.ts │ │ ├── export_func_invoked.ts │ │ ├── export_implicit_type.ts │ │ ├── export_namespace.ts │ │ ├── export_re_export.ts │ │ ├── export_type.ts │ │ ├── export_var.ts │ │ ├── expression_binary.ts │ │ ├── expression_binary_select.ts │ │ ├── expression_condition.ts │ │ ├── expression_unary.ts │ │ ├── fallback_quickjs.ts │ │ ├── fallback_quickjs_Date.ts │ │ ├── fallback_quickjs_JSON.ts │ │ ├── for_in.ts │ │ ├── for_of.ts │ │ ├── func_cast_interface.ts │ │ ├── function_declaration.ts │ │ ├── function_expression.ts │ │ ├── function_scope_var.ts │ │ ├── generic_class.ts │ │ ├── generic_func.ts │ │ ├── generic_param.ts │ │ ├── global_generics_function.ts │ │ ├── global_value.ts │ │ ├── global_variables.ts │ │ ├── if_statement_case1.ts │ │ ├── ignore_parameter_in_variable.ts │ │ ├── import_alias_identifier.ts │ │ ├── import_alias_reexport_identifier.ts │ │ ├── import_alias_scope_identifier.ts │ │ ├── import_class.ts │ │ ├── import_expression.ts │ │ ├── import_func.ts │ │ ├── import_implicit_type.ts │ │ ├── import_namespace.ts │ │ ├── import_type.ts │ │ ├── import_var.ts │ │ ├── infc_assign_class.ts │ │ ├── infc_assign_infc.ts │ │ ├── infc_assign_obj.ts │ │ ├── infc_case18.ts │ │ ├── infc_field_assign.ts │ │ ├── infc_method.ts │ │ ├── infc_parameter.ts │ │ ├── infc_return_value.ts │ │ ├── infc_with_array.ts │ │ ├── inner_generics_function.ts │ │ ├── instanceof.ts │ │ ├── lib.ts │ │ ├── loop_do_while.ts │ │ ├── loop_for.ts │ │ ├── loop_while.ts │ │ ├── map_callback.ts │ │ ├── mixed_type.ts │ │ ├── module-case/ │ │ │ ├── export_declare.ts │ │ │ ├── export_normal.ts │ │ │ └── import_case1.ts │ │ ├── module_start_A.ts │ │ ├── module_start_B.ts │ │ ├── module_start_C.ts │ │ ├── namespace_func.ts │ │ ├── namespace_generics_function.ts │ │ ├── namespace_nest.ts │ │ ├── namespace_var.ts │ │ ├── nest_generic.ts │ │ ├── non_null_expression.ts │ │ ├── null_type_case1.ts │ │ ├── obj_literal.ts │ │ ├── obj_method_call.ts │ │ ├── obj_property_access.ts │ │ ├── obj_property_dynamic_access.ts │ │ ├── op_ref_type.ts │ │ ├── optional_method.ts │ │ ├── optional_param.ts │ │ ├── optional_property_access.ts │ │ ├── parenthesized_expression_case1.ts │ │ ├── percentToken.ts │ │ ├── primitiveType.ts │ │ ├── promise_chain.ts │ │ ├── promise_constructor.ts │ │ ├── promise_immediate.ts │ │ ├── promise_throw.ts │ │ ├── prototype.ts │ │ ├── rec_types.ts │ │ ├── ref_type_cmp.ts │ │ ├── rest_param_interface.ts │ │ ├── rest_param_number.ts │ │ ├── return_statement.ts │ │ ├── sample_cases.test.ts │ │ ├── scoped_variables.ts │ │ ├── shorthand_prop_assign.ts │ │ ├── spread_operator.ts │ │ ├── string_binary_operation.ts │ │ ├── string_or.ts │ │ ├── string_type.ts │ │ ├── switch_case_statement.ts │ │ ├── this_in_closure.ts │ │ ├── this_in_method.ts │ │ ├── toString.ts │ │ ├── top_level_statements.ts │ │ ├── tuple.ts │ │ ├── typealias.ts │ │ ├── typeof.ts │ │ ├── unary_operator.ts │ │ ├── undefined_test.ts │ │ ├── union_assign.ts │ │ ├── union_field_get.ts │ │ ├── union_func_call.ts │ │ ├── unsigned_value.ts │ │ ├── wasmType_basic.ts │ │ ├── wasmType_heapType.ts │ │ └── wasmType_in_otherType.ts │ ├── unit/ │ │ ├── comment.test.ts │ │ ├── expression.test.ts │ │ ├── scope.test.ts │ │ ├── statement.test.ts │ │ ├── type.test.ts │ │ └── variable.test.ts │ └── utils/ │ └── test_helper.ts ├── tools/ │ └── validate/ │ ├── run_module/ │ │ ├── import_object.js │ │ ├── readme.md │ │ ├── run_module_on_chrome.html │ │ ├── run_module_on_chrome.js │ │ └── run_module_on_node.js │ └── wamr/ │ ├── .gitignore │ ├── README.md │ ├── create_validation_items.ts │ ├── index.ts │ ├── package.json │ ├── tsconfig.json │ └── validation.json ├── tsconfig.json └── tsconfig.release.json
Showing preview only (327K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (4663 symbols across 373 files)
FILE: cli/ts2wasm.ts
type HelpMessageCategory (line 21) | interface HelpMessageCategory {
function isRegularFile (line 29) | function isRegularFile(filePath: string) {
function validateFilePath (line 37) | function validateFilePath(filePath: string) {
function parseOptions (line 44) | function parseOptions() {
function showVersion (line 53) | function showVersion() {
function showHelp (line 64) | function showHelp(helpConfig: any) {
function writeFile (line 146) | function writeFile(filename: string, contents: any, baseDir = '.') {
function getAbsolutePath (line 160) | function getAbsolutePath(filename: string, baseDir = '') {
function validateByWAMR (line 170) | function validateByWAMR(cmdArgs: string[]) {
function createBackend (line 181) | function createBackend(args: any, parserCtx: ParserContext): Ts2wasmBack...
function readCfgFromCli (line 186) | function readCfgFromCli(args: minimist.ParsedArgs) {
function main (line 197) | function main() {
FILE: config/config_mgr.ts
type ConfigMgr (line 6) | interface ConfigMgr {
function setConfig (line 30) | function setConfig(config: Partial<ConfigMgr>): void {
function getConfig (line 34) | function getConfig(): ConfigMgr {
FILE: example/app-framework/app/connection.ts
function timer1_update (line 14) | function timer1_update(my_timer: timer.user_timer) {
function on_init (line 20) | function on_init(): void {
function on_destroy (line 71) | function on_destroy(): void {
FILE: example/app-framework/app/request_handler.ts
function on_init (line 9) | function on_init(): void {
function on_destroy (line 26) | function on_destroy(): void {
FILE: example/app-framework/app/request_sender.ts
function on_init (line 9) | function on_init(): void {
function on_destroy (line 27) | function on_destroy(): void {
FILE: example/app-framework/app/timer.ts
function on_init (line 10) | function on_init(): void {
function on_destroy (line 24) | function on_destroy(): void {
FILE: example/app-framework/lib/attr_container.ts
constant ATTR_TYPE_BEGIN (line 8) | const ATTR_TYPE_BEGIN = 0,
constant ATTR_TYPE_BYTE (line 8) | const ATTR_TYPE_BEGIN = 0,
constant ATTR_TYPE_INT8 (line 8) | const ATTR_TYPE_BEGIN = 0,
constant ATTR_TYPE_SHORT (line 8) | const ATTR_TYPE_BEGIN = 0,
constant ATTR_TYPE_INT16 (line 8) | const ATTR_TYPE_BEGIN = 0,
constant ATTR_TYPE_INT (line 8) | const ATTR_TYPE_BEGIN = 0,
constant ATTR_TYPE_INT32 (line 8) | const ATTR_TYPE_BEGIN = 0,
constant ATTR_TYPE_INT64 (line 8) | const ATTR_TYPE_BEGIN = 0,
constant ATTR_TYPE_UINT8 (line 8) | const ATTR_TYPE_BEGIN = 0,
constant ATTR_TYPE_UINT16 (line 8) | const ATTR_TYPE_BEGIN = 0,
constant ATTR_TYPE_UINT32 (line 8) | const ATTR_TYPE_BEGIN = 0,
constant ATTR_TYPE_UINT64 (line 8) | const ATTR_TYPE_BEGIN = 0,
constant ATTR_TYPE_FLOAT (line 8) | const ATTR_TYPE_BEGIN = 0,
constant ATTR_TYPE_DOUBLE (line 8) | const ATTR_TYPE_BEGIN = 0,
constant ATTR_TYPE_BOOLEAN (line 8) | const ATTR_TYPE_BEGIN = 0,
constant ATTR_TYPE_STRING (line 8) | const ATTR_TYPE_BEGIN = 0,
constant ATTR_TYPE_BYTEARRAY (line 8) | const ATTR_TYPE_BEGIN = 0,
constant ATTR_TYPE_END (line 8) | const ATTR_TYPE_BEGIN = 0,
constant ATTR_CONT_READONLY_SHIFT (line 35) | const ATTR_CONT_READONLY_SHIFT = 2;
function attr_container_create (line 38) | function attr_container_create(tag: string) {
function attr_container_get_serialize_length (line 59) | function attr_container_get_serialize_length(args: ArrayBuffer): i32 {
function attr_container_set_string (line 65) | function attr_container_set_string(
function attr_container_set_uint16 (line 80) | function attr_container_set_uint16(
function check_set_attr (line 97) | function check_set_attr(p_attr_cont: ArrayBuffer, key: string) {
function attr_container_get_attr_begin (line 111) | function attr_container_get_attr_begin(attr_cont: ArrayBuffer) {
function attr_container_get_attr_total_length (line 129) | function attr_container_get_attr_total_length(attr_cont: ArrayBuffer) {
function attr_container_get_attr_num (line 136) | function attr_container_get_attr_num(attr_cont: ArrayBuffer) {
function attr_container_get_msg_end (line 153) | function attr_container_get_msg_end(attr_cont: ArrayBuffer) {
function attr_container_get_attr_next (line 159) | function attr_container_get_attr_next(
function attr_container_get_attr_end (line 185) | function attr_container_get_attr_end(attr_cont: ArrayBuffer) {
function attr_container_find_attr (line 199) | function attr_container_find_attr(attr_cont: ArrayBuffer, key: string) {
function attr_container_inc_attr_num (line 225) | function attr_container_inc_attr_num(attr_cont: ArrayBuffer) {
function attr_container_set_attr (line 239) | function attr_container_set_attr(
FILE: example/app-framework/lib/connection.ts
constant CONN_EVENT_TYPE_DATA (line 32) | const /* Data is received */
constant CONN_EVENT_TYPE_DISCONNECT (line 32) | const /* Data is received */
type on_connection_event_f (line 37) | type on_connection_event_f = (
class wamr_connection (line 44) | class wamr_connection {
method constructor (line 48) | constructor(handle: i32, on_event: on_connection_event_f) {
function open_connection (line 56) | function open_connection(
function close_connection (line 71) | function close_connection(c: wamr_connection) {
function send_on_connection (line 81) | function send_on_connection(
function config_connection (line 90) | function config_connection(conn: wamr_connection, cfg: ArrayBuffer) {
function on_connection_data (line 97) | function on_connection_data(handle: i32, buffer: ArrayBuffer, len: i32) {
FILE: example/app-framework/lib/request.ts
constant COAP_GET (line 21) | const COAP_GET = 1;
constant COAP_POST (line 22) | const COAP_POST = 2;
constant COAP_PUT (line 23) | const COAP_PUT = 3;
constant COAP_DELETE (line 24) | const COAP_DELETE = 4;
constant COAP_EVENT (line 25) | const COAP_EVENT = COAP_DELETE + 2;
type CoAP_Status (line 28) | enum CoAP_Status {
constant REQUEST_PACKET_FIX_PART_LEN (line 67) | const REQUEST_PACKET_FIX_PART_LEN = 18;
constant RESPONSE_PACKET_FIX_PART_LEN (line 68) | const RESPONSE_PACKET_FIX_PART_LEN = 16;
constant TRANSACTION_TIMEOUT_MS (line 69) | const TRANSACTION_TIMEOUT_MS = 5000;
class wamr_request (line 75) | class wamr_request {
method constructor (line 85) | constructor(
class wamr_response (line 102) | class wamr_response {
method constructor (line 111) | constructor(
method set_status (line 125) | set_status(status: i32): void {
method set_payload (line 129) | set_payload(payload: ArrayBuffer, payload_len: i32): void {
method set_response (line 134) | set_response(
class wamr_resource (line 147) | class wamr_resource {
method constructor (line 152) | constructor(url: string, type: number, cb: request_handler_f) {
function is_expire (line 159) | function is_expire(
function not_expire (line 174) | function not_expire(
function transaction_timeout_handler (line 189) | function transaction_timeout_handler(my_timer: timer.user_timer): void {
function transaction_find (line 215) | function transaction_find(mid: number): wamr_transaction | null {
function transaction_add (line 222) | function transaction_add(trans: wamr_transaction): void {
function transaction_remove (line 233) | function transaction_remove(trans: wamr_transaction): void {
class wamr_transaction (line 238) | class wamr_transaction {
method constructor (line 243) | constructor(
function pack_request (line 254) | function pack_request(req: wamr_request): DataView {
function unpack_request (line 283) | function unpack_request(packet: ArrayBuffer, size: i32): wamr_request {
function pack_response (line 325) | function pack_response(resp: wamr_response): DataView {
function unpack_response (line 348) | function unpack_response(packet: ArrayBuffer, size: i32): wamr_response {
function do_request (line 373) | function do_request(
function do_response (line 385) | function do_response(resp: wamr_response): void {
type request_handler_f (line 392) | type request_handler_f = (req: wamr_request) => void;
function register_url_handler (line 394) | function register_url_handler(
function is_event_type (line 414) | function is_event_type(req: wamr_request): boolean {
function check_url_start (line 418) | function check_url_start(url: string, leading_str: string): boolean {
function post (line 423) | function post(
function get (line 443) | function get(
function put (line 461) | function put(
function del (line 474) | function del(
function make_response_for_request (line 492) | function make_response_for_request(req: wamr_request): wamr_response {
function api_response_send (line 505) | function api_response_send(resp: wamr_response): void {
function register_resource_handler (line 509) | function register_resource_handler(
function publish_event (line 516) | function publish_event(
function subscribe_event (line 537) | function subscribe_event(url: string, cb: request_handler_f): void {
function on_request (line 543) | function on_request(buffer: ArrayBuffer, size: i32): void {
function on_response (line 565) | function on_response(buffer: ArrayBuffer, size: i32): void {
FILE: example/app-framework/lib/timer.ts
class user_timer (line 18) | class user_timer {
method constructor (line 24) | constructor(
function timer_create (line 36) | function timer_create(a: i32, b: boolean, c: boolean): i32 {
function setTimeout (line 40) | function setTimeout(
function setInterval (line 50) | function setInterval(
function timer_cancel (line 60) | function timer_cancel(timer: user_timer): void {
function timer_restart (line 71) | function timer_restart(timer: user_timer, interval: number): void {
function now (line 75) | function now(): i32 {
function on_timer_callback (line 80) | function on_timer_callback(on_timer_id: i32): void {
FILE: example/app-framework/lib/utils.ts
type i32 (line 6) | type i32 = number;
function arraybuffer_to_string (line 8) | function arraybuffer_to_string(
function string_to_arraybuffer (line 20) | function string_to_arraybuffer(url: string) {
FILE: example/app-framework/src/iwasm_main.c
type sockaddr_in (line 97) | struct sockaddr_in
function host_init (line 147) | static bool
function host_send (line 153) | int
function host_destroy (line 173) | void
type sockaddr_in (line 199) | struct sockaddr_in
type sigaction (line 202) | struct sigaction
type sockaddr (line 225) | struct sockaddr
type sockaddr (line 236) | struct sockaddr
function parse_baudrate (line 276) | static int
function uart_init (line 320) | static bool
function uart_send (line 380) | static int
function uart_destroy (line 390) | static void
function attr_container_t (line 405) | static attr_container_t *
function config_test_sensor (line 421) | static bool
function showUsage (line 430) | static void
function parse_args (line 454) | static bool
FILE: example/app-framework/src/main.c
function main (line 9) | int
FILE: lib/builtin/builtin_name.ts
type GenericFuncName (line 136) | interface GenericFuncName {
function getSpecializedFuncName (line 274) | function getSpecializedFuncName(
FILE: lib/builtin/lib.type.d.ts
type i32 (line 6) | type i32 = number;
type i64 (line 7) | type i64 = number;
type f32 (line 8) | type f32 = number;
type f64 (line 9) | type f64 = number;
type anyref (line 10) | type anyref = any;
type SymbolConstructor (line 12) | interface SymbolConstructor {
type Iterable (line 17) | interface Iterable<T> {
type IterableIterator (line 21) | interface IterableIterator<T> extends Iterator<T> {
type ConcatArray (line 25) | interface ConcatArray<T> {
type ArrayConstructor (line 32) | interface ArrayConstructor {
type Array (line 43) | interface Array<T> {
type Boolean (line 105) | interface Boolean {}
type Number (line 107) | interface Number {}
type Function (line 109) | interface Function {}
type CallableFunction (line 111) | type CallableFunction = Function;
type IArguments (line 113) | interface IArguments {
type NewableFunction (line 117) | type NewableFunction = Function;
type Object (line 119) | interface Object {}
type RegExp (line 121) | interface RegExp {}
type String (line 123) | interface String {
type StringConstructor (line 143) | interface StringConstructor {
type Math (line 149) | interface Math {
type TypedPropertyDescriptor (line 160) | interface TypedPropertyDescriptor<T> {}
type Console (line 162) | interface Console {
type MapConstructor (line 168) | interface MapConstructor {
type SetConstructor (line 182) | interface SetConstructor {
type PromiseConstructor (line 193) | interface PromiseConstructor {
type DateConstructor (line 207) | interface DateConstructor {
type JSON (line 234) | interface JSON {
type Error (line 257) | interface Error {
type ErrorConstructor (line 263) | interface ErrorConstructor {
type Number (line 271) | interface Number {
type Object (line 275) | interface Object {
type ObjectConstructor (line 280) | interface ObjectConstructor {
type FunctionConstructor (line 288) | interface FunctionConstructor {
type ArrayBuffer (line 306) | interface ArrayBuffer {
type ArrayBufferConstructor (line 312) | interface ArrayBufferConstructor {
type DataView (line 318) | interface DataView {
type DataViewConstructor (line 341) | interface DataViewConstructor {
FILE: lib/builtin/lib_builtin.ts
class Console (line 9) | class Console {
class Math (line 13) | class Math {
method pow (line 14) | pow(x: number, y: number): number {
method max (line 25) | max(...x: number[]): number {
method min (line 36) | min(...x: number[]): number {
class ArrayBufferConstructor (line 48) | class ArrayBufferConstructor {
method isView (line 49) | isView(arg: any) {
FILE: runtime-library/libdyntype/dynamic-qjs/context.c
function JSValue (line 11) | JSValue *
function dyn_ctx_t (line 25) | dyn_ctx_t
function dyn_ctx_t (line 73) | dyn_ctx_t
function dynamic_context_destroy (line 80) | void
function dyn_ctx_t (line 102) | dyn_ctx_t
FILE: runtime-library/libdyntype/dynamic-qjs/fallback.c
function dyn_value_t (line 13) | dyn_value_t
function dynamic_execute_pending_jobs (line 78) | int
FILE: runtime-library/libdyntype/dynamic-qjs/object.c
function number_cmp (line 13) | static inline bool
function string_cmp (line 56) | static inline bool
function bool_cmp (line 100) | static inline bool
function cmp_operator_has_equal_token (line 143) | static inline bool
function dyn_type_t (line 158) | static dyn_type_t
function JSValue (line 181) | static JSValue
function JSValue (line 233) | static JSValue
function dyn_value_t (line 254) | dyn_value_t
function dyn_value_t (line 261) | dyn_value_t
function dyn_value_t (line 269) | dyn_value_t
function dyn_value_t (line 276) | dyn_value_t
function dyn_value_t (line 287) | dyn_value_t
function dyn_value_t (line 293) | dyn_value_t
function dyn_value_t (line 299) | dyn_value_t
function dyn_value_t (line 309) | dyn_value_t
function dyn_value_t (line 319) | dyn_value_t
function dyn_value_t (line 335) | dyn_value_t
function dyn_value_t (line 348) | dyn_value_t
function dyn_value_t (line 391) | dyn_value_t
function dynamic_set_elem (line 418) | int
function dyn_value_t (line 440) | dyn_value_t
function dynamic_set_property (line 457) | int
function dynamic_define_property (line 476) | int
function dyn_value_t (line 505) | dyn_value_t
function dynamic_has_property (line 526) | int
function dynamic_delete_property (line 549) | int
function dyn_value_t (line 572) | dyn_value_t
function dynamic_is_undefined (line 586) | bool
function dynamic_is_null (line 593) | bool
function dynamic_is_bool (line 600) | bool
function dynamic_to_bool (line 607) | int
function dynamic_is_number (line 618) | bool
function dynamic_to_number (line 625) | int
function dynamic_is_string (line 637) | bool
function dynamic_to_cstring (line 654) | int
function dynamic_free_cstring (line 665) | void
function dynamic_is_object (line 671) | bool
function dynamic_is_function (line 678) | bool
function dynamic_is_array (line 685) | bool
function dynamic_is_extref (line 692) | bool
function dynamic_to_extref (line 702) | int
function dynamic_is_exception (line 725) | bool
function dynamic_is_falsy (line 732) | bool
function dyn_type_t (line 770) | dyn_type_t
function dynamic_type_eq (line 795) | bool
function dynamic_cmp (line 801) | bool
function dyn_value_t (line 895) | dyn_value_t
function dynamic_set_prototype (line 909) | int
function dyn_value_t (line 927) | dyn_value_t
function dyn_value_t (line 943) | dyn_value_t
function dynamic_instanceof (line 964) | bool
function dynamic_dump_value (line 981) | void
function dynamic_dump_value_buffer (line 1001) | int
function dyn_value_t (line 1009) | static dyn_value_t
function dynamic_dump_error (line 1017) | void
function dyn_value_t (line 1038) | dyn_value_t
function dynamic_release (line 1049) | void
function dynamic_collect (line 1063) | void
function dyn_value_t (line 1071) | dyn_value_t
function dynamic_get_array_length (line 1085) | int
FILE: runtime-library/libdyntype/dynamic-qjs/type.h
type DynTypeContext (line 11) | typedef struct DynTypeContext {
FILE: runtime-library/libdyntype/dynamic-simple/context.c
function dyn_ctx_t (line 14) | dyn_ctx_t
function dyn_ctx_t (line 20) | dyn_ctx_t
function dynamic_context_destroy (line 26) | void
function dyn_ctx_t (line 30) | dyn_ctx_t
FILE: runtime-library/libdyntype/dynamic-simple/dyn-value/class/date.c
function strtotime (line 17) | int
function DynValue (line 57) | DynValue *
function DynValue (line 83) | DynValue *
function DynValue (line 92) | DynValue *
function DynValue (line 100) | DynValue *
function DynValue (line 108) | DynValue *
function DynValue (line 116) | DynValue *
function DynValue (line 124) | DynValue *
function DynValue (line 132) | DynValue *
function DynValue (line 151) | DynValue *
FILE: runtime-library/libdyntype/dynamic-simple/dyn-value/class/dyn_class.c
function DynClassMethodCallback (line 47) | static DynClassMethodCallback
function DynClassMethodCallback (line 75) | DynClassMethodCallback
function DynClassConstructorCallback (line 93) | DynClassConstructorCallback
function DynValue (line 113) | DynValue *
FILE: runtime-library/libdyntype/dynamic-simple/dyn-value/class/dyn_class.h
type DynValue (line 8) | typedef DynValue * (*DynClassConstructorCallback)(int argc, DynValue **a...
type DynValue (line 9) | typedef DynValue * (*DynClassMethodCallback)(DynValue *self, int argc, D...
type ClassMethod (line 11) | typedef struct ClassMethod {
type ClassMeta (line 16) | typedef struct ClassMeta {
type DyntypeClass (line 28) | typedef struct DyntypeClass {
type GlobalObjectEntry (line 33) | typedef struct GlobalObjectEntry {
FILE: runtime-library/libdyntype/dynamic-simple/dyn-value/class/object.c
function DynValue (line 9) | DynValue *object_constructor(int argc, DynValue *argv[])
function DynValue (line 14) | DynValue *object_keys(DynValue *this_val, int argc, DynValue *argv[])
FILE: runtime-library/libdyntype/dynamic-simple/dyn-value/class/string.c
function DynValue (line 8) | DynValue *string_concat(DynValue *this_val, int argc, DynValue *argv[])
FILE: runtime-library/libdyntype/dynamic-simple/dyn-value/dyn_value.c
function prop_key_hash (line 14) | static uint32_t
function prop_key_equal (line 20) | static bool
function prop_value_destroyer (line 26) | static void
function DynValue (line 32) | DynValue *
function DynValue (line 49) | DynValue *
function DynValue (line 66) | DynValue *
function DynValue (line 85) | DynValue *
function DynValue (line 96) | DynValue *
function init_dyn_object (line 107) | bool
function init_dyn_object_properties (line 123) | bool
function DynValue (line 136) | DynValue *
function DynValue (line 153) | DynValue *
function DynValue (line 172) | DynValue *
function DynValue (line 184) | DynValue *
function DynValue (line 195) | DynValue *
function object_property_counter (line 215) | static void
type ArraySetter (line 222) | struct ArraySetter {
function object_property_keys (line 228) | static void
function DynValue (line 243) | DynValue *
function DynValue (line 267) | DynValue *
function DynValue (line 277) | DynValue *
function dyn_value_destroy (line 285) | static void
function dyn_value_release (line 308) | void
function DyntypeString (line 325) | DyntypeString *
function dyn_string_eq (line 348) | int32_t
function DyntypeString (line 362) | DyntypeString *
FILE: runtime-library/libdyntype/dynamic-simple/dyn-value/dyn_value.h
type DynValueClass (line 9) | enum DynValueClass {
type DynValue (line 25) | typedef struct DynValue {
type DyntypeNumber (line 31) | typedef struct DyntypeNumber {
type DyntypeBoolean (line 36) | typedef struct DyntypeBoolean {
type DyntypeString (line 41) | typedef struct DyntypeString {
type DyntypeObject (line 47) | typedef struct DyntypeObject {
type DyntypeArray (line 52) | typedef struct DyntypeArray {
type DyntypeExtref (line 58) | typedef struct DyntypeExtref {
type DyntypeDate (line 64) | typedef struct DyntypeDate {
FILE: runtime-library/libdyntype/dynamic-simple/fallback.c
function dyn_value_t (line 11) | dyn_value_t
function dynamic_execute_pending_jobs (line 18) | int
FILE: runtime-library/libdyntype/dynamic-simple/object.c
function number_cmp (line 12) | static inline bool
function string_cmp (line 55) | static inline bool
function bool_cmp (line 99) | static inline bool
function cmp_operator_has_equal_token (line 142) | static inline bool
function dyn_value_t (line 157) | dyn_value_t
function dyn_value_t (line 163) | dyn_value_t
function dyn_value_t (line 169) | dyn_value_t
function dyn_value_t (line 177) | dyn_value_t
function dyn_value_t (line 183) | dyn_value_t
function dyn_value_t (line 189) | dyn_value_t
function dyn_value_t (line 195) | dyn_value_t
function dyn_value_t (line 201) | dyn_value_t
function dyn_value_t (line 207) | dyn_value_t
function dyn_value_t (line 214) | dyn_value_t
function dynamic_set_elem (line 220) | int
function dyn_value_t (line 244) | dyn_value_t
function dynamic_set_property (line 266) | int
function dynamic_define_property (line 312) | int
function dyn_value_t (line 319) | dyn_value_t
function dynamic_has_property (line 350) | int
function dynamic_delete_property (line 370) | int
function dyn_value_t (line 396) | dyn_value_t
function dynamic_is_undefined (line 404) | bool
function dynamic_is_null (line 411) | bool
function dynamic_is_bool (line 418) | bool
function dynamic_to_bool (line 425) | int
function dynamic_is_number (line 439) | bool
function dynamic_to_number (line 446) | int
function dynamic_is_string (line 460) | bool
function dynamic_to_cstring (line 475) | int
function dynamic_free_cstring (line 556) | void
function dynamic_is_object (line 562) | bool
function dynamic_is_function (line 569) | bool
function dynamic_is_array (line 575) | bool
function dynamic_is_extref (line 585) | bool
function dynamic_to_extref (line 595) | int
function dynamic_is_exception (line 609) | bool
function dynamic_is_falsy (line 615) | bool
function dyn_type_t (line 632) | dyn_type_t
function dynamic_type_eq (line 652) | bool
function dynamic_cmp (line 658) | bool
function dyn_value_t (line 751) | dyn_value_t
function dynamic_set_prototype (line 757) | int
function dyn_value_t (line 764) | dyn_value_t
function dyn_value_t (line 770) | dyn_value_t
function dynamic_instanceof (line 776) | bool
function dynamic_dump_value (line 785) | void
function dynamic_dump_value_buffer (line 868) | int
function dynamic_dump_error (line 874) | void
function dyn_value_t (line 880) | dyn_value_t
function dynamic_release (line 886) | void
function dynamic_collect (line 892) | void
function dyn_value_t (line 900) | dyn_value_t
function dynamic_get_array_length (line 908) | int
FILE: runtime-library/libdyntype/extref/extref.c
function extref_set_elem (line 28) | int
function dyn_value_t (line 55) | dyn_value_t
function extref_set_property (line 83) | int
function dyn_value_t (line 117) | dyn_value_t
function dyn_value_t (line 155) | dyn_value_t
function extref_has_property (line 161) | int
function extref_delete_property (line 191) | int
function dyn_value_t (line 221) | dyn_value_t
function dyn_value_t (line 264) | dyn_value_t
function extref_unsupported (line 329) | void
FILE: runtime-library/libdyntype/lib_dyntype_wrapper.c
function wasm_anyref_obj_t (line 22) | wasm_anyref_obj_t
function wasm_anyref_obj_t (line 30) | wasm_anyref_obj_t
function wasm_anyref_obj_t (line 39) | wasm_anyref_obj_t
function wasm_anyref_obj_t (line 48) | wasm_anyref_obj_t
function wasm_anyref_obj_t (line 69) | wasm_anyref_obj_t
function wasm_anyref_obj_t (line 76) | wasm_anyref_obj_t
function wasm_anyref_obj_t (line 82) | wasm_anyref_obj_t
function wasm_anyref_obj_t (line 88) | wasm_anyref_obj_t
function dyntype_add_elem_wrapper (line 96) | void
function wasm_anyref_obj_t (line 102) | wasm_anyref_obj_t
function wasm_anyref_obj_t (line 111) | wasm_anyref_obj_t
function dyntype_set_elem_wrapper (line 119) | void
function dyn_value_t (line 128) | dyn_value_t
function dyntype_has_property_wrapper (line 137) | int
function dyntype_delete_property_wrapper (line 144) | int
function dyntype_set_property_wrapper (line 151) | int
function dyn_value_t (line 163) | dyn_value_t
function wasm_anyref_obj_t (line 173) | wasm_anyref_obj_t
function dyntype_define_property_wrapper (line 183) | int
function dyntype_is_undefined_wrapper (line 193) | int
function dyntype_is_null_wrapper (line 200) | int
function dyntype_is_bool_wrapper (line 207) | int
function dyntype_to_bool_wrapper (line 214) | int
function dyntype_is_number_wrapper (line 229) | int
function dyntype_to_number_wrapper (line 236) | double
function dyntype_is_string_wrapper (line 252) | int
function wasm_stringref_obj_t (line 260) | wasm_stringref_obj_t
function dyntype_is_object_wrapper (line 293) | int
function dyntype_is_array_wrapper (line 300) | int
function dyntype_is_extref_wrapper (line 307) | int
function dyntype_is_falsy_wrapper (line 330) | int
function dyn_type_t (line 428) | dyn_type_t
function dyntype_type_eq_wrapper (line 435) | int
function dyntype_cmp_wrapper (line 443) | int
function wasm_anyref_obj_t (line 512) | wasm_anyref_obj_t
function dyntype_set_prototype_wrapper (line 522) | int
function wasm_anyref_obj_t (line 531) | const wasm_anyref_obj_t
function dyntype_instanceof_wrapper (line 540) | int
function dyntype_dump_value_wrapper (line 579) | void
function dyntype_dump_value_buffer_wrapper (line 586) | int
function wasm_anyref_obj_t (line 595) | wasm_anyref_obj_t
function wasm_anyref_obj_t (line 603) | wasm_anyref_obj_t
function wasm_anyref_obj_t (line 652) | wasm_anyref_obj_t
function dyn_value_t (line 697) | dyn_value_t
function get_libdyntype_symbols (line 783) | uint32_t
FILE: runtime-library/libdyntype/libdyntype.c
function dyn_ctx_t (line 17) | dyn_ctx_t
function dyn_ctx_t (line 23) | dyn_ctx_t
function dyntype_context_destroy (line 29) | void
function dyntype_context_set_exec_env (line 37) | void
function dyntype_set_callback_dispatcher (line 49) | void
function dyntype_callback_dispatcher_t (line 55) | dyntype_callback_dispatcher_t
function dyntype_execute_pending_jobs (line 61) | int
function dyntype_dump_error (line 67) | void
function dyn_value_t (line 73) | dyn_value_t
function dyntype_dump_value (line 79) | void
function dyntype_dump_value_buffer (line 85) | int
function dyn_value_t (line 91) | dyn_value_t
function dyntype_release (line 97) | void
function dyntype_collect (line 103) | void
function dyn_ctx_t (line 129) | dyn_ctx_t
function dyn_value_t (line 135) | dyn_value_t
function dyn_value_t (line 141) | dyn_value_t
function dyn_value_t (line 148) | dyn_value_t
function dyn_value_t (line 154) | dyn_value_t
function dyn_value_t (line 161) | dyn_value_t
function dyn_value_t (line 167) | dyn_value_t
function dyn_value_t (line 173) | dyn_value_t
function dyn_value_t (line 179) | dyn_value_t
function dyn_value_t (line 186) | dyn_value_t
function dyn_value_t (line 192) | dyn_value_t
function dyn_value_t (line 198) | dyn_value_t
function dyntype_set_elem (line 204) | int
function dyn_value_t (line 210) | dyn_value_t
function dyntype_set_property (line 216) | int
function dyn_value_t (line 223) | dyn_value_t
function dyn_value_t (line 229) | dyn_value_t
function dyntype_define_property (line 235) | int
function dyntype_has_property (line 244) | int
function dyntype_delete_property (line 250) | int
function dyn_value_t (line 256) | dyn_value_t dyntype_get_keys(dyn_ctx_t ctx, dyn_value_t obj)
function dyntype_is_number (line 294) | bool
function dyntype_to_number (line 300) | int
function dyntype_is_bool (line 306) | bool
function dyntype_to_bool (line 312) | int
function dyntype_is_string (line 318) | bool
function dyntype_to_cstring (line 332) | int
function dyntype_free_cstring (line 338) | void
function dyntype_is_undefined (line 344) | bool
function dyntype_is_null (line 350) | bool
function dyntype_is_object (line 356) | bool
function dyntype_is_function (line 362) | bool
function dyntype_is_array (line 368) | bool
function dyntype_is_extref (line 374) | bool
function dyntype_to_extref (line 380) | int
function dyntype_is_exception (line 386) | bool
function dyntype_is_falsy (line 392) | bool dyntype_is_falsy(dyn_ctx_t ctx, dyn_value_t value)
function dyn_type_t (line 397) | dyn_type_t
function dyntype_type_eq (line 403) | bool
function dyntype_cmp (line 409) | bool
function dyntype_set_prototype (line 415) | int
function dyn_value_t (line 424) | dyn_value_t
function dyntype_instanceof (line 432) | bool
function dyn_value_t (line 439) | dyn_value_t
function dyn_value_t (line 446) | dyn_value_t
function dyntype_get_array_length (line 452) | int
FILE: runtime-library/libdyntype/libdyntype.h
type DynTypeContext (line 24) | struct DynTypeContext
type DynTypeContext (line 26) | struct DynTypeContext
type dyn_options_t (line 27) | typedef void dyn_options_t;
type dyn_value_t (line 30) | typedef dyn_value_t (*dyntype_callback_dispatcher_t)(void *env, dyn_ctx_...
type external_ref_tag (line 36) | typedef enum external_ref_tag {
type dyn_type_t (line 42) | typedef enum dyn_type_t {
type cmp_operator (line 58) | typedef enum cmp_operator {
FILE: runtime-library/libdyntype/test/dump.cc
class DumpValueTest (line 10) | class DumpValueTest : public testing::Test
method SetUp (line 13) | virtual void SetUp()
method TearDown (line 20) | virtual void TearDown() { dyntype_context_destroy(ctx); }
function TEST_F (line 25) | TEST_F(DumpValueTest, dump_value)
FILE: runtime-library/libdyntype/test/object_property_test.cc
class ObjectPropertyTest (line 13) | class ObjectPropertyTest : public testing::Test
method SetUp (line 16) | virtual void SetUp() { ctx = dyntype_context_init(); }
method TearDown (line 18) | virtual void TearDown() { dyntype_context_destroy(ctx); }
function TEST_F (line 23) | TEST_F(ObjectPropertyTest, object_set_and_has_and_get_property)
function TEST_F (line 141) | TEST_F(ObjectPropertyTest, object_define_and_has_and_get_property)
function TEST_F (line 309) | TEST_F(ObjectPropertyTest, object_set_and_delete_property)
function TEST_F (line 377) | TEST_F(ObjectPropertyTest, object_define_and_delete_property)
function TEST_F (line 510) | TEST_F(ObjectPropertyTest, map_function_test)
function dyn_value_t (line 588) | static dyn_value_t
function TEST_F (line 595) | TEST_F(ObjectPropertyTest, map_callback_test)
function TEST_F (line 687) | TEST_F(ObjectPropertyTest, get_keys)
FILE: runtime-library/libdyntype/test/operator_test.cc
class OperatorTest (line 10) | class OperatorTest : public testing::Test
method SetUp (line 13) | virtual void SetUp() { ctx = dyntype_context_init(); }
method TearDown (line 15) | virtual void TearDown() { dyntype_context_destroy(ctx); }
method is_type_eq (line 17) | testing::AssertionResult is_type_eq(dyn_value_t lhs, dyn_value_t rhs,
function TEST_F (line 31) | TEST_F(OperatorTest, typeof)
function TEST_F (line 76) | TEST_F(OperatorTest, type_eq)
FILE: runtime-library/libdyntype/test/prototype_test.cc
class PrototypeTest (line 11) | class PrototypeTest : public testing::Test
method SetUp (line 14) | virtual void SetUp() { ctx = dyntype_context_init(); }
method TearDown (line 16) | virtual void TearDown() { dyntype_context_destroy(ctx); }
function TEST_F (line 21) | TEST_F(PrototypeTest, prototype)
FILE: runtime-library/libdyntype/test/types_test.cc
class TypesTest (line 10) | class TypesTest : public testing::Test
method SetUp (line 13) | virtual void SetUp()
method TearDown (line 20) | virtual void TearDown() { dyntype_context_destroy(ctx); }
function TEST_F (line 25) | TEST_F(TypesTest, is_undefined)
function TEST_F (line 44) | TEST_F(TypesTest, create_number_object)
function TEST_F (line 94) | TEST_F(TypesTest, create_boolean_object)
function TEST_F (line 138) | TEST_F(TypesTest, create_undefined)
function TEST_F (line 167) | TEST_F(TypesTest, create_null)
function TEST_F (line 188) | TEST_F(TypesTest, create_string)
function TEST_F (line 311) | TEST_F(TypesTest, create_array)
function TEST_F (line 411) | TEST_F(TypesTest, create_object)
function TEST_F (line 441) | TEST_F(TypesTest, create_map)
function TEST_F (line 472) | TEST_F(TypesTest, get_global_obj)
FILE: runtime-library/main.c
function print_help (line 46) | static int
function validate_env_str (line 223) | static bool
function uint32 (line 245) | static uint32
function unregister_and_unload_native_libs (line 292) | static void
function module_reader_callback (line 343) | static bool
function moudle_destroyer (line 363) | static void
function events_poll (line 379) | int
function execute_micro_tasks (line 386) | void
function main (line 408) | int
FILE: runtime-library/stdlib/lib_array.c
function array_push_generic (line 18) | double
function quick_sort (line 333) | void
function array_unshift_generic (line 571) | double
function array_indexOf_anyref (line 671) | double
function array_lastIndexOf_anyref (line 810) | double
function array_every_some_generic (line 903) | bool
function array_every_generic (line 950) | bool
function array_some_generic (line 957) | bool
function array_forEach_generic (line 964) | void
function array_findIndex_generic (line 1379) | double
function compute_index (line 1466) | ARRAY_FILL_API(void *, anyref, gc_obj)
function includes_string (line 1583) | static bool
function array_includes_anyref (line 1615) | bool
function get_lib_array_symbols (line 1744) | uint32_t
FILE: runtime-library/stdlib/lib_console.c
function Console_log (line 16) | void
function get_lib_console_symbols (line 62) | uint32_t
FILE: runtime-library/stdlib/lib_timer.c
function setTimeout (line 14) | double
function clearTimeout (line 28) | void
function get_lib_timer_symbols (line 51) | uint32_t
FILE: runtime-library/stringref/stringref_qjs.c
function JSValue (line 10) | static JSValue
function wasm_string_destroy (line 27) | void
function WASMString (line 37) | WASMString
function WASMString (line 50) | WASMString
function int32 (line 61) | int32
function int32 (line 74) | int32
function int32 (line 86) | int32
function WASMString (line 111) | WASMString
function int32 (line 123) | int32
function int32 (line 136) | int32
function WASMString (line 145) | WASMString
function int32 (line 157) | int32
function WASMString (line 167) | WASMString
function int16 (line 183) | int16
function uint32 (line 198) | uint32
function uint32 (line 205) | uint32
function wasm_string_dump (line 213) | void
FILE: runtime-library/stringref/stringref_simple.c
function wasm_string_destroy (line 11) | void
function WASMString (line 19) | WASMString
function WASMString (line 29) | WASMString
function int32 (line 37) | int32
function int32 (line 44) | int32
function int32 (line 56) | int32
function WASMString (line 76) | WASMString
function int32 (line 83) | int32
function int32 (line 90) | int32
function WASMString (line 99) | WASMString
function int32 (line 111) | int32
function WASMString (line 121) | WASMString
function int16 (line 129) | int16
function uint32 (line 138) | uint32
function uint32 (line 145) | uint32
function wasm_string_dump (line 153) | void
FILE: runtime-library/struct-indirect/lib_struct_indirect.c
function wasm_struct_obj_t (line 8) | static wasm_struct_obj_t
function struct_get_indirect_i32 (line 43) | int
function struct_get_indirect_i64 (line 58) | long long
function struct_get_indirect_f32 (line 73) | float
function struct_get_indirect_f64 (line 88) | double
function struct_set_indirect_i32 (line 134) | void
function struct_set_indirect_i64 (line 148) | void
function struct_set_indirect_f32 (line 162) | void
function struct_set_indirect_f64 (line 176) | void
function struct_set_indirect_anyref (line 190) | void
function struct_set_indirect_funcref (line 204) | void
function get_struct_indirect_symbols (line 237) | uint32_t
FILE: runtime-library/utils/object_utils.c
function dynamic_object_finalizer (line 19) | void
function wasm_anyref_obj_t (line 26) | wasm_anyref_obj_t
function uint32 (line 42) | static uint32
function dyn_value_t (line 56) | dyn_value_t
function string_compare (line 203) | bool
function wasm_stringref_obj_t (line 212) | wasm_stringref_obj_t
function unbox_value_from_any (line 240) | void
function dyn_value_t (line 353) | dyn_value_t
FILE: runtime-library/utils/type_utils.c
function is_ts_closure_type (line 44) | bool
function is_ts_array_type (line 99) | bool
function get_array_length (line 135) | uint32_t
function wasm_array_obj_t (line 145) | wasm_array_obj_t
function get_array_capacity (line 155) | int
function get_array_element_size (line 163) | uint32_t
function get_array_type_by_element (line 171) | int32_t
function get_array_struct_type (line 202) | int32_t
function get_closure_struct_type (line 239) | int32_t
function get_stringref_array_type (line 285) | static uint32_t
function wasm_struct_obj_t (line 317) | wasm_struct_obj_t
function wasm_struct_obj_t (line 386) | wasm_struct_obj_t
function is_i8_array (line 496) | static bool
function get_string_array_type (line 517) | int32_t
function get_string_struct_type (line 550) | int32_t
function is_ts_string_type (line 574) | bool
function wasm_stringref_obj_t (line 608) | wasm_stringref_obj_t
function wasm_stringref_obj_t (line 615) | wasm_stringref_obj_t
function wasm_string_get_length (line 623) | uint32_t
function wasm_string_to_cstring (line 631) | uint32_t
function wasm_struct_obj_t (line 642) | wasm_struct_obj_t
function wasm_array_obj_t (line 707) | static wasm_array_obj_t
function wasm_struct_obj_t (line 764) | static wasm_struct_obj_t
function wasm_struct_obj_t (line 812) | wasm_struct_obj_t
function wasm_struct_obj_t (line 818) | wasm_struct_obj_t
function get_str_length_from_string_struct (line 837) | uint32_t
function get_static_array_info (line 1086) | void
function get_prop_index_of_struct (line 1111) | int
function int32 (line 1163) | int32
function get_meta_field_flag (line 1175) | static inline enum field_flag
function int32 (line 1184) | static inline int32
function int32 (line 1192) | static inline int32
function int32 (line 1198) | static inline int32
function int32 (line 1204) | static int32
function get_object_field (line 1246) | int
type field_flag (line 1312) | enum field_flag
type field_flag (line 1316) | enum field_flag
FILE: runtime-library/utils/type_utils.h
type closure_index (line 55) | enum closure_index {
type field_flag (line 61) | enum field_flag {
type ts_value_type_t (line 69) | typedef enum ts_value_type_t {
type ts_value_t (line 81) | typedef struct ts_value_t {
type WasmArrayInfo (line 175) | typedef struct WasmArrayInfo {
type field_flag (line 205) | enum field_flag
type field_flag (line 274) | enum field_flag
FILE: scripts/gdb/utils.py
function get_bits (line 10) | def get_bits(val, size, offset = 0):
function get_bit (line 14) | def get_bit(val, offset = 0):
function obj_to_hmu (line 18) | def obj_to_hmu(obj):
function hmu_to_obj (line 21) | def hmu_to_obj(hmu):
function hmu_get_size (line 24) | def hmu_get_size(hmu):
function hmu_get_ut (line 27) | def hmu_get_ut(hmu):
function hmu_get_pinuse (line 30) | def hmu_get_pinuse(hmu):
function hmu_get_vo_marked (line 33) | def hmu_get_vo_marked(hmu):
function obj_get_rtt_ref (line 37) | def obj_get_rtt_ref(obj):
function rtt_get_defined_type_ref (line 44) | def rtt_get_defined_type_ref(rtt):
FILE: scripts/gdb/wamr_dbg.py
function _get_ref (line 22) | def _get_ref(arg):
function wamr_get_type (line 32) | def wamr_get_type(arg):
function wamr_type_dump (line 37) | def wamr_type_dump(arg):
function wamr_get_gc_obj (line 44) | def wamr_get_gc_obj(arg):
function wamr_gc_obj_dump (line 49) | def wamr_gc_obj_dump(arg):
function wamr_get_exec_env (line 55) | def wamr_get_exec_env(arg):
function wamr_exec_env_dump (line 60) | def wamr_exec_env_dump(arg):
function wamr_get_interp_frame (line 66) | def wamr_get_interp_frame(arg):
function wamr_interp_frame_dump (line 71) | def wamr_interp_frame_dump(arg):
function wamr_interp_frame_dump_all (line 77) | def wamr_interp_frame_dump_all(arg):
function wamr_exec_env_dump_all_interp_frame (line 84) | def wamr_exec_env_dump_all_interp_frame(arg):
function wamr_operand_stack_get_addr (line 93) | def wamr_operand_stack_get_addr(arg1, arg2):
function wamr_operand_stack_get_i32 (line 100) | def wamr_operand_stack_get_i32(arg1, arg2):
function wamr_operand_stack_get_i64 (line 107) | def wamr_operand_stack_get_i64(arg1, arg2):
function wamr_operand_stack_get_f32 (line 114) | def wamr_operand_stack_get_f32(arg1, arg2):
function wamr_operand_stack_get_f64 (line 121) | def wamr_operand_stack_get_f64(arg1, arg2):
function wamr_operand_stack_get_ref (line 128) | def wamr_operand_stack_get_ref(arg1, arg2):
function wamr_operand_stack_get_obj (line 135) | def wamr_operand_stack_get_obj(arg1, arg2):
function wamr_get_function (line 140) | def wamr_get_function(arg):
function wamr_function_dump (line 145) | def wamr_function_dump(arg):
FILE: scripts/gdb/wamr_exec_env.py
class WASMFunction (line 12) | class WASMFunction:
method __init__ (line 13) | def __init__(self, ref):
method get_max_stack_cell_num (line 40) | def get_max_stack_cell_num(self):
method __str__ (line 47) | def __str__(self):
class WASMInterpFrame (line 59) | class WASMInterpFrame:
method __init__ (line 60) | def __init__(self, ref):
method _get_feature_description (line 75) | def _get_feature_description(self):
method get_prev_frame (line 81) | def get_prev_frame(self):
method _get_operand_stack (line 88) | def _get_operand_stack(self):
method get_stack_addr (line 91) | def get_stack_addr(self, index):
method get_stack_i32 (line 94) | def get_stack_i32(self, index):
method get_stack_i64 (line 97) | def get_stack_i64(self, index):
method get_stack_f32 (line 101) | def get_stack_f32(self, index):
method get_stack_f64 (line 105) | def get_stack_f64(self, index):
method get_stack_ref (line 109) | def get_stack_ref(self, index):
method _get_conditional_info (line 113) | def _get_conditional_info(self):
method __str__ (line 212) | def __str__(self) -> str:
class WASMExecEnv (line 221) | class WASMExecEnv:
method __init__ (line 222) | def __init__(self, ref):
method get_cur_frame (line 266) | def get_cur_frame(self):
method _get_dynamic_info (line 269) | def _get_dynamic_info(self):
method _get_feature_description (line 282) | def _get_feature_description(self):
method __str__ (line 294) | def __str__(self) -> str:
FILE: scripts/gdb/wamr_objects.py
class HMU (line 10) | class HMU:
method __init__ (line 11) | def __init__(self, hmu):
method __str__ (line 20) | def __str__(self):
class WASMRtt (line 27) | class WASMRtt:
method __init__ (line 28) | def __init__(self, rtt_ref):
method _get_description (line 39) | def _get_description(self):
method __str__ (line 49) | def __str__(self):
class WASMObj (line 52) | class WASMObj:
method __init__ (line 53) | def __init__(self, obj, hmu, rtt):
method create_obj (line 59) | def create_obj(obj_ref):
class WASMI31Obj (line 84) | class WASMI31Obj:
method __init__ (line 85) | def __init__(self, value):
method __str__ (line 88) | def __str__(self):
class WASMExternRefObj (line 91) | class WASMExternRefObj(WASMObj):
method __init__ (line 92) | def __init__(self, obj, hmu, rtt):
method __str__ (line 99) | def __str__(self):
class WASMAnyRefObj (line 104) | class WASMAnyRefObj(WASMObj):
method __init__ (line 105) | def __init__(self, obj, hmu, rtt):
method __str__ (line 112) | def __str__(self):
class WASMArrayObj (line 117) | class WASMArrayObj(WASMObj):
method __init__ (line 118) | def __init__(self, obj, hmu, rtt):
method __str__ (line 130) | def __str__(self):
class WASMStructObj (line 136) | class WASMStructObj(WASMObj):
method __init__ (line 137) | def __init__(self, obj, hmu, rtt):
method __str__ (line 149) | def __str__(self):
class WASMFuncObj (line 154) | class WASMFuncObj(WASMObj):
method __init__ (line 155) | def __init__(self, obj, hmu, rtt):
method __str__ (line 167) | def __str__(self):
FILE: scripts/gdb/wamr_types.py
class WASMType (line 9) | class WASMType:
method __init__ (line 10) | def __init__(self):
method create_type (line 14) | def create_type(ref):
class WASMArrayType (line 33) | class WASMArrayType(WASMType):
method __init__ (line 34) | def __init__(self, ref):
method __str__ (line 42) | def __str__(self):
class WASMStructType (line 46) | class WASMStructType(WASMType):
method __init__ (line 47) | def __init__(self, ref):
method _get_fields_info (line 55) | def _get_fields_info(self):
method _create_fields_description (line 79) | def _create_fields_description(self):
method __str__ (line 92) | def __str__(self):
class WASMFuncType (line 100) | class WASMFuncType(WASMType):
method __init__ (line 101) | def __init__(self, ref):
method _get_reftype_id (line 112) | def _get_reftype_id(self, i):
method _get_parameter_types (line 120) | def _get_parameter_types(self):
method _get_result_types (line 133) | def _get_result_types(self):
method _get_description (line 146) | def _get_description(self, results = False):
method __str__ (line 157) | def __str__(self):
FILE: src/backend/binaryen/glue/binaryen.d.ts
type bool (line 18) | type bool = boolean;
type i8 (line 19) | type i8 = number;
type i16 (line 20) | type i16 = number;
type i32 (line 21) | type i32 = number;
type isize (line 22) | type isize = number;
type u8 (line 23) | type u8 = number;
type u16 (line 24) | type u16 = number;
type u32 (line 25) | type u32 = number;
type usize (line 26) | type usize = number;
type f32 (line 27) | type f32 = number;
type f64 (line 28) | type f64 = number;
type Ref (line 30) | type Ref = usize;
type Index (line 32) | type Index = u32;
type ExpressionId (line 33) | type ExpressionId = i32;
type FeatureFlags (line 34) | type FeatureFlags = u32;
type Op (line 35) | type Op = i32;
type ExternalKind (line 36) | type ExternalKind = u32;
type SideEffects (line 37) | type SideEffects = u32;
type ExpressionRunnerFlags (line 38) | type ExpressionRunnerFlags = u32;
type StringRef (line 40) | type StringRef = Ref;
type Pointer (line 41) | type Pointer<T> = Ref;
type ArrayRef (line 42) | type ArrayRef<T> = Ref;
type TypeRef (line 43) | type TypeRef = Ref;
type HeapTypeRef (line 44) | type HeapTypeRef = Ref;
type PackedType (line 45) | type PackedType = u32;
type ModuleRef (line 46) | type ModuleRef = Ref;
type LiteralRef (line 47) | type LiteralRef = Ref;
type ExpressionRef (line 48) | type ExpressionRef = Ref;
type FunctionRef (line 49) | type FunctionRef = Ref;
type ImportRef (line 50) | type ImportRef = Ref;
type ExportRef (line 51) | type ExportRef = Ref;
type GlobalRef (line 52) | type GlobalRef = Ref;
type TagRef (line 53) | type TagRef = Ref;
type TableRef (line 54) | type TableRef = Ref;
type ElementSegmentRef (line 55) | type ElementSegmentRef = Ref;
type RelooperRef (line 56) | type RelooperRef = Ref;
type RelooperBlockRef (line 57) | type RelooperBlockRef = Ref;
type ExpressionRunnerRef (line 58) | type ExpressionRunnerRef = Ref;
type BinaryenModuleAllocateAndWriteResultRef (line 59) | type BinaryenModuleAllocateAndWriteResultRef = Ref;
type TypeBuilderRef (line 60) | type TypeBuilderRef = Ref;
type TypeBuilderErrorReason (line 61) | type TypeBuilderErrorReason = u32;
type TypeSystem (line 62) | type TypeSystem = u32;
FILE: src/backend/binaryen/glue/transform.ts
function arrayToPtr (line 47) | function arrayToPtr(array: binaryen.ExpressionRef[]): ptrInfo {
function ptrToArray (line 63) | function ptrToArray(ptrInfo: ptrInfo): binaryen.ExpressionRef[] {
function allocU32Array (line 77) | function allocU32Array(u32Array: binaryenCAPI.u32[]): binaryenCAPI.usize {
function allocU8Array (line 88) | function allocU8Array(u8Array: boolean[]): binaryenCAPI.usize {
function initArrayType (line 98) | function initArrayType(
function initStructType (line 188) | function initStructType(
function generateArrayStructTypeInfo (line 277) | function generateArrayStructTypeInfo(arrayTypeInfo: typeInfo): typeInfo {
function generateArrayStructTypeForRec (line 296) | function generateArrayStructTypeForRec(
function genarateI8ArrayTypeInfo (line 314) | function genarateI8ArrayTypeInfo(): typeInfo {
function generateStringTypeInfo (line 327) | function generateStringTypeInfo(): typeInfo {
function genarateNumberArrayTypeInfo (line 348) | function genarateNumberArrayTypeInfo(): typeInfo {
function genarateI32ArrayTypeInfo (line 361) | function genarateI32ArrayTypeInfo(): typeInfo {
function genarateStringArrayTypeInfo (line 374) | function genarateStringArrayTypeInfo(struct_wrap: boolean): typeInfo {
function genarateStringrefArrayTypeInfo (line 392) | function genarateStringrefArrayTypeInfo(struct_wrap: boolean): typeInfo {
function generateInfcTypeInfo (line 409) | function generateInfcTypeInfo(): typeInfo {
function genarateBoolArrayTypeInfo (line 414) | function genarateBoolArrayTypeInfo(): typeInfo {
function genarateAnyArrayTypeInfo (line 427) | function genarateAnyArrayTypeInfo(): typeInfo {
function generateDataViewTypeInfo (line 439) | function generateDataViewTypeInfo(): typeInfo {
function createSignatureTypeRefAndHeapTypeRef (line 459) | function createSignatureTypeRefAndHeapTypeRef(
FILE: src/backend/binaryen/glue/utils.ts
constant GLOBAL_INIT_FUNC (line 8) | const GLOBAL_INIT_FUNC = 'global_init';
type ptrInfo (line 10) | interface ptrInfo {
type typeInfo (line 15) | interface typeInfo {
FILE: src/backend/binaryen/index.ts
class WASMFunctionContext (line 86) | class WASMFunctionContext {
method constructor (line 99) | constructor(binaryenCtx: WASMGen, func: FunctionDeclareNode) {
method i32Local (line 107) | i32Local() {
method insert (line 111) | insert(insn: binaryen.ExpressionRef) {
method setReturnOpcode (line 115) | setReturnOpcode(returnOpcode: binaryen.ExpressionRef) {
method returnOp (line 119) | get returnOp() {
method sourceMapLocs (line 123) | get sourceMapLocs() {
method enterScope (line 127) | enterScope() {
method exitScope (line 131) | exitScope() {
method getBody (line 136) | getBody() {
method returnIdx (line 140) | get returnIdx() {
method insertReturnVar (line 144) | insertReturnVar(returnVarType: binaryenCAPI.TypeRef) {
method insertTmpVar (line 154) | insertTmpVar(tmpVarType: binaryenCAPI.TypeRef) {
method generateFuncVarsTypeRefs (line 164) | private generateFuncVarsTypeRefs(varNode: SemanticsNode) {
method getFuncVarsTypeRefs (line 234) | getFuncVarsTypeRefs(varNode: SemanticsNode) {
method allocateTmpVarIdx (line 242) | allocateTmpVarIdx() {
method getAllFuncVarsTypeRefs (line 253) | getAllFuncVarsTypeRefs() {
method setLocalVarName (line 263) | setLocalVarName(name: string, index: number) {
class WASMGen (line 272) | class WASMGen extends Ts2wasmBackend {
method constructor (line 292) | constructor(parserContext: ParserContext) {
method module (line 311) | get module(): binaryen.Module {
method wasmTypeComp (line 315) | get wasmTypeComp(): WASMTypeGen {
method wasmExprComp (line 319) | get wasmExprComp(): WASMExpressionGen {
method semanticModule (line 323) | get semanticModule() {
method hasFuncName (line 327) | public hasFuncName(funcName: string) {
method codegen (line 333) | public codegen(options?: any): void {
method emitBinary (line 370) | public emitBinary(options?: any): Uint8Array {
method emitText (line 381) | public emitText(options?: any): string {
method emitSourceMap (line 388) | public emitSourceMap(name: string): string {
method dispose (line 407) | public dispose(): void {
method wasmGenerate (line 411) | private wasmGenerate() {
method addGlobalVars (line 473) | private addGlobalVars() {
method parseFuncs (line 497) | private parseFuncs() {
method parseFunc (line 504) | public parseFunc(func: FunctionDeclareNode) {
method assignCtxVar (line 937) | public assignCtxVar(context: VarDeclareNode, freeVars: VarDeclareNode[...
method assignThisVar (line 996) | public assignThisVar(thisVar: VarDeclareNode) {
method parseBody (line 1011) | private parseBody(body: BlockNode) {
method initEnv (line 1032) | private initEnv() {
method generateRawString (line 1049) | public generateRawString(str: string): number {
method generateMetaInfo (line 1054) | public generateMetaInfo(objType: ObjectType): number {
method findMethodImplementClass (line 1125) | public findMethodImplementClass(
method getMethodMangledName (line 1146) | public getMethodMangledName(
method genrateInitJSGlobalObject (line 1185) | public genrateInitJSGlobalObject(name: string) {
method setDebugLocation (line 1206) | private setDebugLocation(
FILE: src/backend/binaryen/lib/array_utils.ts
function array_get_length_i32 (line 9) | function array_get_length_i32(
function array_get_data (line 22) | function array_get_data(
FILE: src/backend/binaryen/lib/dyntype/utils.ts
type ExtObjKind (line 39) | const enum ExtObjKind {
function updateValueByConfig (line 100) | function updateValueByConfig() {
type StructDyn (line 109) | const enum StructDyn {
FILE: src/backend/binaryen/lib/env_init.ts
function importAnyLibAPI (line 17) | function importAnyLibAPI(module: binaryen.Module) {
function importInfcLibAPI (line 368) | function importInfcLibAPI(module: binaryen.Module) {
function importMemoryAPI (line 466) | function importMemoryAPI(module: binaryen.Module) {
function generateGlobalContext (line 484) | function generateGlobalContext(module: binaryen.Module) {
function generateGlobalJSObject (line 493) | function generateGlobalJSObject(module: binaryen.Module, name: string) {
function generateExtRefTableMaskArr (line 502) | function generateExtRefTableMaskArr(module: binaryen.Module) {
function generateDynContext (line 512) | function generateDynContext(module: binaryen.Module) {
function addItableFunc (line 521) | function addItableFunc(module: binaryen.Module) {
FILE: src/backend/binaryen/lib/init_builtin_api.ts
function anyrefCond (line 54) | function anyrefCond(module: binaryen.Module) {
function getPropNameThroughMeta (line 98) | function getPropNameThroughMeta(module: binaryen.Module) {
function string_concat (line 312) | function string_concat(module: binaryen.Module) {
function string_concat_stringref (line 503) | function string_concat_stringref(module: binaryen.Module) {
function string_eq (line 589) | function string_eq(module: binaryen.Module) {
function string_eq_stringref (line 684) | function string_eq_stringref(module: binaryen.Module) {
function string_slice (line 704) | function string_slice(module: binaryen.Module) {
function string_slice_stringref (line 844) | function string_slice_stringref(module: binaryen.Module) {
function string_replace (line 931) | function string_replace(module: binaryen.Module) {
function string_replace_stringref (line 1108) | function string_replace_stringref(module: binaryen.Module) {
function string_split (line 1197) | function string_split(module: binaryen.Module) {
function string_split_stringref (line 1446) | function string_split_stringref(module: binaryen.Module) {
function string_indexOf_internal (line 1624) | function string_indexOf_internal(module: binaryen.Module) {
function string_indexOf (line 1803) | function string_indexOf(module: binaryen.Module) {
function string_indexOf_internal_stringref (line 1831) | function string_indexOf_internal_stringref(module: binaryen.Module) {
function string_indexOf_stringref (line 1957) | function string_indexOf_stringref(module: binaryen.Module) {
function string_lastIndexOf_stringref (line 1980) | function string_lastIndexOf_stringref(module: binaryen.Module) {
function string_match (line 2003) | function string_match(module: binaryen.Module) {
function string_match_stringref (line 2177) | function string_match_stringref(module: binaryen.Module) {
function string_search (line 2276) | function string_search(module: binaryen.Module) {
function string_search_stringref (line 2315) | function string_search_stringref(module: binaryen.Module) {
function string_charAt (line 2338) | function string_charAt(module: binaryen.Module) {
function string_charAt_stringref (line 2462) | function string_charAt_stringref(module: binaryen.Module) {
function string_substring_stringref (line 2525) | function string_substring_stringref(module: binaryen.Module) {
function string_charCodeAt_stringref (line 2625) | function string_charCodeAt_stringref(module: binaryen.Module) {
function string_toLowerCase (line 2682) | function string_toLowerCase(module: binaryen.Module) {
function string_toLowerCase_stringref (line 2686) | function string_toLowerCase_stringref(module: binaryen.Module) {
function string_toUpperCase (line 2690) | function string_toUpperCase(module: binaryen.Module) {
function string_toUpperCase_stringref (line 2694) | function string_toUpperCase_stringref(module: binaryen.Module) {
function string_toLowerOrUpperCase_internal (line 2698) | function string_toLowerOrUpperCase_internal(
function string_trim (line 2903) | function string_trim(module: binaryen.Module) {
function string_trim_stringref (line 3095) | function string_trim_stringref(module: binaryen.Module) {
function Array_isArray (line 3201) | function Array_isArray(module: binaryen.Module) {
function allocExtRefTableSlot (line 3248) | function allocExtRefTableSlot(module: binaryen.Module) {
function newExtRef (line 3392) | function newExtRef(module: binaryen.Module) {
function getPropertyIfTypeIdMismatch (line 3422) | function getPropertyIfTypeIdMismatch(module: binaryen.Module) {
function setPropertyIfTypeIdMismatch (line 3511) | function setPropertyIfTypeIdMismatch(module: binaryen.Module) {
function arrayBufferConstructor (line 3689) | function arrayBufferConstructor(module: binaryen.Module) {
function dataViewConstructor (line 3714) | function dataViewConstructor(module: binaryen.Module) {
function dataView_basicOps (line 3793) | function dataView_basicOps(
function load_i8 (line 3951) | function load_i8(
function convertI32ToUnsignedValue (line 3976) | function convertI32ToUnsignedValue(
function dataView_setInt8 (line 4013) | function dataView_setInt8(module: binaryen.Module) {
function dataView_setInt16 (line 4056) | function dataView_setInt16(module: binaryen.Module) {
function dataView_setInt32 (line 4120) | function dataView_setInt32(module: binaryen.Module) {
function dataView_setFloat32 (line 4188) | function dataView_setFloat32(module: binaryen.Module) {
function dataView_setFloat64 (line 4264) | function dataView_setFloat64(module: binaryen.Module) {
function store_i8 (line 4346) | function store_i8(
function convertI32ToSignedValue (line 4373) | function convertI32ToSignedValue(
function dataView_getInt8 (line 4417) | function dataView_getInt8(module: binaryen.Module, isSigned: boolean) {
function dataView_getInt16 (line 4474) | function dataView_getInt16(module: binaryen.Module, isSigned: boolean) {
function dataView_getInt32 (line 4556) | function dataView_getInt32(module: binaryen.Module, isSigned: boolean) {
function dataView_getFloat32 (line 4636) | function dataView_getFloat32(module: binaryen.Module) {
function dataView_getFloat64 (line 4714) | function dataView_getFloat64(module: binaryen.Module) {
function string_fromCharCode (line 4796) | function string_fromCharCode(module: binaryen.Module) {
function generateSwitchBlock (line 4883) | function generateSwitchBlock(
function WASMStruct_get_field (line 5090) | function WASMStruct_get_field(module: binaryen.Module) {
function callBuiltInAPIs (line 5173) | function callBuiltInAPIs(module: binaryen.Module) {
function addArrayMethod (line 6417) | function addArrayMethod(
FILE: src/backend/binaryen/lib/interface/meta.c
type MetaProperty (line 17) | typedef struct MetaProperty {
type Meta (line 29) | typedef struct Meta {
type propertyFlag (line 37) | enum propertyFlag {
function find_property_flag_and_index (line 49) | int find_property_flag_and_index(Meta *meta, char *prop_name, enum prope...
function find_property_type (line 69) | int find_property_type(Meta *meta, char *prop_name, enum propertyFlag fl...
FILE: src/backend/binaryen/memory.ts
function i64New (line 11) | function i64New(lowBits: number, highBits: number) {
function i64Add (line 15) | function i64Add(leftI64: Long, rightI64: Long) {
function i64Align (line 19) | function i64Align(i64Value: Long, alignment: number) {
function initGlobalOffset (line 26) | function initGlobalOffset(module: binaryen.Module, usedMemory: number) {
function initDefaultMemory (line 60) | function initDefaultMemory(
function initDefaultTable (line 72) | function initDefaultTable(module: binaryen.Module): void {
FILE: src/backend/binaryen/utils.ts
type DynType (line 60) | const enum DynType {
type FlattenLoop (line 77) | interface FlattenLoop {
type IfStatementInfo (line 85) | interface IfStatementInfo {
type BackendLocalVar (line 91) | interface BackendLocalVar {
type ItableFlag (line 96) | enum ItableFlag {
type StructFieldIndex (line 104) | const enum StructFieldIndex {
type VtableFieldIndex (line 108) | const enum VtableFieldIndex {
constant SIZE_OF_META_FIELD (line 112) | const SIZE_OF_META_FIELD = 12;
type MetaDataOffset (line 114) | const enum MetaDataOffset {
type MetaPropertyOffset (line 121) | const enum MetaPropertyOffset {
type SourceMapLoc (line 127) | interface SourceMapLoc {
type NativeSignatureConversion (line 132) | const enum NativeSignatureConversion {
constant META_FLAG_MASK (line 141) | const META_FLAG_MASK = 0x0000000f;
constant META_INDEX_MASK (line 142) | const META_INDEX_MASK = 0xfffffff0;
function getFuncName (line 145) | function getFuncName(
function getBuiltinClassCtorName (line 153) | function getBuiltinClassCtorName(className: string) {
function getBuiltinClassMethodName (line 161) | function getBuiltinClassMethodName(
function getLastElemOfBuiltinName (line 172) | function getLastElemOfBuiltinName(builtinName: string) {
function addWatFuncs (line 177) | function addWatFuncs(
function isSupportedStringOP (line 193) | function isSupportedStringOP(opKind: ts.SyntaxKind) {
function getCString (line 209) | function getCString(str: string) {
function clearWasmStringMap (line 224) | function clearWasmStringMap() {
function utf16ToUtf8 (line 228) | function utf16ToUtf8(utf16String: string): string {
function getEmptyRef (line 261) | function getEmptyRef(module: binaryen.Module) {
function resetDynContextRef (line 268) | function resetDynContextRef() {
function getDynContextRef (line 272) | function getDynContextRef(module: binaryen.Module) {
function flattenLoopStatement (line 286) | function flattenLoopStatement(
function getVarDefaultValue (line 331) | function getVarDefaultValue(
function getStaticType (line 360) | function getStaticType(type: ValueType) {
function isUnionWithUndefined (line 373) | function isUnionWithUndefined(type: ValueType) {
function generateStringForStructArrayStr (line 381) | function generateStringForStructArrayStr(
function generateStringForStringref (line 411) | function generateStringForStringref(
function generateDynNumber (line 427) | function generateDynNumber(
function generateDynBoolean (line 438) | function generateDynBoolean(
function generateDynString (line 449) | function generateDynString(
function generateDynNull (line 460) | function generateDynNull(module: binaryen.Module) {
function isDynUndefined (line 468) | function isDynUndefined(
function generateDynUndefined (line 479) | function generateDynUndefined(module: binaryen.Module) {
function generateDynArray (line 487) | function generateDynArray(
function generateDynObj (line 498) | function generateDynObj(module: binaryen.Module) {
function setDynArrElem (line 506) | function setDynArrElem(
function getDynArrElem (line 519) | function getDynArrElem(
function setDynObjProp (line 531) | function setDynObjProp(
function getDynObjProp (line 544) | function getDynObjProp(
function getObjKeys (line 556) | function getObjKeys(
function generateDynExtref (line 567) | function generateDynExtref(
function getExtTagRefByTypeKind (line 587) | function getExtTagRefByTypeKind(
function getExtTagRefByTypeIdRef (line 610) | function getExtTagRefByTypeIdRef(
function generateDynExtrefByTypeKind (line 631) | function generateDynExtrefByTypeKind(
function generateCondition (line 651) | function generateCondition(
function unboxAny (line 720) | function unboxAny(
function unboxAnyToBase (line 750) | function unboxAnyToBase(
function isBaseType (line 817) | function isBaseType(
function convertTypeToI32 (line 829) | function convertTypeToI32(
function convertTypeToI64 (line 865) | function convertTypeToI64(
function convertTypeToF32 (line 897) | function convertTypeToF32(
function convertTypeToF64 (line 928) | function convertTypeToF64(
function unboxAnyToExtrefWithoutCast (line 958) | function unboxAnyToExtrefWithoutCast(
function unboxAnyToExtref (line 977) | function unboxAnyToExtref(
function boxToAny (line 996) | function boxToAny(
function boxBaseTypeToAny (line 1055) | function boxBaseTypeToAny(
function boxLiteralToAny (line 1086) | function boxLiteralToAny(
function boxNonLiteralToAny (line 1102) | function boxNonLiteralToAny(
function operateF64F64 (line 1137) | function operateF64F64(
function operateStringString (line 1266) | function operateStringString(
function operateRefRef (line 1354) | function operateRefRef(
function operateF64I32 (line 1400) | function operateF64I32(
function operateI32F64 (line 1437) | function operateI32F64(
function operateI32I32 (line 1478) | function operateI32I32(
function operateI64I64 (line 1561) | function operateI64I64(
function operateF32F32 (line 1686) | function operateF32F32(
function treatAsAny (line 1816) | function treatAsAny(typeKind: ValueTypeKind) {
function operateAnyAny (line 1827) | function operateAnyAny(
function operateStaticNullUndefined (line 1869) | function operateStaticNullUndefined(
function operatorAnyStatic (line 1902) | function operatorAnyStatic(
function judgeRealType (line 2034) | function judgeRealType(
function operateStaticToDyn (line 2062) | function operateStaticToDyn(
function operateF64F64ToDyn (line 2091) | function operateF64F64ToDyn(
function operateStrStrToDyn (line 2126) | function operateStrStrToDyn(
function oprateF64F64ToDyn (line 2155) | function oprateF64F64ToDyn(
function getArrayRefLen (line 2184) | function getArrayRefLen(
function getStringRefLen (line 2226) | function getStringRefLen(
function setArrayElemByIdx (line 2255) | function setArrayElemByIdx(
function getArrayElemByIdx (line 2283) | function getArrayElemByIdx(
function getFieldFromMetaByOffset (line 2312) | function getFieldFromMetaByOffset(
function getWasmStructFieldByIndex (line 2320) | function getWasmStructFieldByIndex(
function getWASMObjectVtable (line 2335) | function getWASMObjectVtable(
function getWASMObjectMeta (line 2347) | function getWASMObjectMeta(
function getPropFlagFromObj (line 2360) | function getPropFlagFromObj(
function getPropIndexFromObj (line 2368) | function getPropIndexFromObj(
function isPropertyUnExist (line 2376) | function isPropertyUnExist(
function isFieldFlag (line 2383) | function isFieldFlag(
function isMethodFlag (line 2390) | function isMethodFlag(
function isShapeCompatible (line 2397) | function isShapeCompatible(
function getPredefinedTypeId (line 2421) | function getPredefinedTypeId(type: ValueType): PredefinedTypeId {
function isPropTypeIdEqual (line 2469) | function isPropTypeIdEqual(
function isPropTypeIdIsObject (line 2477) | function isPropTypeIdIsObject(
function isPropTypeIdIsFunction (line 2487) | function isPropTypeIdIsFunction(
function isPropTypeIdIsNullable (line 2497) | function isPropTypeIdIsNullable(
function isPropTypeIdCompatible (line 2507) | function isPropTypeIdCompatible(
function copyStringToLinearMemory (line 2534) | function copyStringToLinearMemory(
function copyArrayBufferToLinearMemory (line 2586) | function copyArrayBufferToLinearMemory(
function copyLinearMemoryToArrayBuffer (line 2670) | function copyLinearMemoryToArrayBuffer(
function generateConvertRule (line 2747) | function generateConvertRule(
function parseNativeSignatureConversion (line 2777) | function parseNativeSignatureConversion(
function parseNativeSignature (line 2794) | function parseNativeSignature(
FILE: src/backend/binaryen/wasm_expr_gen.ts
class WASMExpressionGen (line 126) | class WASMExpressionGen {
method constructor (line 130) | constructor(private wasmCompiler: WASMGen) {
method wasmExprGen (line 135) | wasmExprGen(value: SemanticsValue): binaryen.ExpressionRef {
method wasmSuper (line 267) | private wasmSuper(value: SuperValue): binaryen.ExpressionRef {
method wasmLiteral (line 291) | private wasmLiteral(value: LiteralValue): binaryen.ExpressionRef {
method createStringRef (line 343) | private createStringRef(value: string): binaryen.ExpressionRef {
method encodeStringrefToLinearMemory (line 353) | private encodeStringrefToLinearMemory(stringref: binaryen.ExpressionRe...
method getStringOffset (line 394) | private getStringOffset(value: string): binaryen.ExpressionRef {
method wasmGetValue (line 400) | private wasmGetValue(value: VarValue): binaryen.ExpressionRef {
method wasmGetClosure (line 507) | private wasmGetClosure(value: NewClosureFunction): binaryen.Expression...
method createClosureStruct (line 511) | private createClosureStruct(funcNode: FunctionDeclareNode) {
method wasmSetValue (line 535) | private wasmSetValue(
method wasmBinaryExpr (line 596) | private wasmBinaryExpr(value: BinaryExprValue): binaryen.ExpressionRef {
method wasmCommaExpr (line 613) | private wasmCommaExpr(value: CommaExprValue): binaryen.ExpressionRef {
method wasmAnyGen (line 622) | private wasmAnyGen(expr: SemanticsValue): binaryen.ExpressionRef {
method operateBinaryExpr (line 627) | operateBinaryExpr(
method assignBinaryExpr (line 803) | private assignBinaryExpr(
method wasmPostUnaryExpr (line 821) | private wasmPostUnaryExpr(
method wasmPreUnaryExpr (line 887) | private wasmPreUnaryExpr(
method wasmConditionalExpr (line 943) | private wasmConditionalExpr(
method wasmInstanceOf (line 963) | private wasmInstanceOf(
method setThisRefToClosure (line 1048) | private setThisRefToClosure(
method getFuncRefFromClosure (line 1060) | private getFuncRefFromClosure(
method callClosureInternal (line 1074) | private callClosureInternal(
method callBuiltinOrStaticMethod (line 1115) | private callBuiltinOrStaticMethod(
method wasmOffsetCall (line 1147) | private wasmOffsetCall(value: OffsetCallValue) {
method wasmDirectCall (line 1196) | private wasmDirectCall(value: DirectCallValue) {
method wasmFunctionCall (line 1245) | private wasmFunctionCall(value: FunctionCallValue): binaryen.Expressio...
method wasmEnumerateKeysGet (line 1279) | private wasmEnumerateKeysGet(value: EnumerateKeysGetValue) {
method wasmClosureCall (line 1308) | private wasmClosureCall(value: ClosureCallValue): binaryen.ExpressionR...
method callClassMethod (line 1314) | private callClassMethod(
method callClassStaticMethod (line 1371) | private callClassStaticMethod(
method wasmAnyCall (line 1391) | private wasmAnyCall(value: AnyCallValue) {
method wasmVtableCall (line 1407) | private wasmVtableCall(value: VTableCallValue) {
method wasmDynamicCall (line 1501) | private wasmDynamicCall(value: DynamicCallValue): binaryen.ExpressionR...
method wasmShapeCall (line 1560) | private wasmShapeCall(value: ShapeCallValue): binaryen.ExpressionRef {
method wasmAnyCast (line 1666) | private wasmAnyCast(value: CastValue): binaryen.ExpressionRef {
method wasmValueCast (line 1738) | private wasmValueCast(value: CastValue) {
method parseArguments (line 1863) | private parseArguments(
method initArray (line 1962) | private initArray(arrType: ArrayType, elements: SemanticsValue[]) {
method fixVtableIndex (line 1970) | private fixVtableIndex(
method fixFieldIndex (line 2000) | private fixFieldIndex(
method setObjField (line 2025) | private setObjField(
method setObjMethod (line 2038) | private setObjMethod(
method getBuiltinObjField (line 2060) | private getBuiltinObjField(
method getObjField (line 2074) | private getObjField(
method getObjMethod (line 2088) | private getObjMethod(
method getObjMethodAsClosure (line 2110) | private getObjMethodAsClosure(
method callFuncRef (line 2120) | private callFuncRef(
method callFunc (line 2155) | private callFunc(
method wasmObjFieldSet (line 2180) | private wasmObjFieldSet(
method setInstProperty (line 2205) | private setInstProperty(
method setInfcProperty (line 2249) | private setInfcProperty(
method setObjProperty (line 2325) | private setObjProperty(
method getInstProperty (line 2349) | private getInstProperty(
method getInfcProperty (line 2382) | private getInfcProperty(
method getObjProperty (line 2478) | private getObjProperty(
method getPropFlagAndIdxRefFromObj (line 2555) | private getPropFlagAndIdxRefFromObj(
method getPropTypeIdRefFromObj (line 2567) | private getPropTypeIdRefFromObj(
method getClosureOfFunc (line 2580) | private getClosureOfFunc(
method wasmNewLiteralObj (line 2595) | private wasmNewLiteralObj(value: NewLiteralObjectValue) {
method wasmObjCast (line 2631) | private wasmObjCast(value: CastValue) {
method infcCastToObj (line 2682) | private infcCastToObj(ref: binaryen.ExpressionRef, toType: ObjectType) {
method wasmNewClass (line 2704) | private wasmNewClass(value: NewConstructorObjectValue) {
method getClassStaticField (line 2749) | private getClassStaticField(
method wasmObjFieldGet (line 2777) | private wasmObjFieldGet(
method getIndirectValueRef (line 2862) | getIndirectValueRef(
method dynGetInfcProperty (line 2984) | private dynGetInfcProperty(
method dynGetInfcUnionProperty (line 3070) | private dynGetInfcUnionProperty(
method dynGetInfcUnionPropertyHelper (line 3140) | private dynGetInfcUnionPropertyHelper(
method setIndirectValueRef (line 3183) | setIndirectValueRef(
method dynSetInfcProperty (line 3289) | private dynSetInfcProperty(
method dynSetInfcUnionProperty (line 3375) | private dynSetInfcUnionProperty(
method dynSetInfcUnionPropertyHelper (line 3440) | private dynSetInfcUnionPropertyHelper(
method wasmDirectGetter (line 3487) | private wasmDirectGetter(value: DirectGetterValue) {
method wasmDirectSetter (line 3501) | private wasmDirectSetter(value: DirectSetterValue) {
method getTruthIdx (line 3519) | private getTruthIdx(
method getMemberByName (line 3534) | private getMemberByName(meta: ObjectDescription, propName: string) {
method wasmDynamicGet (line 3548) | private wasmDynamicGet(value: DynamicGetValue) {
method wasmDynamicSet (line 3711) | private wasmDynamicSet(value: DynamicSetValue) {
method wasmNewLiteralArray (line 3751) | private wasmNewLiteralArray(value: NewLiteralArrayValue) {
method wasmNewArray (line 3781) | private wasmNewArray(value: NewArrayValue | NewArrayLenValue) {
method elemOp (line 3833) | private elemOp(value: ElementGetValue | ElementSetValue) {
method wasmElemGet (line 3880) | private wasmElemGet(value: ElementGetValue) {
method wasmElemSet (line 4051) | private wasmElemSet(value: ElementSetValue) {
method wasmBlockValue (line 4138) | private wasmBlockValue(value: BlockValue) {
method wasmBlockIFValue (line 4151) | private wasmBlockIFValue(value: BlockBranchIfValue) {
method wasmBlockBranchValue (line 4164) | private wasmBlockBranchValue(value: BlockBranchValue) {
method getArrayInitFromArrayType (line 4169) | private getArrayInitFromArrayType(
method generateDynamicArg (line 4213) | private generateDynamicArg(args?: Array<SemanticsValue>) {
method dyntypeInvoke (line 4253) | private dyntypeInvoke(
method wasmTypeof (line 4284) | private wasmTypeof(value: TypeofValue): binaryen.ExpressionRef {
method wasmTemplateExpr (line 4300) | private wasmTemplateExpr(value: TemplateExprValue): binaryen.Expressio...
method wasmToString (line 4342) | private wasmToString(value: ToStringValue): binaryen.ExpressionRef {
method wasmObjTypeCastToAny (line 4365) | private wasmObjTypeCastToAny(value: CastValue) {
method createTmpVarOfSpecifiedType (line 4651) | private createTmpVarOfSpecifiedType(
method wasmReBinding (line 4661) | private wasmReBinding(value: ReBindingValue) {
method wasmSpread (line 4696) | private wasmSpread(value: SpreadValue) {
method wasmElemsToArr (line 4717) | private wasmElemsToArr(values: SemanticsValue[], arrType: ValueType) {
method wasmArrayConcat (line 5079) | private wasmArrayConcat(
FILE: src/backend/binaryen/wasm_stmt_gen.ts
class WASMStatementGen (line 38) | class WASMStatementGen {
method constructor (line 41) | constructor(private wasmCompiler: WASMGen) {
method WASMStmtGen (line 45) | WASMStmtGen(stmt: SemanticsNode): binaryen.ExpressionRef {
method wasmIf (line 106) | wasmIf(stmt: IfNode): binaryen.ExpressionRef {
method wasmBlock (line 138) | wasmBlock(stmt: BlockNode): binaryen.ExpressionRef {
method wasmReturn (line 162) | wasmReturn(stmt: ReturnNode): binaryen.ExpressionRef {
method wasmEmpty (line 185) | wasmEmpty(): binaryen.ExpressionRef {
method wasmLoop (line 189) | wasmLoop(stmt: WhileNode): binaryen.ExpressionRef {
method wasmFor (line 232) | wasmFor(stmt: ForNode): binaryen.ExpressionRef {
method wasmSwitch (line 281) | wasmSwitch(stmt: SwitchNode): binaryen.ExpressionRef {
method wasmBreakOrContinue (line 330) | wasmBreakOrContinue(
method wasmBasicExpr (line 336) | wasmBasicExpr(stmt: BasicBlockNode): binaryen.ExpressionRef {
method wasmTry (line 348) | wasmTry(stmt: TryNode): binaryen.ExpressionRef {
method wasmThrow (line 434) | wasmThrow(stmt: ThrowNode): binaryen.ExpressionRef {
method addDebugInfoRef (line 444) | addDebugInfoRef(
FILE: src/backend/binaryen/wasm_type_gen.ts
class WASMTypeGen (line 64) | class WASMTypeGen {
method constructor (line 108) | constructor(private wasmComp: WASMGen) {
method parseCircularRecType (line 112) | parseCircularRecType(): void {
method createWASMType (line 131) | createWASMType(type: ValueType): void {
method createWASMBaseType (line 183) | createWASMBaseType(type: ValueType): void {
method createWASMEmptyType (line 237) | createWASMEmptyType(type: EmptyType) {
method createWASMContextType (line 242) | createWASMContextType(type: ClosureContextType) {
method createWASMFuncType (line 296) | createWASMFuncType(funcType: FunctionType) {
method createWASMArrayType (line 395) | createWASMArrayType(arrayType: ArrayType) {
method createWASMArrayBufferType (line 458) | createWASMArrayBufferType(type: ObjectType) {
method createWASMDataViewType (line 463) | createWASMDataViewType(type: ObjectType) {
method createWASMBuiltinType (line 468) | createWASMBuiltinType(type: ObjectType) {
method createWASMObjectType (line 487) | createWASMObjectType(type: ObjectType) {
method createWASMInfcType (line 511) | createWASMInfcType(type: ObjectType) {
method createWASMEnumType (line 516) | createWASMEnumType(type: EnumType) {
method createWASMTupleType (line 520) | createWASMTupleType(type: TupleType) {
method createWASMRawType (line 548) | createWASMRawType(type: ValueType) {
method createWASMArrayRawType (line 567) | createWASMArrayRawType(type: WASMArrayType) {
method createWASMStructRawType (line 619) | createWASMStructRawType(type: WASMStructType) {
method getObjSpecialSuffix (line 701) | getObjSpecialSuffix(type: ArrayType) {
method createWASMClassType (line 732) | createWASMClassType(type: ObjectType, isInfc = false) {
method createWASMSpecializeType (line 911) | createWASMSpecializeType(type: TypeParameterType) {
method createWASMGenericType (line 926) | createWASMGenericType(type: ValueType, typeArg: ValueType | null = nul...
method hasHeapType (line 938) | hasHeapType(type: ValueType): boolean {
method heapType (line 952) | get heapType() {
method getWASMType (line 956) | getWASMType(type: ValueType): binaryenCAPI.TypeRef {
method getWASMHeapType (line 963) | getWASMHeapType(type: ValueType): binaryenCAPI.HeapTypeRef {
method getWASMValueType (line 971) | getWASMValueType(type: ValueType): binaryenCAPI.TypeRef {
method getWASMValueHeapType (line 982) | getWASMValueHeapType(type: ValueType): binaryenCAPI.HeapTypeRef {
method getWASMFuncParamTypes (line 995) | getWASMFuncParamTypes(type: ValueType): binaryenCAPI.TypeRef[] {
method getWASMFuncOriParamTypes (line 1002) | getWASMFuncOriParamTypes(type: ValueType): binaryenCAPI.TypeRef[] {
method getWASMArrayOriType (line 1009) | getWASMArrayOriType(type: ValueType): binaryenCAPI.TypeRef {
method getWASMArrayOriHeapType (line 1017) | getWASMArrayOriHeapType(type: ValueType): binaryenCAPI.HeapTypeRef {
method getWASMObjOriType (line 1024) | getWASMObjOriType(type: ValueType): binaryenCAPI.TypeRef {
method getWASMObjOriHeapType (line 1031) | getWASMObjOriHeapType(type: ValueType): binaryenCAPI.HeapTypeRef {
method getWASMVtableType (line 1038) | getWASMVtableType(type: ValueType): binaryenCAPI.TypeRef {
method getWASMVtableHeapType (line 1045) | getWASMVtableHeapType(type: ValueType): binaryenCAPI.HeapTypeRef {
method getWASMStaticFieldsType (line 1052) | getWASMStaticFieldsType(type: ValueType): binaryenCAPI.TypeRef {
method getWASMStaticFieldsHeapType (line 1059) | getWASMStaticFieldsHeapType(type: ValueType): binaryenCAPI.HeapTypeRef {
method getWASMVtableInst (line 1068) | getWASMVtableInst(type: ValueType): binaryen.ExpressionRef {
method getWASMThisInst (line 1075) | getWASMThisInst(type: ValueType): binaryen.ExpressionRef {
method updateStaticFields (line 1082) | updateStaticFields(type: ObjectType) {
method createCustomTypeName (line 1162) | private createCustomTypeName(
method createRecObjectType (line 1173) | private createRecObjectType() {
method isInRecGroup (line 1334) | private isInRecGroup(type: ValueType) {
method createTbIndexForType (line 1356) | private createTbIndexForType(type: ValueType) {
method getExistWasmArrType (line 1370) | private getExistWasmArrType(arrayType: ArrayType) {
method parseObjectMembers (line 1397) | private parseObjectMembers(
method createTypeForStaticFields (line 1535) | private createTypeForStaticFields(
method createStaticFields (line 1575) | private createStaticFields(type: ObjectType) {
method createVtableInst (line 1588) | private createVtableInst(
FILE: src/backend/index.ts
method constructor (line 11) | constructor(protected parserContext: ParserContext) {}
type SegmentInfo (line 20) | interface SegmentInfo {
class DataSegmentContext (line 25) | class DataSegmentContext {
method constructor (line 33) | constructor() {
method addData (line 40) | addData(data: Uint8Array, alignment = 4) {
method addString (line 60) | addString(str: string, alignment = 4) {
method generateSegment (line 93) | generateSegment(): SegmentInfo | null {
method getDataEnd (line 116) | getDataEnd(): number {
FILE: src/dump_ast.ts
function operatorString (line 8) | function operatorString(kind: ts.BinaryOperator) {
function nodeToString (line 92) | function nodeToString(node: ts.Node): string {
function visit (line 836) | function visit(node: ts.Node, prefix: string) {
function dumpASTNode (line 841) | function dumpASTNode(sourceFile: ts.SourceFile) {
function DumpAST (line 845) | function DumpAST(fileNames: string[]) {
function ObjectMemberToString (line 898) | function ObjectMemberToString(v: any, objvalues: Set<any>): string {
function ObjectToString (line 915) | function ObjectToString(obj: any): string {
FILE: src/error.ts
class SyntaxError (line 6) | class SyntaxError extends Error {
method constructor (line 7) | constructor(message: string) {
class UnimplementError (line 12) | class UnimplementError extends Error {
method constructor (line 13) | constructor(message: string) {
class ValidateError (line 18) | class ValidateError extends Error {
method constructor (line 19) | constructor(message: string) {
class TypeError (line 24) | class TypeError extends Error {
method constructor (line 25) | constructor(message: string) {
class ExpressionError (line 30) | class ExpressionError extends Error {
method constructor (line 31) | constructor(message: string) {
class ScopeError (line 36) | class ScopeError extends Error {
method constructor (line 37) | constructor(message: string) {
class SemanticCheckError (line 42) | class SemanticCheckError extends Error {
method constructor (line 43) | constructor(message: string) {
class StatementError (line 48) | class StatementError extends Error {
method constructor (line 49) | constructor(message: string) {
class CommentError (line 54) | class CommentError extends Error {
method constructor (line 55) | constructor(message: string) {
FILE: src/expression.ts
type OperatorKind (line 38) | type OperatorKind = ts.SyntaxKind;
type ExpressionKind (line 39) | type ExpressionKind = ts.SyntaxKind;
class Expression (line 41) | class Expression {
method constructor (line 48) | constructor(kind: ExpressionKind) {
method expressionKind (line 52) | get expressionKind() {
method setExprType (line 56) | setExprType(type: Type) {
method exprType (line 60) | get exprType(): Type {
class NullKeywordExpression (line 65) | class NullKeywordExpression extends Expression {
method constructor (line 66) | constructor() {
class UndefinedKeywordExpression (line 71) | class UndefinedKeywordExpression extends Expression {
method constructor (line 72) | constructor() {
class NumberLiteralExpression (line 77) | class NumberLiteralExpression extends Expression {
method constructor (line 80) | constructor(value: number) {
method expressionValue (line 85) | get expressionValue(): number {
class StringLiteralExpression (line 90) | class StringLiteralExpression extends Expression {
method constructor (line 93) | constructor(value: string) {
method expressionValue (line 98) | get expressionValue(): string {
class ObjectLiteralExpression (line 103) | class ObjectLiteralExpression extends Expression {
method constructor (line 104) | constructor(
method objectFields (line 111) | get objectFields(): IdentifierExpression[] {
method objectValues (line 115) | get objectValues(): Expression[] {
class ArrayLiteralExpression (line 120) | class ArrayLiteralExpression extends Expression {
method constructor (line 121) | constructor(private elements: Expression[]) {
method arrayValues (line 125) | get arrayValues(): Expression[] {
class FalseLiteralExpression (line 130) | class FalseLiteralExpression extends Expression {
method constructor (line 131) | constructor() {
class TrueLiteralExpression (line 136) | class TrueLiteralExpression extends Expression {
method constructor (line 137) | constructor() {
class IdentifierExpression (line 142) | class IdentifierExpression extends Expression {
method constructor (line 145) | constructor(identifier: string) {
method identifierName (line 150) | get identifierName(): string {
class BinaryExpression (line 155) | class BinaryExpression extends Expression {
method constructor (line 160) | constructor(operator: OperatorKind, left: Expression, right: Expressio...
method operatorKind (line 167) | get operatorKind(): OperatorKind {
method leftOperand (line 171) | get leftOperand(): Expression {
method rightOperand (line 175) | get rightOperand(): Expression {
class EnumerateKeysExpression (line 183) | class EnumerateKeysExpression extends Expression {
method constructor (line 186) | constructor(obj: Expression) {
method targetObj (line 191) | get targetObj(): Expression {
class CommaExpression (line 200) | class CommaExpression extends Expression {
method constructor (line 202) | constructor(exprs: Expression[]) {
method exprs (line 206) | get exprs() {
class UnaryExpression (line 211) | class UnaryExpression extends Expression {
method constructor (line 215) | constructor(
method operatorKind (line 225) | get operatorKind(): OperatorKind {
method operand (line 229) | get operand(): Expression {
class ConditionalExpression (line 234) | class ConditionalExpression extends Expression {
method constructor (line 235) | constructor(
method condtion (line 243) | get condtion(): Expression {
method whenTrue (line 247) | get whenTrue(): Expression {
method whenFalse (line 251) | get whenFalse(): Expression {
class CallExpression (line 256) | class CallExpression extends Expression {
method constructor (line 260) | constructor(
method callExpr (line 270) | get callExpr(): Expression {
method callArgs (line 274) | get callArgs(): Expression[] {
method typeArguments (line 278) | get typeArguments(): Type[] | undefined {
class SuperExpression (line 283) | class SuperExpression extends Expression {
method constructor (line 286) | constructor(args?: Expression[]) {
method callArgs (line 291) | get callArgs(): Expression[] | undefined {
class PropertyAccessExpression (line 296) | class PropertyAccessExpression extends Expression {
method constructor (line 302) | constructor(expr: Expression, property: Expression) {
method propertyAccessExpr (line 308) | get propertyAccessExpr(): Expression {
method propertyExpr (line 312) | get propertyExpr(): Expression {
class NewExpression (line 317) | class NewExpression extends Expression {
method constructor (line 323) | constructor(
method newExpr (line 333) | get newExpr(): Expression {
method setArgs (line 337) | setArgs(args: Array<Expression>) {
method newArgs (line 341) | get newArgs(): Array<Expression> | undefined {
method setArrayLen (line 345) | setArrayLen(arrayLen: number) {
method arrayLen (line 349) | get arrayLen(): number {
method setLenExpr (line 353) | setLenExpr(len: Expression) {
method lenExpr (line 357) | get lenExpr(): Expression | null {
method setTypeArguments (line 361) | setTypeArguments(typeArgs: Type[]) {
method typeArguments (line 364) | get typeArguments(): Type[] | undefined {
class ParenthesizedExpression (line 369) | class ParenthesizedExpression extends Expression {
method constructor (line 372) | constructor(expr: Expression) {
method parentesizedExpr (line 377) | get parentesizedExpr(): Expression {
class ElementAccessExpression (line 382) | class ElementAccessExpression extends Expression {
method constructor (line 386) | constructor(expr: Expression, argExpr: Expression) {
method accessExpr (line 392) | get accessExpr(): Expression {
method argExpr (line 396) | get argExpr(): Expression {
class AsExpression (line 401) | class AsExpression extends Expression {
method constructor (line 404) | constructor(expr: Expression) {
method expression (line 409) | get expression(): Expression {
class FunctionExpression (line 414) | class FunctionExpression extends Expression {
method constructor (line 417) | constructor(func: FunctionScope) {
method funcScope (line 422) | get funcScope(): FunctionScope {
class TypeOfExpression (line 427) | class TypeOfExpression extends Expression {
method constructor (line 428) | constructor(private _expr: Expression) {
method expr (line 431) | get expr() {
class SpreadExpression (line 436) | class SpreadExpression extends Expression {
method constructor (line 437) | constructor(private _target: Expression) {
method target (line 440) | get target() {
class TemplateExpression (line 445) | class TemplateExpression extends Expression {
method constructor (line 446) | constructor(
method head (line 453) | get head() {
method spans (line 457) | get spans() {
class TmplSpanExpression (line 462) | class TmplSpanExpression extends Expression {
method constructor (line 463) | constructor(
method expr (line 470) | get expr() {
method literal (line 474) | get literal() {
class ExpressionProcessor (line 478) | class ExpressionProcessor {
method constructor (line 483) | constructor(private parserCtx: ParserContext) {
method visitNode (line 489) | visitNode(node: ts.Node): Expression {
method visitNodeInternal (line 495) | private visitNodeInternal(node: ts.Node): Expression {
method buildTypeArguments (line 1177) | buildTypeArguments(
method specializeExpression (line 1191) | specializeExpression(
FILE: src/frontend.ts
constant COMPILER_OPTIONS (line 30) | const COMPILER_OPTIONS: ts.CompilerOptions = {
class ParserContext (line 42) | class ParserContext {
method constructor (line 77) | constructor() {
method parse (line 91) | parse(fileNames: string[]): void {
method getScopeByNode (line 149) | getScopeByNode(node: ts.Node): Scope | undefined {
method typeResolver (line 163) | get typeResolver() {
method expressionProcessor (line 167) | get expressionProcessor(): ExpressionProcessor {
method statementProcessor (line 171) | get statementProcessor(): StatementProcessor {
method statementSpecializationProcessor (line 175) | get statementSpecializationProcessor(): StatementSpecializationProcess...
method semanticChecker (line 179) | get semanticChecker(): SemanticChecker {
method errorMessage (line 183) | get errorMessage() {
method recGroupTypes (line 187) | set recGroupTypes(recs: TSClass[][]) {
method recGroupTypes (line 191) | get recGroupTypes() {
method dumpScopes (line 195) | dumpScopes(
method generateScopeInfos (line 217) | generateScopeInfos() {
method getCompilerOptions (line 289) | private getCompilerOptions() {
FILE: src/import_resolve.ts
class ImportResolver (line 21) | class ImportResolver {
method constructor (line 26) | constructor(private parserCtx: ParserContext) {
method visit (line 31) | visit() {
method visitNode (line 60) | visitNode(node: ts.Node): void {
FILE: src/log.ts
type LoggerLevel (line 11) | enum LoggerLevel {
class Logger (line 30) | class Logger {
method trace (line 31) | static trace(...args: any[]) {
method debug (line 35) | static debug(...args: any[]) {
method info (line 39) | static info(...args: any[]) {
method warn (line 43) | static warn(...args: any[]) {
method error (line 47) | static error(...args: any[]) {
method getLocation (line 51) | static getLocation(depth = 3): string {
method collectLogs (line 61) | static collectLogs(args: any[], logLevel: LoggerLevel) {
FILE: src/scope.ts
type ScopeKind (line 41) | enum ScopeKind {
type importSearchTypes (line 50) | enum importSearchTypes {
class Scope (line 59) | class Scope {
method constructor (line 82) | constructor(parent: Scope | null) {
method getName (line 91) | public getName() {
method setName (line 95) | public setName(name: string) {
method addStatement (line 99) | addStatement(statement: Statement) {
method statements (line 103) | get statements(): Statement[] {
method addVariable (line 107) | addVariable(variableObj: Variable) {
method addType (line 112) | addType(name: string, type: Type) {
method resetLocalIndex (line 125) | resetLocalIndex() {
method allocateLocalIndex (line 129) | allocateLocalIndex() {
method assignVariableIndex (line 133) | assignVariableIndex(scope: Scope) {
method initVariableIndex (line 147) | initVariableIndex() {
method initParamIndex (line 162) | initParamIndex() {
method addTempVar (line 170) | addTempVar(variableObj: Variable) {
method getTempVars (line 179) | getTempVars() {
method varArray (line 183) | get varArray(): Variable[] {
method addChild (line 187) | addChild(child: Scope) {
method addModifier (line 191) | addModifier(modifier: ts.Node) {
method setGenericOwner (line 195) | setGenericOwner(genericOwner: Scope | undefined) {
method genericOwner (line 199) | get genericOwner(): Scope | undefined {
method addSpecializedScope (line 203) | addSpecializedScope(typeSignature: string, s: Scope) {
method specializedScopes (line 208) | get specializedScopes() {
method _nestFindScopeItem (line 212) | protected _nestFindScopeItem<T>(
method _findInImportScope (line 229) | private _findInImportScope(
method findVariable (line 286) | public findVariable(
method findFunctionScope (line 309) | public findFunctionScope(
method findClassScope (line 328) | public findClassScope(
method findNamespaceScope (line 345) | public findNamespaceScope(
method findType (line 363) | public findType(typeName: string, nested = true): Type | undefined {
method findIdentifier (line 397) | findIdentifier(
method _getScopeByType (line 454) | private _getScopeByType<T>(type: ScopeKind): T | null {
method getNearestFunctionScope (line 465) | getNearestFunctionScope() {
method getNearestClosureEnvironment (line 469) | getNearestClosureEnvironment() {
method getRootGloablScope (line 480) | getRootGloablScope() {
method getRootFunctionScope (line 484) | getRootFunctionScope(): FunctionScope | null {
method addDeclareName (line 500) | public addDeclareName(name: string) {
method isDeclare (line 514) | public isDeclare(): boolean {
method isAbstract (line 525) | public isAbstract(): boolean {
method isDefault (line 536) | public isDefault(): boolean {
method isExport (line 542) | public isExport(): boolean {
method isStatic (line 558) | public isStatic(): boolean {
method isDecorator (line 564) | public isDecorator(): boolean {
method hasDecorator (line 572) | hasDecorator(name: string): boolean {
method traverseScopTree (line 580) | traverseScopTree(traverseMethod: (scope: Scope) => void) {
method specialize (line 588) | specialize(scope: Scope) {
class ClosureEnvironment (line 603) | class ClosureEnvironment extends Scope {
method constructor (line 607) | constructor(parent: Scope | null = null) {
method specialize (line 620) | specialize(scope: ClosureEnvironment) {
class GlobalScope (line 627) | class GlobalScope extends Scope {
method constructor (line 652) | constructor(parent: Scope | null = null) {
method addVariable (line 656) | addVariable(variableObj: Variable) {
method moduleName (line 661) | set moduleName(moduleName: string) {
method moduleName (line 665) | get moduleName(): string {
method startFuncName (line 669) | get startFuncName(): string {
method startFuncName (line 673) | set startFuncName(name: string) {
method startFuncType (line 677) | get startFuncType(): TSFunction {
method addImportIdentifier (line 681) | addImportIdentifier(identifier: string, moduleScope: GlobalScope) {
method addImportDefaultName (line 689) | addImportDefaultName(defaultImportName: string, moduleScope: GlobalSco...
method addImportNameScope (line 693) | addImportNameScope(nameScope: string, moduleScope: GlobalScope) {
method setImportNameAlias (line 697) | setImportNameAlias(nameAliasImportMap: Map<string, string>) {
method setExportNameAlias (line 703) | setExportNameAlias(nameAliasExportMap: Map<string, string>) {
method setExportIdentifierList (line 709) | setExportIdentifierList(exportIdentifierList: Expression[]) {
class FunctionScope (line 714) | class FunctionScope extends ClosureEnvironment {
method constructor (line 726) | constructor(parent: Scope) {
method getThisIndex (line 731) | getThisIndex() {
method addParameter (line 737) | addParameter(parameter: Parameter) {
method paramArray (line 742) | get paramArray(): Parameter[] {
method setFuncName (line 746) | setFuncName(name: string) {
method funcName (line 750) | get funcName(): string {
method isAnonymose (line 754) | get isAnonymose(): boolean {
method setFuncType (line 758) | setFuncType(type: TSFunction) {
method funcType (line 762) | get funcType(): TSFunction {
method setClassName (line 766) | setClassName(name: string) {
method className (line 770) | get className(): string {
method isMethod (line 774) | isMethod(): boolean {
method specialize (line 778) | specialize(funcScope: FunctionScope) {
class BlockScope (line 791) | class BlockScope extends ClosureEnvironment {
method constructor (line 797) | constructor(
class ClassScope (line 809) | class ClassScope extends Scope {
method constructor (line 813) | constructor(parent: Scope, name = '') {
method className (line 819) | get className(): string {
method setClassType (line 823) | setClassType(type: TSClass) {
method classType (line 827) | get classType(): TSClass {
method specialize (line 831) | specialize(classScope: ClassScope) {
class NamespaceScope (line 839) | class NamespaceScope extends Scope {
method constructor (line 842) | constructor(parent: Scope) {
method addVariable (line 847) | addVariable(variableObj: Variable) {
class ScopeScanner (line 853) | class ScopeScanner {
method constructor (line 864) | constructor(private parserCtx: ParserContext) {
method _generateClassFuncScope (line 869) | _generateClassFuncScope(
method visit (line 912) | visit(nodes: Array<ts.SourceFile>) {
method visitNode (line 918) | visitNode(node: ts.Node): void {
method setCurrentScope (line 1180) | setCurrentScope(currentScope: Scope | null) {
method createBlockScope (line 1184) | createBlockScope(node: ts.BlockLike) {
method createLoopBlockScope (line 1213) | createLoopBlockScope(node: ts.IterationStatement) {
method _generateFuncScope (line 1230) | private _generateFuncScope(node: ts.FunctionLikeDeclaration) {
FILE: src/semantic_check.ts
type ErrorKind (line 44) | const enum ErrorKind {
type ErrorFlag (line 51) | const enum ErrorFlag {
type SematicError (line 60) | interface SematicError {
class SemanticChecker (line 67) | class SemanticChecker {
method constructor (line 72) | constructor(private parserCtx: ParserContext) {
method sematicCheck (line 76) | sematicCheck() {
method stmtAccept (line 113) | private stmtAccept(stmt: Statement) {
method exprAccept (line 141) | private exprAccept(expr: Expression | null) {
method varInitAccept (line 164) | private varInitAccept(expr: Variable | Parameter) {
method checkCallExpr (line 178) | private checkCallExpr(expr: CallExpression) {
method returnTypeCheck (line 223) | private returnTypeCheck(expr: Expression) {
method binaryOperateCheck (line 241) | private binaryOperateCheck(left: Type, right: Type) {
method defaultParamAccept (line 250) | private defaultParamAccept() {
method nominalClassCheck (line 264) | private nominalClassCheck(
method invokeAnyObjCheck (line 308) | private invokeAnyObjCheck(left: Type, exprType: Type) {
method voidTypeCheck (line 319) | private voidTypeCheck(typeKind: TypeKind) {
method logErrors (line 330) | private logErrors() {
method getScopeName (line 338) | private getScopeName(scope: Scope): string {
FILE: src/semantics/builder_context.ts
type SymbolKey (line 42) | type SymbolKey = Variable | Scope | Type | Expression;
type SymbolValue (line 43) | type SymbolValue = SemanticsValue | ValueType | SemanticsNode;
type BuildEnv (line 45) | interface BuildEnv {
type ValueReferenceKind (line 55) | enum ValueReferenceKind {
function SymbolKeyToString (line 60) | function SymbolKeyToString(key?: SymbolKey): string {
type Task (line 81) | interface Task {
class BuildContext (line 85) | class BuildContext {
method addFunctionValue (line 99) | addFunctionValue(var_func: VarValue) {
method addClassValue (line 103) | addClassValue(var_class: VarValue) {
method addGlobalValue (line 107) | addGlobalValue(name: string, v: VarValue) {
method getGlobalValue (line 111) | getGlobalValue(name: string): SemanticsValue | undefined {
method pushTask (line 115) | pushTask(task: Task) {
method runAllTasks (line 119) | runAllTasks() {
method constructor (line 129) | constructor(private typeIdx: number, public module: ModuleNode) {}
method nextTypeId (line 131) | nextTypeId(): number {
method currentReference (line 137) | currentReference(): ValueReferenceKind {
method pushReference (line 144) | pushReference(type: ValueReferenceKind) {
method popReference (line 147) | popReference() {
method push (line 151) | push(
method pop (line 167) | pop() {
method top (line 171) | top(): BuildEnv {
method updateNamedSymbolByScope (line 175) | updateNamedSymbolByScope(
method updateNamedSymbol (line 190) | updateNamedSymbol(env: BuildEnv) {
method getOwnerFunctionEnv (line 205) | private getOwnerFunctionEnv(idx: number): BuildEnv | undefined {
method currentFunction (line 213) | currentFunction(): FunctionDeclareNode | undefined {
method getScopeNamespace (line 218) | getScopeNamespace(): string {
method getSymbolKeyByName (line 231) | private getSymbolKeyByName(
method findSymbol (line 239) | findSymbol(
method findVariable (line 251) | findVariable(id: string): SymbolValue | undefined {
method findType (line 255) | findType(id: string): SymbolValue | undefined {
method findFunction (line 259) | findFunction(id: string): SymbolValue | undefined {
method findClass (line 263) | findClass(id: string): SymbolValue | undefined {
method findNamespace (line 267) | findNamespace(id: string): SymbolValue | undefined {
method findSymbolKey (line 271) | findSymbolKey(name: SymbolKey): SymbolValue | undefined {
method buildClosure (line 322) | private buildClosure(
method findValueTypeByKey (line 365) | findValueTypeByKey(name: SymbolKey): ValueType | undefined {
method findValueType (line 376) | findValueType(type: Type): ValueType | undefined {
method setNamedValueType (line 386) | setNamedValueType(name: string, vt: ValueType) {
method getNamedValueType (line 390) | getNamedValueType(name: string): ValueType | undefined {
method buildClosureInitList (line 394) | buildClosureInitList(func: FunctionDeclareNode): VarValue[] | undefined {
method finishBuild (line 427) | finishBuild() {
FILE: src/semantics/builtin.ts
function IsBuiltInObjectType (line 21) | function IsBuiltInObjectType(kind: ValueTypeKind): boolean {
function IsBuiltInType (line 32) | function IsBuiltInType(kind: ValueTypeKind): boolean {
function IsBuiltInTypeButAny (line 40) | function IsBuiltInTypeButAny(kind: ValueTypeKind): boolean {
type ObjectInfo (line 44) | interface ObjectInfo {
type SpecializeInfo (line 52) | interface SpecializeInfo {
function IsBuiltinObject (line 174) | function IsBuiltinObject(name: string): boolean {
function clearBuiltinTypes (line 181) | function clearBuiltinTypes() {
function clearSpecializeList (line 185) | function clearSpecializeList() {
function getObjectAndConstructorInfos (line 189) | function getObjectAndConstructorInfos(name: string): [ObjectInfo, Object...
function ObjectDescriptionFlagToObjectTypeFlag (line 197) | function ObjectDescriptionFlagToObjectTypeFlag(
function init_generic (line 207) | function init_generic(info: ObjectInfo, type: ObjectType) {
function createObjectTypes (line 213) | function createObjectTypes(
function GetBuiltinObjectType (line 240) | function GetBuiltinObjectType(name: string): ObjectType {
function GetAndRemoveObjectSpecializeList (line 283) | function GetAndRemoveObjectSpecializeList(
function ProcessBuiltinObjectSpecializeList (line 291) | function ProcessBuiltinObjectSpecializeList() {
function AddSpecializeObjectType (line 298) | function AddSpecializeObjectType(
function ForEachBuiltinObject (line 309) | function ForEachBuiltinObject(cb: (obj_type: ObjectType) => void) {
function GetShapeFromType (line 314) | function GetShapeFromType(
FILE: src/semantics/dump.ts
type DumpWriter (line 6) | interface DumpWriter {
function CreateDefaultDumpWriter (line 12) | function CreateDefaultDumpWriter(): DumpWriter {
FILE: src/semantics/expression_builder.ts
function isInt (line 190) | function isInt(expr: Expression): boolean {
function toInt (line 200) | function toInt(n: number): number {
function flattenOperator (line 204) | function flattenOperator(opKind: ts.SyntaxKind) {
function getValueFromNamespace (line 265) | function getValueFromNamespace(
function buildPropertyAccessExpression (line 311) | function buildPropertyAccessExpression(
function createDynamicAccess (line 535) | function createDynamicAccess(
function createShapeAccess (line 562) | function createShapeAccess(
function createVTableAccess (line 579) | function createVTableAccess(
function createDirectAccess (line 597) | function createDirectAccess(
function createDirectGet (line 626) | function createDirectGet(
function createDirectSet (line 712) | function createDirectSet(
function SymbolValueToSemanticsValue (line 756) | function SymbolValueToSemanticsValue(
function buildIdentiferExpression (line 809) | function buildIdentiferExpression(
function buildTypeOfExpression (line 853) | function buildTypeOfExpression(
function buildTemplateExpression (line 896) | function buildTemplateExpression(
function findObjectLiteralType (line 912) | function findObjectLiteralType(
function buildObjectLiteralExpression (line 925) | function buildObjectLiteralExpression(
function buildArrayLiteralExpression (line 957) | function buildArrayLiteralExpression(
function isEqualOperator (line 1068) | function isEqualOperator(kind: ts.SyntaxKind): boolean {
function isCompareOperator (line 1085) | function isCompareOperator(kind: ts.SyntaxKind): boolean {
function wrapObjToAny (line 1098) | function wrapObjToAny(value: SemanticsValue, type: ValueType) {
function checkSigned (line 1120) | function checkSigned(tmpValue: BinaryExprValue): boolean {
function judgeIsInt (line 1137) | function judgeIsInt(value: number) {
function judgeIsF32 (line 1145) | function judgeIsF32(value: number) {
function checkOverflow (line 1153) | function checkOverflow(value: LiteralValue, type: ValueType) {
function newCastValue (line 1162) | function newCastValue(
function typeUp (line 1515) | function typeUp(upValue: SemanticsValue, downValue: SemanticsValue): boo...
function needTranslated (line 1586) | function needTranslated(value1: SemanticsValue, value2: SemanticsValue) {
function typeTranslate (line 1598) | function typeTranslate(
function shapeAssignCheck (line 1614) | function shapeAssignCheck(left: ValueType, right: ValueType): boolean {
function newBinaryExprValue (line 1706) | function newBinaryExprValue(
function isMemberSetValue (line 1843) | function isMemberSetValue(v: SemanticsValue): boolean {
function isMemberCallValue (line 1860) | function isMemberCallValue(kind: SemanticsValueKind): boolean {
function isMemberGetValue (line 1870) | function isMemberGetValue(kind: SemanticsValueKind): boolean {
function updateSetValue (line 1881) | function updateSetValue(
function buildBinaryExpression (line 1898) | function buildBinaryExpression(
function buildCommaExpression (line 1975) | function buildCommaExpression(
function buildConditionalExpression (line 1989) | function buildConditionalExpression(
function getClassContructorType (line 2027) | function getClassContructorType(obj_type: ObjectType): SemanticsValue {
function createMemberCallValue (line 2050) | function createMemberCallValue(
function buildParameters (line 2083) | function buildParameters(
function buildTypeArguments (line 2105) | function buildTypeArguments(context: BuildContext, types: Type[]): Value...
function updateValueTypeByTypeArguments (line 2121) | function updateValueTypeByTypeArguments(
class GuessTypeArguments (line 2132) | class GuessTypeArguments {
method constructor (line 2134) | constructor(public typeArguments: TypeParameterType[]) {
method guessType (line 2138) | guessType(templateType: ValueType, valueType: ValueType) {
method updateTypeMap (line 2178) | updateTypeMap(typeType: TypeParameterType, valueType: ValueType) {
method guessObjectType (line 2183) | guessObjectType(templateObjType: ObjectType, objType: ObjectType) {
method guessFunctionType (line 2203) | guessFunctionType(templateFuncType: FunctionType, valueType: FunctionT...
function specializeFuncTypeArgumentsByArgs (line 2236) | function specializeFuncTypeArgumentsByArgs(
function buildCallExpression (line 2277) | function buildCallExpression(
function buildEnumerateKeysExpr (line 2395) | function buildEnumerateKeysExpr(
function buildNewExpression2 (line 2407) | function buildNewExpression2(
function buildNewClass (line 2499) | function buildNewClass(
function buildNewArrayParameters (line 2536) | function buildNewArrayParameters(
function buildNewInterface (line 2597) | function buildNewInterface(
function buildAsExpression (line 2640) | function buildAsExpression(
function buildElementAccessExpression (line 2658) | function buildElementAccessExpression(
function getCurrentClassType (line 2762) | function getCurrentClassType(context: BuildContext): TSClass | undefined {
function buildThisValue2 (line 2774) | function buildThisValue2(context: BuildContext): SemanticsValue {
function buildSuperValue (line 2787) | function buildSuperValue(
function buildSuperExpression (line 2843) | function buildSuperExpression(
function buildUnaryExpression (line 2850) | function buildUnaryExpression(
function buildFunctionExpression (line 2909) | function buildFunctionExpression(
function buildExpression (line 2956) | function buildExpression(
FILE: src/semantics/flatten.ts
function flattenConditionValue (line 104) | function flattenConditionValue(
class FlattenContext (line 146) | class FlattenContext {
method push (line 151) | push(block: BlockValue) {
method pop (line 154) | pop() {
method addValue (line 158) | addValue(value: SemanticsValue) {
method pushAdd (line 164) | pushAdd(block: BlockValue) {
method makeLabel (line 169) | makeLabel(hint: string): string {
method findNearestLoop (line 174) | findNearestLoop(): BlockValue | undefined {
method findNearestBreakTarget (line 184) | findNearestBreakTarget(): BlockValue | undefined {
function buildVarReferenceList (line 194) | function buildVarReferenceList(
function flatternStatement (line 204) | function flatternStatement(
function flattenFunction (line 535) | function flattenFunction(func: FunctionDeclareNode) {
FILE: src/semantics/index.ts
function processTypes (line 71) | function processTypes(context: BuildContext, globalScopes: Array<GlobalS...
function buildStatements (line 84) | function buildStatements(
function processGlobalStatements (line 116) | function processGlobalStatements(context: BuildContext, g: GlobalScope) {
function getFunctionOwnKind (line 162) | function getFunctionOwnKind(f: FunctionScope): number {
function getMethodClassType (line 184) | function getMethodClassType(
function createFunctionDeclareNode (line 204) | function createFunctionDeclareNode(
function processScopesGlobalObjs (line 291) | function processScopesGlobalObjs(context: BuildContext, scopes: Scope[]) {
function isInClosureScope (line 297) | function isInClosureScope(scope: Scope): boolean {
function processGlobalObjs (line 307) | function processGlobalObjs(context: BuildContext, scope: Scope) {
function InitGlobalObj (line 400) | function InitGlobalObj(context: BuildContext, g: GlobalScope) {
function foreachScopeChildren (line 425) | function foreachScopeChildren(context: BuildContext, scope: Scope) {
function generateChildrenFunctionScope (line 431) | function generateChildrenFunctionScope(
function getAllVars (line 444) | function getAllVars(
function generateFunctionScopeNodes (line 460) | function generateFunctionScopeNodes(
function generateClassScopeNodes (line 523) | function generateClassScopeNodes(context: BuildContext, scope: ClassScop...
function generateBlockScopeNodes (line 527) | function generateBlockScopeNodes(context: BuildContext, scope: BlockScop...
function generateNamespaceScopeNodes (line 531) | function generateNamespaceScopeNodes(
function generateScopeNodes (line 542) | function generateScopeNodes(context: BuildContext, scope: Scope) {
function processGlobals (line 559) | function processGlobals(context: BuildContext, parserContext: ParserCont...
function addImportNamespaceItems (line 587) | function addImportNamespaceItems(
function addExportNamespaceItems (line 645) | function addExportNamespaceItems(
function addExternItem (line 704) | function addExternItem(
function processImportsExports (line 772) | function processImportsExports(
function processObjectDescriptions (line 836) | function processObjectDescriptions(context: BuildContext) {
function setRecArraySize (line 850) | function setRecArraySize(recClass: TSClass[][], recObjectType: ObjectTyp...
function removeRecWhichHasInfc (line 863) | function removeRecWhichHasInfc(recGroupTypes: TSClass[][]) {
function BuildModuleNode (line 884) | function BuildModuleNode(parserContext: ParserContext): ModuleNode {
FILE: src/semantics/internal.ts
function getClassMetaName (line 6) | function getClassMetaName(name: string): string {
function getClassPrototypeName (line 10) | function getClassPrototypeName(name: string): string {
FILE: src/semantics/ir/data_pool.ts
constant INC_SIZE (line 6) | const INC_SIZE = 1024 * 4;
class DataPool (line 7) | class DataPool {
method constructor (line 14) | constructor() {
method addString (line 20) | addString(s: string): number {
method getStringCount (line 42) | getStringCount(): number {
method addByte (line 46) | addByte(byte: number): number {
method getCurrentSize (line 52) | getCurrentSize(): number {
method addInt32 (line 56) | addInt32(n: number): number {
method setByte (line 65) | setByte(idx: number, byte: number) {
method setInt32 (line 69) | setInt32(idx: number, n: number) {
method updateBufferSize (line 76) | updateBufferSize(inc_size: number) {
method getData (line 88) | getData(): Uint8Array {
FILE: src/semantics/ir/function.ts
class LocalVars (line 78) | class LocalVars {
method constructor (line 79) | constructor(
method findVar (line 84) | findVar(v: VarDeclareNode): number {
class Context (line 94) | class Context {
method constructor (line 104) | constructor(
method pushLocalVars (line 118) | pushLocalVars(varList?: VarDeclareNode[]) {
method varCount (line 129) | get varCount(): number {
method getLocalVarIndex (line 133) | getLocalVarIndex(value: VarDeclareNode): number {
method getGlobalVarIndex (line 141) | getGlobalVarIndex(value: VarDeclareNode, s: S = S.LOAD): number {
method getFunctionIndex (line 145) | getFunctionIndex(func: FunctionDeclareNode, s: S = S.LOAD): number {
method getClassIndex (line 149) | getClassIndex(clazz: ObjectType, s: S = S.NEW): number {
method getMetaIndex (line 153) | getMetaIndex(meta: ObjectDescription): number {
method getShapeIndex (line 157) | getShapeIndex(shape: Shape): number {
method getClosureIndex (line 161) | getClosureIndex(var_decl: VarDeclareNode): number {
method getParameterIndex (line 165) | getParameterIndex(var_decl: VarDeclareNode): number {
method addString (line 169) | addString(s: string): number {
method calcLocalVarCount (line 173) | private calcLocalVarCount(expr: SemanticsValue): number {
method reset (line 191) | reset() {
method incTemp (line 195) | incTemp(n = 1) {
method decTemp (line 199) | decTemp(n = 1) {
method update (line 203) | update() {
method setBlock (line 208) | setBlock(block: BlockValue, ir_block: IRBlock) {
method getIRBlock (line 212) | getIRBlock(block: BlockValue): IRBlock | undefined {
method topBlock (line 216) | topBlock(): IRBlock {
method pushCode (line 220) | pushCode(op: IRCode) {
method pushBlock (line 224) | pushBlock(ir_block: IRBlock) {
method pushBlockVars (line 228) | pushBlockVars(block: BlockValue) {
method popBlock (line 232) | popBlock() {
method popBlockVars (line 236) | popBlockVars(block: BlockValue) {
class IRFunction (line 243) | class IRFunction extends IRBlock {
method constructor (line 250) | constructor(public vm: IRModule) {
method isStartFunction (line 254) | get isStartFunction(): boolean {
method build (line 260) | build(func: FunctionDeclareNode, global: GlobalContext) {
method name (line 284) | get name(): string {
method buildVar (line 288) | private buildVar(
method buildBlockRefList (line 331) | private buildBlockRefList(context: Context, refList?: VarDeclareNode[]) {
method buildValue (line 339) | private buildValue(value: SemanticsValue, context: Context) {
method buildMethodCall (line 1168) | private buildMethodCall(func: FunctionCallBaseValue, context: Context) {
method buildSaveVar (line 1185) | private buildSaveVar(v: VarValue, context: Context) {
method buildBinaryExprValue (line 1232) | private buildBinaryExprValue(bv: BinaryExprValue, context: Context) {
method pushValue (line 1268) | private pushValue(opcode: IRCode) {
FILE: src/semantics/ir/ir_context.ts
class StatisticsInfo (line 49) | class StatisticsInfo {
type S (line 56) | enum S {
type StatisticsObject (line 64) | type StatisticsObject =
function buildMapAsArray (line 71) | function buildMapAsArray<T>(map: Map<T, number>): T[] {
type ExternItemInfo (line 79) | interface ExternItemInfo {
class GlobalContext (line 84) | class GlobalContext {
method constructor (line 108) | constructor(public readonly module: IRModule) {
method processVars (line 116) | processVars() {
method processFunctions (line 124) | processFunctions() {
method processClasses (line 132) | processClasses() {
method processMetaShapes (line 143) | processMetaShapes() {
method processImportsExports (line 163) | processImportsExports() {
method getVarIndex (line 174) | getVarIndex(decl: VarDeclareNode, s: S = S.LOAD): number {
method getFunctionIndex (line 184) | getFunctionIndex(func: FunctionDeclareNode, s: S = S.CALL): number {
method getClassIndex (line 193) | getClassIndex(clazz: ObjectType, s: S = S.NEW): number {
method getMetaIndex (line 200) | getMetaIndex(meta: ObjectDescription): number {
method getShapeIndex (line 207) | getShapeIndex(shape: Shape): number {
method getImportInfo (line 214) | getImportInfo(type: ExternType): ExternItemInfo | undefined {
method updateStatistics (line 218) | updateStatistics(key: StatisticsObject, s: S) {
method finishBuild (line 241) | finishBuild() {
method buildRuntimeData (line 245) | private buildRuntimeData() {
method buildExternModules (line 260) | private buildExternModules(
method findExternItemIndex (line 289) | private findExternItemIndex(
FILE: src/semantics/ir/ircode.ts
type IRCodeKind (line 30) | enum IRCodeKind {
type IRCodeValueType (line 157) | enum IRCodeValueType {
function isObjectIRValue (line 184) | function isObjectIRValue(type: IRCodeValueType): boolean {
function isIntIRValue (line 192) | function isIntIRValue(type: IRCodeValueType): boolean {
function isStringIRValue (line 196) | function isStringIRValue(type: IRCodeValueType): boolean {
function isNumberIRValue (line 200) | function isNumberIRValue(type: IRCodeValueType): boolean {
function GetIRCodeValueType (line 204) | function GetIRCodeValueType(value: SemanticsValue): IRCodeValueType {
function GetElementKind (line 208) | function GetElementKind(start: IRCodeKind, type: ValueTypeKind): IRCodeK...
function GetIRCodeValueTypeFromType (line 215) | function GetIRCodeValueTypeFromType(type: ValueType): IRCodeValueType {
class IRCode (line 254) | class IRCode {
method constructor (line 255) | constructor(
method index (line 264) | get index(): number {
method offset (line 268) | get offset(): number {
method vtableIndex (line 272) | get vtableIndex(): number {
method shapeIndex (line 276) | get shapeIndex(): number {
method dynamicIndex (line 280) | get dynamicIndex(): number {
method paramCount (line 284) | get paramCount(): number {
method member (line 288) | get member(): string {
method value (line 291) | get value(): any {
method labelId (line 294) | get labelId(): number {
method fromType (line 298) | get fromType(): IRCodeValueType {
method block (line 302) | get block(): IRBlock {
method setTypeArguments (line 306) | setTypeArguments(typeArgs: ValueType[]) {
method typeArguments (line 310) | get typeArguments(): ValueType[] | undefined {
method toString (line 314) | toString(): string {
method LoadConst (line 319) | static LoadConst(value: LiteralValue): IRCode {
method LoadString (line 328) | static LoadString(offset: number): IRCode {
method NewUndefined (line 337) | static NewUndefined(): IRCode {
method NewReturn (line 345) | static NewReturn(vt?: ValueType): IRCode {
method LoadThis (line 353) | static LoadThis(clazz_type: ObjectType): IRCode {
method LoadLocal (line 362) | static LoadLocal(index: number, v: ValueType): IRCode {
method LoadGlobal (line 371) | static LoadGlobal(index: number, v: ValueType): IRCode {
method LoadFunction (line 380) | static LoadFunction(index: number, vt: ValueType): IRCode {
method LoadClass (line 389) | static LoadClass(index: number, obj_type: ObjectType): IRCode {
method LoadParam (line 398) | static LoadParam(idx: number, v: ValueType): IRCode {
method LoadClosure (line 407) | static LoadClosure(index: number, v: ValueType): IRCode {
method NewRef (line 416) | static NewRef(vt?: ValueType): IRCode {
method ReadRef (line 423) | static ReadRef(vt: ValueType): IRCode {
method WriteRef (line 430) | static WriteRef(vt: ValueType): IRCode {
method NewSave (line 438) | static NewSave(v: VarValue): IRCode {
method SaveParam (line 464) | static SaveParam(index: number, type: ValueType): IRCode {
method SaveLocal (line 473) | static SaveLocal(index: number, type: ValueType): IRCode {
method SaveGlobal (line 482) | static SaveGlobal(index: number, type: ValueType): IRCode {
method SaveClosure (line 491) | static SaveClosure(index: number, type: ValueType): IRCode {
method NewBinaryOp (line 500) | static NewBinaryOp(opKind: ValueBinaryOperator, type: ValueType): IRCo...
method NewCall (line 559) | static NewCall(
method NewMethodCall (line 574) | static NewMethodCall(
method NewConstructorCall (line 590) | static NewConstructorCall(
method NewDupStackValue (line 606) | static NewDupStackValue(index: number, vt: ValueType): IRCode {
method NewSwap (line 614) | static NewSwap(): IRCode {
method NewObject (line 618) | static NewObject(idx: number, t: ObjectType): IRCode {
method NewDynamic (line 626) | static NewDynamic(vt: ValueType): IRCode {
method NewArrayLength (line 630) | static NewArrayLength(vt: ValueType): IRCode {
method NewArrayParameters (line 638) | static NewArrayParameters(argc: number, vt: ValueType): IRCode {
method NewClosure (line 647) | static NewClosure(func_idx: number, vt: ValueType): IRCode {
method InitClosureValue (line 656) | static InitClosureValue(idx: number, vt: ValueType): IRCode {
method NewStringIndexGet (line 665) | static NewStringIndexGet(): IRCode {
method NewStringIndexSet (line 673) | static NewStringIndexSet(): IRCode {
method NewArrayIndexGet (line 681) | static NewArrayIndexGet(vt: ValueType): IRCode {
method NewArrayIndexSet (line 689) | static NewArrayIndexSet(vt: ValueType): IRCode {
method NewObjectIndexGet (line 697) | static NewObjectIndexGet(vt: ValueType): IRCode {
method NewObjectIndexSet (line 705) | static NewObjectIndexSet(vt: ValueType): IRCode {
method NewObjectKeyGet (line 713) | static NewObjectKeyGet(vt: ValueType): IRCode {
method NewObjectKeySet (line 721) | static NewObjectKeySet(vt: ValueType): IRCode {
method NewGetOffset (line 729) | static NewGetOffset(offset: number, vt: ValueType): IRCode {
method NewSetOffset (line 738) | static NewSetOffset(offset: number, vt: ValueType): IRCode {
method NewGetVTable (line 747) | static NewGetVTable(index: number, vt: ValueType): IRCode {
method NewSetVTable (line 756) | static NewSetVTable(index: number, vt: ValueType): IRCode {
method NewVTableCall (line 765) | static NewVTableCall(
method NewGetShape (line 778) | static NewGetShape(index: number, vt: ValueType): IRCode {
method NewSetShape (line 787) | static NewSetShape(index: number, vt: ValueType): IRCode {
method NewShapeCall (line 796) | static NewShapeCall(
method NewGetDynamic (line 809) | static NewGetDynamic(index: number): IRCode {
method NewSetDynamic (line 818) | static NewSetDynamic(index: number): IRCode {
method NewDynamicCall (line 827) | static NewDynamicCall(index: number, param_count: number): IRCode {
method NewBlock (line 836) | static NewBlock(block: BlockValue): IRCode {
method NewBindShape (line 846) | static NewBindShape(shape_idx: number, vt: ValueType): IRCode {
method NewBuildShape (line 855) | static NewBuildShape(meta_idx: number, vt: ValueType): IRCode {
method NewBranch (line 864) | static NewBranch(target: IRBlock): IRCode {
method NewBranchIf (line 873) | static NewBranchIf(target: IRBlock, isTrue: boolean): IRCode {
method NewImportFunction (line 882) | static NewImportFunction(moduleIndex: number, funcIndex: number): IRCo...
class IRBlock (line 892) | class IRBlock {
method constructor (line 895) | constructor(
method add (line 900) | add(code: IRCode) {
FILE: src/semantics/ir/irmodule.ts
class MemberDescriptionInfo (line 63) | class MemberDescriptionInfo {
class ObjectDescriptionInfo (line 69) | class ObjectDescriptionInfo {
type ShapeMemberType (line 78) | enum ShapeMemberType {
type ShapeMemberParam (line 85) | interface ShapeMemberParam {
class ShapeMemberInfo (line 92) | class ShapeMemberInfo {
method constructor (line 95) | constructor(type: ShapeMemberType, param?: ShapeMemberParam) {
method type (line 120) | get type(): ShapeMemberType {
method offset (line 124) | get offset(): number {
method method (line 128) | get method(): number {
method getter (line 132) | get getter(): number {
method setter (line 136) | get setter(): number {
method value (line 140) | get value(): number {
class ShapeInfo (line 145) | class ShapeInfo {
function createObjectDescriptionName (line 152) | function createObjectDescriptionName(od: ObjectDescription): string {
class RuntimeExternItem (line 165) | class RuntimeExternItem {
method constructor (line 166) | constructor(
class RuntimeExternModule (line 174) | class RuntimeExternModule {
method constructor (line 175) | constructor(
class RuntimeExternModules (line 182) | class RuntimeExternModules {
method constructor (line 184) | constructor(public readonly modules: RuntimeExternModule[]) {}
type BlockHeaderType (line 187) | enum BlockHeaderType {
class BlockHeader (line 195) | class BlockHeader {
method constructor (line 199) | constructor(public readonly type: BlockHeaderType) {}
method write (line 201) | write(dataPool: DataPool) {
method update (line 208) | update(dataPool: DataPool, start: number) {
class RuntimeData (line 217) | class RuntimeData {
method constructor (line 224) | constructor(
method build (line 236) | build(context: GlobalContext) {
method buildObjectDescriptions (line 249) | buildObjectDescriptions() {
method buildObjectDescription (line 261) | buildObjectDescription(od: ObjectDescription): ObjectDescriptionInfo {
method buildShapes (line 304) | buildShapes(context: GlobalContext) {
method buildShape (line 328) | buildShape(shape: Shape, suffix: string, context: GlobalContext) {
method saveShape (line 376) | saveShape(info: ShapeInfo) {
method buildExterns (line 386) | buildExterns(
function createAccessorInfo (line 413) | function createAccessorInfo(
function getShapeValueIndex (line 427) | function getShapeValueIndex(
class IRModule (line 442) | class IRModule {
method constructor (line 447) | constructor(public module: ModuleNode) {
method build (line 454) | private build() {
method buildFunctions (line 465) | private buildFunctions(context: GlobalContext) {
method buildFunction (line 471) | private buildFunction(f: FunctionDeclareNode, context: GlobalContext) {
function processValueString (line 478) | function processValueString(value: SemanticsValue, dataPool: DataPool) {
function collectionStrings (line 488) | function collectionStrings(module: ModuleNode, dataPool: DataPool) {
FILE: src/semantics/predefined_types.ts
function GetPredefinedType (line 24) | function GetPredefinedType(typeId: number): ValueType | undefined {
function createPredefinedType (line 60) | function createPredefinedType(typeId: number): ValueType | undefined {
FILE: src/semantics/runtime.ts
type MemberType (line 13) | enum MemberType {
type MemberOrAccessor (line 20) | interface MemberOrAccessor {
type MemberModifier (line 26) | enum MemberModifier {
class MemberDescription (line 30) | class MemberDescription {
method constructor (line 36) | constructor(
method isOverrid (line 49) | get isOverrid(): boolean {
method setOverrid (line 52) | setOverrid() {
method offset (line 56) | set offset(off: number) {
method offset (line 59) | get offset(): number {
method getterOffset (line 63) | set getterOffset(off: number) {
method getterOffset (line 66) | get getterOffset(): number {
method setterOffset (line 69) | set setterOffset(off: number) {
method setterOffset (line 72) | get setterOffset(): number {
method getterType (line 76) | set getterType(v: ValueType | undefined) {
method getterType (line 79) | get getterType(): ValueType | undefined {
method setterType (line 83) | set setterType(v: ValueType | undefined) {
method setterType (line 86) | get setterType(): ValueType | undefined {
method toString (line 90) | toString(): string {
method setAccessorFunction (line 102) | setAccessorFunction(func: Value, is_setter: boolean) {
method hasGetter (line 114) | get hasGetter(): boolean {
method hasSetter (line 121) | get hasSetter(): boolean {
method getter (line 129) | get getter(): Value | undefined {
method setter (line 133) | get setter(): Value | undefined {
method method (line 137) | get method(): Value | undefined {
type ObjectDescriptionType (line 144) | enum ObjectDescriptionType {
class ObjectDescription (line 151) | class ObjectDescription {
method isInited (line 164) | get isInited(): boolean {
method setInited (line 167) | setInited() {
method isBuiltin (line 171) | get isBuiltin(): boolean {
method setBuiltin (line 174) | setBuiltin() {
method base (line 178) | get base(): ObjectDescription | undefined {
method base (line 181) | set base(b: ObjectDescription | undefined) {
method generic (line 186) | get generic(): ObjectDescription {
method hasGeneric (line 190) | get hasGeneric(): boolean {
method constructor (line 194) | constructor(
method isLiteral (line 200) | get isLiteral(): boolean {
method isInterface (line 203) | get isInterface(): boolean {
method isObjectInstance (line 206) | get isObjectInstance(): boolean {
method isObjectClass (line 209) | get isObjectClass(): boolean {
method instance (line 213) | get instance(): ObjectDescription | undefined {
method instance (line 217) | set instance(inst: ObjectDescription | undefined) {
method clazz (line 221) | get clazz(): ObjectDescription | undefined {
method clazz (line 227) | set clazz(c: ObjectDescription | undefined) {
method findMember (line 231) | findMember(name: string): MemberDescription | undefined {
method findConstructor (line 235) | findConstructor(): MemberDescription | undefined {
method updateMember (line 240) | updateMember(
method findFreeSlot (line 287) | findFreeSlot(start: number): number {
method buildShape (line 299) | buildShape(from: Shape): Shape {
method dump (line 341) | dump(writer: DumpWriter) {
type Value (line 394) | interface Value {
type ShapeMemberStorage (line 398) | enum ShapeMemberStorage {
class ShapeMember (line 403) | class ShapeMember {
method constructor (line 404) | constructor(
method isOffset (line 409) | get isOffset(): boolean {
method isValue (line 412) | get isValue(): boolean {
method isEmpty (line 416) | get isEmpty(): boolean {
method dump (line 420) | dump(writer: DumpWriter) {
class ShapeField (line 425) | class ShapeField extends ShapeMember {
method constructor (line 426) | constructor(public readonly offset?: number) {
method isEmpty (line 430) | get isEmpty(): boolean {
method toString (line 434) | toString(): string {
class ShapeAccessor (line 441) | class ShapeAccessor extends ShapeMember {
method constructor (line 442) | constructor(
method getterOffset (line 450) | get getterOffset(): number | undefined {
method getterValue (line 456) | get getterValue(): Value | undefined {
method getter (line 462) | get getter(): Value | number | undefined {
method setter (line 465) | get setter(): Value | number | undefined {
method setterOffset (line 469) | get setterOffset(): number | undefined {
method setterValue (line 475) | get setterValue(): Value | undefined {
method isEmpty (line 481) | get isEmpty(): boolean {
method toString (line 485) | toString(): string {
class ShapeMethod (line 492) | class ShapeMethod extends ShapeMember {
method constructor (line 493) | constructor(storage: ShapeMemberStorage, private _func?: Value | numbe...
method methodOffset (line 497) | get methodOffset(): number | undefined {
method methodValue (line 503) | get methodValue(): Value | undefined {
method method (line 509) | get method(): Value | number | undefined {
method isEmpty (line 513) | get isEmpty(): boolean {
method toString (line 517) | toString(): string {
class Shape (line 524) | class Shape {
method constructor (line 527) | constructor(
method genericShape (line 532) | get genericShape(): Shape {
method hasGeneric (line 536) | get hasGeneric(): boolean {
method getMember (line 540) | getMember(idx: number): ShapeMember | undefined {
method isStaticShape (line 545) | isStaticShape(): boolean {
method dump (line 555) | dump(writer: DumpWriter) {
FILE: src/semantics/semantics_nodes.ts
type SemanticsKind (line 50) | enum SemanticsKind {
type SemanticsNodeVisitor (line 74) | interface SemanticsNodeVisitor {
class SemanticsNode (line 78) | class SemanticsNode {
method constructor (line 79) | constructor(public kind: SemanticsKind) {}
method dump (line 81) | dump(writer: DumpWriter) {
method forEachChild (line 85) | forEachChild(visitor: SemanticsNodeVisitor) {
method forEachValue (line 89) | forEachValue(visitor: SemanticsValueVisitor) {
class EmptyNode (line 94) | class EmptyNode extends SemanticsNode {
method constructor (line 95) | constructor() {
class ReturnNode (line 100) | class ReturnNode extends SemanticsNode {
method constructor (line 101) | constructor(public expr: SemanticsValue | undefined) {
method dump (line 105) | dump(writer: DumpWriter) {
method forEachValue (line 112) | forEachValue(visitor: SemanticsValueVisitor) {
type VarStorageType (line 118) | type VarStorageType =
type ParameterNodeFlag (line 127) | enum ParameterNodeFlag {
type VarDeclareNodeFlag (line 131) | enum VarDeclareNodeFlag {
class VarDeclareNode (line 138) | class VarDeclareNode extends SemanticsNode {
method constructor (line 141) | constructor(
method copy (line 157) | copy() {
method setUsedByClosureFunction (line 173) | setUsedByClosureFunction() {
method isUsedInClosureFunction (line 189) | isUsedInClosureFunction() {
method isUsedInClosureByRef (line 193) | isUsedInClosureByRef(): boolean {
method isUsedInClosureByValue (line 197) | isUsedInClosureByValue(): boolean {
method setImportAsRef (line 201) | setImportAsRef() {
method isImportAsRef (line 205) | isImportAsRef(): boolean {
method isRef (line 212) | isRef(): boolean {
method toString (line 216) | toString(): string {
method dump (line 221) | dump(writer: DumpWriter) {
type FunctionOwnKind (line 226) | enum FunctionOwnKind {
type NativeSignature (line 236) | interface NativeSignature {
class FunctionDeclareNode (line 241) | class FunctionDeclareNode extends SemanticsNode {
method constructor (line 248) | constructor(
method toString (line 261) | toString(): string {
method pushClosureVarDeclare (line 267) | pushClosureVarDeclare(val: VarDeclareNode) {
method thisClassType (line 272) | get thisClassType(): ObjectType | undefined {
method closureVars (line 276) | get closureVars(): VarDeclareNode[] | undefined {
method findClosureIndex (line 280) | findClosureIndex(v: VarDeclareNode): number {
method findParameterIndex (line 289) | findParameterIndex(v: VarDeclareNode): number {
method dump (line 298) | dump(writer: DumpWriter) {
method dumpCode (line 302) | dumpCode(writer: DumpWriter) {
method forEachChild (line 315) | forEachChild(visitor: SemanticsNodeVisitor) {
class BlockNode (line 322) | class BlockNode extends SemanticsNode {
method constructor (line 323) | constructor(
method dump (line 330) | dump(writer: DumpWriter) {
method forEachChild (line 339) | forEachChild(visitor: SemanticsNodeVisitor) {
class BasicBlockNode (line 345) | class BasicBlockNode extends SemanticsNode {
method constructor (line 347) | constructor() {
method pushSemanticsValue (line 353) | pushSemanticsValue(valueNode: SemanticsValue) {
method dump (line 357) | dump(writer: DumpWriter) {
method forEachValue (line 367) | forEachValue(visitor: SemanticsValueVisitor) {
class IfNode (line 372) | class IfNode extends SemanticsNode {
method constructor (line 373) | constructor(
method dump (line 381) | dump(writer: DumpWriter) {
method forEachChild (line 395) | forEachChild(visitor: SemanticsNodeVisitor) {
method forEachValue (line 400) | forEachValue(visitor: SemanticsValueVisitor) {
class ForNode (line 406) | class ForNode extends SemanticsNode {
method constructor (line 407) | constructor(
method forEachChild (line 420) | forEachChild(visitor: SemanticsNodeVisitor) {
method forEachValue (line 426) | forEachValue(visitor: SemanticsValueVisitor) {
method dump (line 431) | dump(writer: DumpWriter) {
class ForInNode (line 446) | class ForInNode extends SemanticsNode {
method constructor (line 447) | constructor(
method forEachChild (line 455) | forEachChild(visitor: SemanticsNodeVisitor) {
method forEachValue (line 460) | forEachValue(visitor: SemanticsValueVisitor) {
class ForOfNode (line 466) | class ForOfNode extends SemanticsNode {
method constructor (line 467) | constructor(
method forEachChild (line 475) | forEachChild(visitor: SemanticsNodeVisitor) {
method forEachValue (line 479) | forEachValue(visitor: SemanticsValueVisitor) {
type ForInOrOfNode (line 485) | type ForInOrOfNode = ForInNode | ForOfNode;
class WhileNode (line 487) | class WhileNode extends SemanticsNode {
method constructor (line 488) | constructor(
method isDoWhile (line 499) | isDoWhile(): boolean {
method dump (line 503) | dump(writer: DumpWriter) {
method forEachChild (line 512) | forEachChild(visitor: SemanticsNodeVisitor) {
method forEachValue (line 516) | forEachValue(visitor: SemanticsValueVisitor) {
class SwitchNode (line 522) | class SwitchNode extends SemanticsNode {
method constructor (line 523) | constructor(
method dump (line 533) | dump(writer: DumpWriter) {
method forEachChild (line 541) | forEachChild(visitor: SemanticsNodeVisitor) {
method forEachValue (line 546) | forEachValue(visitor: SemanticsValueVisitor) {
class CaseClauseNode (line 552) | class CaseClauseNode extends SemanticsNode {
method constructor (line 553) | constructor(public caseVar: SemanticsValue, public body?: SemanticsNod...
method dump (line 557) | dump(writer: DumpWriter) {
method forEachChild (line 563) | forEachChild(visitor: SemanticsNodeVisitor) {
method forEachValue (line 567) | forEachValue(visitor: SemanticsValueVisitor) {
class DefaultClauseNode (line 573) | class DefaultClauseNode extends SemanticsNode {
method constructor (line 574) | constructor(public body?: SemanticsNode) {
method dump (line 577) | dump(writer: DumpWriter) {
method forEachChild (line 582) | forEachChild(visitor: SemanticsNodeVisitor) {
class BreakNode (line 587) | class BreakNode extends SemanticsNode {
method constructor (line 588) | constructor(public label: string) {
class ContinueNode (line 593) | class ContinueNode extends SemanticsNode {
method constructor (line 594) | constructor(public label: string) {
class ThrowNode (line 599) | class ThrowNode extends SemanticsNode {
method constructor (line 600) | constructor(public throwExpr: SemanticsValue) {
method dump (line 604) | dump(writer: DumpWriter) {
class CatchClauseNode (line 610) | class CatchClauseNode extends SemanticsNode {
method constructor (line 612) | constructor(public body: SemanticsNode) {
method dump (line 616) | dump(writer: DumpWriter) {
method forEachChild (line 624) | forEachChild(visitor: SemanticsNodeVisitor) {
class TryNode (line 629) | class TryNode extends SemanticsNode {
method constructor (line 630) | constructor(
method dump (line 639) | dump(writer: DumpWriter) {
method forEachChild (line 651) | forEachChild(visitor: SemanticsNodeVisitor) {
type ExternType (line 658) | type ExternType =
type ExternTypeKind (line 663) | enum ExternTypeKind {
type ExternItem (line 670) | interface ExternItem {
class ExternModule (line 676) | class ExternModule {
method constructor (line 678) | constructor(
method addItem (line 683) | addItem(kind: ExternTypeKind, name: string, type: ExternType) {
class ExternModuleManager (line 688) | class ExternModuleManager {
method constructor (line 691) | constructor(public readonly isImport = true) {}
method add (line 693) | add(m: ExternModule) {
class ModuleNode (line 698) | class ModuleNode extends SemanticsNode {
method constructor (line 713) | constructor() {
method dumpGlobalVars (line 717) | dumpGlobalVars(writer: DumpWriter) {
method dumpFunctions (line 721) | dumpFunctions(writer: DumpWriter) {
method dumpTypes (line 725) | dumpTypes(writer: DumpWriter) {
method dumpEnums (line 737) | dumpEnums(writer: DumpWriter) {
method dump (line 745) | dump(writer: DumpWriter) {
method dumpObjectDescriptions (line 762) | dumpObjectDescriptions(writer: DumpWriter) {
method dumpCodeTrees (line 768) | dumpCodeTrees(writer: DumpWriter) {
method findValueTypeByType (line 775) | findValueTypeByType(type: Type): ValueType | undefined {
method findArrayValueType (line 927) | findArrayValueType(elementType: ValueType): ValueType | undefined {
method findTupleElementTypes (line 950) | findTupleElementTypes(elementTypes: ValueType[]): ValueType | undefined {
method findObjectValueType (line 965) | findObjectValueType(tsclass: TSClass): ValueType | undefined {
FILE: src/semantics/statement_builder.ts
function createFromVariable (line 85) | function createFromVariable(
function createLocalSymbols (line 130) | function createLocalSymbols(
function buildBlock (line 180) | function buildBlock(
function buildStatementsWithScope (line 194) | function buildStatementsWithScope(
function buildCaseClauseStatements (line 238) | function buildCaseClauseStatements(
function buildVariableStatement (line 252) | function buildVariableStatement(
function buildStatementAsNode (line 302) | function buildStatementAsNode(
function buildIfStatement (line 315) | function buildIfStatement(
function buildReturnStatement (line 333) | function buildReturnStatement(
function buildBaseLoopStatement (line 359) | function buildBaseLoopStatement(
function buildForStatement (line 382) | function buildForStatement(
function buildSwitchStatement (line 447) | function buildSwitchStatement(
function buildBreakStatement (line 492) | function buildBreakStatement(statement: BreakStatement): SemanticsNode {
function buildContinueStatement (line 496) | function buildContinueStatement(statement: ContinueStatement): Semantics...
function buildThrowStatement (line 500) | function buildThrowStatement(
function buildCatchClauseStatement (line 508) | function buildCatchClauseStatement(
function buildTryStatement (line 521) | function buildTryStatement(
function buildStatement (line 558) | function buildStatement(
FILE: src/semantics/type_creator.ts
function isObjectType (line 80) | function isObjectType(kind: ValueTypeKind): boolean {
function isNullValueType (line 91) | function isNullValueType(kind: ValueTypeKind): boolean {
function createArrayType (line 99) | function createArrayType(
function createTupleType (line 109) | function createTupleType(
function createTypeScores (line 120) | function createTypeScores(): Map<ValueTypeKind, number> {
function collectWideTypes (line 140) | function collectWideTypes(types: Set<ValueType>): ValueType[] {
function createUnionInterfaceType (line 237) | function createUnionInterfaceType(
function createUnionType (line 289) | function createUnionType(
function CreateWideTypeFromTypes (line 298) | function CreateWideTypeFromTypes(
function initTypeArguments (line 317) | function initTypeArguments(
function createType (line 330) | function createType(
function handleRecType (line 496) | function handleRecType(
function createObjectType (line 513) | function createObjectType(
function createBuiltinObjectType (line 645) | function createBuiltinObjectType(
type ClassMemberCount (line 684) | interface ClassMemberCount {
function getClassMemberCount (line 689) | function getClassMemberCount(clazz: TSClass): ClassMemberCount {
function getGlobalFunction (line 725) | function getGlobalFunction(
function updateMemberDescriptions (line 737) | function updateMemberDescriptions(
function getAccessorType (line 1025) | function getAccessorType(
function createObjectDescriptionShapes (line 1060) | function createObjectDescriptionShapes(
function CreateShapeMember (line 1110) | function CreateShapeMember(member: MemberDescription): ShapeMember | und...
function CreateShapeMemberValue (line 1126) | function CreateShapeMemberValue(
function specializeValue (line 1144) | function specializeValue(
function specializeMemberDescription (line 1163) | function specializeMemberDescription(
function simpleCopyShape (line 1195) | function simpleCopyShape(
function initSpecializeObjectDescription (line 1207) | function initSpecializeObjectDescription(
function specializeObjectDescription (line 1236) | function specializeObjectDescription(
function specializeIndexType (line 1252) | function specializeIndexType(
function initIndexType (line 1267) | function initIndexType(
class SpecializeTypeMapper (line 1285) | class SpecializeTypeMapper {
method constructor (line 1291) | constructor(owner: ValueTypeWithArguments, typeArgs: ValueType[]) {
method initTypeArguments (line 1296) | initTypeArguments(typeArgs: ValueType[]) {
method getValueType (line 1313) | getValueType(valueType: ValueType): ValueType {
method updateObjectSpecialTypeArguments (line 1327) | updateObjectSpecialTypeArguments(obj_type: ObjectType) {
method updateObjectTypeArguments (line 1340) | updateObjectTypeArguments(obj_type: ObjectType, special_type: ObjectTy...
method specializeValueType (line 1350) | specializeValueType(valueType: ValueType): ValueType {
function initBuiltinObjectTypeDescriptions (line 1492) | function initBuiltinObjectTypeDescriptions(
function specializeBuiltinObjectType (line 1516) | function specializeBuiltinObjectType(
function needSpecialized (line 1561) | function needSpecialized(type: ValueType) {
FILE: src/semantics/value.ts
type SemanticsValueKind (line 30) | enum SemanticsValueKind {
type ValueBinaryOperator (line 140) | type ValueBinaryOperator = ts.BinaryOperator;
type SemanticsValueVisitor (line 142) | interface SemanticsValueVisitor {
class SemanticsValue (line 146) | class SemanticsValue implements Value {
method constructor (line 147) | constructor(public kind: SemanticsValueKind, public type: ValueType) {}
method toString (line 149) | toString(): string {
method dump (line 153) | dump(writer: DumpWriter) {
method effectType (line 160) | get effectType(): ValueType {
method forEachChild (line 166) | forEachChild(visitor: SemanticsValueVisitor) {
method shape (line 171) | get shape(): Shape | undefined {
method shape (line 176) | set shape(s: Shape | undefined) {
method valueAccessCount (line 180) | get valueAccessCount(): number {
method incAccessCount (line 184) | incAccessCount() {
class ThisValue2 (line 189) | class ThisValue2 extends SemanticsValue {
method constructor (line 190) | constructor(type: ObjectType) {
type SuperUsageFlag (line 214) | enum SuperUsageFlag {
class SuperValue (line 219) | class SuperValue extends SemanticsValue {
method constructor (line 223) | constructor(
method parameters (line 234) | get parameters(): SemanticsValue[] | undefined {
method usageFlag (line 238) | get usageFlag(): SuperUsageFlag {
class NopValue (line 243) | class NopValue extends SemanticsValue {
method constructor (line 244) | constructor() {
class LiteralValue (line 249) | class LiteralValue extends SemanticsValue {
method constructor (line 250) | constructor(
method toString (line 257) | toString(): string {
type LocalVarValueKind (line 262) | type LocalVarValueKind =
type GlobalVarValueKind (line 265) | type GlobalVarValueKind =
type ClosureVarValueKind (line 268) | type ClosureVarValueKind =
type VarValueKind (line 271) | type VarValueKind =
function VarRefToString (line 277) | function VarRefToString(ref: any): string {
class VarValue (line 288) | class VarValue extends SemanticsValue {
method constructor (line 289) | constructor(
method copy (line 301) | copy() {
method isConst (line 312) | get isConst(): boolean {
method toString (line 320) | toString(): string {
method valueAccessCount (line 327) | get valueAccessCount(): number {
method incAccessCount (line 330) | incAccessCount() {
class BinaryExprValue (line 335) | class BinaryExprValue extends SemanticsValue {
method constructor (line 336) | constructor(
method toString (line 345) | toString(): string {
method dump (line 349) | dump(writer: DumpWriter) {
method forEachChild (line 357) | forEachChild(visitor: SemanticsValueVisitor) {
class PrefixUnaryExprValue (line 363) | class PrefixUnaryExprValue extends SemanticsValue {
method constructor (line 364) | constructor(
method setFlattenExprValue (line 378) | setFlattenExprValue(flattenExprValue: SemanticsValue) {
method flattenExprValue (line 382) | get flattenExprValue(): SemanticsValue | undefined {
method forEachChild (line 386) | forEachChild(visitor: SemanticsValueVisitor) {
class PostUnaryExprValue (line 391) | class PostUnaryExprValue extends SemanticsValue {
method constructor (line 392) | constructor(
method setFlattenExprValue (line 406) | setFlattenExprValue(flattenExprValue: SemanticsValue) {
method flattenExprValue (line 410) | get flattenExprValue(): SemanticsValue | undefined {
method forEachChild (line 414) | forEachChild(visitor: SemanticsValueVisitor) {
class ConditionExprValue (line 419) | class ConditionExprValue extends SemanticsValue {
method constructor (line 420) | constructor(
method dump (line 429) | dump(writer: DumpWriter) {
method forEachChild (line 438) | forEachChild(visitor: SemanticsValueVisitor) {
class CommaExprValue (line 445) | class CommaExprValue extends SemanticsValue {
method constructor (line 446) | constructor(type: ValueType, public exprs: SemanticsValue[]) {
method dump (line 449) | dump(writer: DumpWriter) {
method forEachChild (line 459) | forEachChild(visitor: SemanticsValueVisitor) {
class FunctionCallBaseValue (line 464) | class FunctionCallBaseValue extends SemanticsValue {
method constructor (line 465) | constructor(
method setTypeArguments (line 476) | setTypeArguments(typeArgs: ValueType[]) {
method typeArguments (line 480) | get typeArguments(): ValueType[] | undefined {
method forEachChild (line 484) | forEachChild(visitor: SemanticsValueVisitor) {
class FunctionCallValue (line 491) | class FunctionCallValue extends FunctionCallBaseValue {
method constructor (line 492) | constructor(
method dump (line 506) | dump(writer: DumpWriter) {
method forEachChild (line 516) | forEachChild(visitor: SemanticsValueVisitor) {
class EnumerateKeysGetValue (line 522) | class EnumerateKeysGetValue extends SemanticsValue {
method constructor (line 523) | constructor(public type: ValueType, public obj: SemanticsValue) {
method dump (line 527) | dump(writer: DumpWriter) {
method forEachChild (line 534) | forEachChild(visitor: SemanticsValueVisitor) {
class NewClosureFunction (line 539) | class NewClosureFunction extends SemanticsValue {
method constructor (line 540) | constructor(
method toString (line 547) | toString(): string {
method forEachChild (line 551) | forEachChild(visitor: SemanticsValueVisitor) {
class ClosureCallValue (line 560) | class ClosureCallValue extends FunctionCallBaseValue {
method constructor (line 561) | constructor(
method forEachChild (line 575) | forEachChild(visitor: SemanticsValueVisitor) {
class ConstructorCallValue (line 581) | class ConstructorCallValue extends FunctionCallBaseValue {
method constructor (line 582) | constructor(
method forEachChild (line 596) | forEachChild(visitor: SemanticsValueVisitor) {
class AnyCallValue (line 602) | class AnyCallValue extends SemanticsValue {
method constructor (line 603) | constructor(
method forEachChild (line 611) | forEachChild(visitor: SemanticsValueVisitor) {
type ElementGetValueKind (line 617) | type ElementGetValueKind =
class ElementGetValue (line 626) | class ElementGetValue extends SemanticsValue {
method constructor (line 627) | constructor(
method dump (line 636) | dump(writer: DumpWriter) {
method forEachChild (line 646) | forEachChild(visitor: SemanticsValueVisitor) {
type ElementSetValueKind (line 652) | type ElementSetValueKind =
class ElementSetValue (line 660) | class ElementSetValue extends SemanticsValue {
method constructor (line 661) | constructor(
method dump (line 672) | dump(writer: DumpWriter) {
method forEachChild (line 685) | forEachChild(visitor: SemanticsValueVisitor) {
type CastValueKind (line 692) | type CastValueKind =
class CastValue (line 707) | class CastValue extends SemanticsValue {
method constructor (line 710) | constructor(
method dump (line 718) | dump(writer: DumpWriter) {
method forEachChild (line 730) | forEachChild(visitor: SemanticsValueVisitor) {
class InstanceOfValue (line 735) | class InstanceOfValue extends SemanticsValue {
method constructor (line 736) | constructor(
method forEachChild (line 743) | forEachChild(visitor: SemanticsValueVisitor) {
class NewClassValue (line 748) | class NewClassValue extends SemanticsValue {
method constructor (line 749) | constructor(type: ValueType) {
type ToStringValueKind (line 754) | type ToStringValueKind =
class ToStringValue (line 758) | class ToStringValue extends SemanticsValue {
method constructor (line 759) | constructor(kind: ToStringValueKind, public value: SemanticsValue) {
method dump (line 763) | dump(writer: DumpWriter) {
method forEachChild (line 770) | forEachChild(visitor: SemanticsValueVisitor) {
class TypeofValue (line 778) | class TypeofValue extends SemanticsValue {
method constructor (line 779) | constructor(public value: SemanticsValue) {
method forEachChild (line 783) | forEachChild(visitor: SemanticsValueVisitor) {
class TemplateExprValue (line 788) | class TemplateExprValue extends SemanticsValue {
method constructor (line 789) | constructor(public head: SemanticsValue, public follows: SemanticsValu...
method forEachChild (line 793) | forEachChild(visitor: SemanticsValueVisitor): void {
class UnimplementValue (line 799) | class UnimplementValue extends SemanticsValue {
method constructor (line 800) | constructor(public tsNode: ts.Node) {
method toString (line 804) | toString(): string {
class DynamicGetValue (line 819) | class DynamicGetValue extends SemanticsValue {
method constructor (line 824) | constructor(
method toString (line 833) | toString(): string {
method forEachChild (line 837) | forEachChild(visitor: SemanticsValueVisitor) {
class DynamicSetValue (line 843) | class DynamicSetValue extends SemanticsValue {
method constructor (line 844) | constructor(
method toString (line 853) | toString(): string {
method forEachChild (line 857) | forEachChild(visitor: SemanticsValueVisitor) {
class DynamicCallValue (line 863) | class DynamicCallValue extends FunctionCallBaseValue {
method constructor (line 864) | constructor(public owner: SemanticsValue, public name: string) {
method toString (line 875) | toString(): string {
method forEachChild (line 879) | forEachChild(visitor: SemanticsValueVisitor) {
class ShapeGetValue (line 885) | class ShapeGetValue extends SemanticsValue {
method constructor (line 886) | constructor(
method toString (line 894) | toString(): string {
method forEachChild (line 898) | forEachChild(visitor: SemanticsValueVisitor) {
class ShapeSetValue (line 904) | class ShapeSetValue extends SemanticsValue {
method constructor (line 905) | constructor(
method toString (line 915) | toString(): string {
method forEachChild (line 919) | forEachChild(visitor: SemanticsValueVisitor) {
class ShapeCallValue (line 925) | class ShapeCallValue extends FunctionCallBaseValue {
method constructor (line 926) | constructor(
method forEachChild (line 934) | forEachChild(visitor: SemanticsValueVisitor) {
method toString (line 939) | toString(): string {
class OffsetGetValue (line 944) | class OffsetGetValue extends SemanticsValue {
method constructor (line 945) | constructor(
method forEachChild (line 953) | forEachChild(visitor: SemanticsValueVisitor) {
class OffsetSetValue (line 959) | class OffsetSetValue extends SemanticsValue {
method constructor (line 960) | constructor(
method forEachChild (line 970) | forEachChild(visitor: SemanticsValueVisitor) {
class OffsetGetterValue (line 976) | class OffsetGetterValue extends SemanticsValue {
method constructor (line 977) | constructor(
method forEachChild (line 985) | forEachChild(visitor: SemanticsValueVisitor) {
class OffsetSetterValue (line 991) | class OffsetSetterValue extends SemanticsValue {
method constructor (line 992) | constructor(
method forEachChild (line 1003) | forEachChild(visitor: SemanticsValueVisitor) {
class OffsetCallValue (line 1009) | class OffsetCallValue extends FunctionCallBaseValue {
method constructor (line 1010) | constructor(
method forEachChild (line 1018) | forEachChild(visitor: SemanticsValueVisitor) {
method toString (line 1023) | toString(): string {
class VTableGetValue (line 1028) | class VTableGetValue extends SemanticsValue {
method constructor (line 1029) | constructor(
method forEachChild (line 1037) | forEachChild(visitor: SemanticsValueVisitor) {
class VTableSetValue (line 1043) | class VTableSetValue extends SemanticsValue {
method constructor (line 1044) | constructor(
method forEachChild (line 1054) | forEachChild(visitor: SemanticsValueVisitor) {
class VTableCallValue (line 1060) | class VTableCallValue extends FunctionCallBaseValue {
method constructor (line 1061) | constructor(
method forEachChild (line 1069) | forEachChild(visitor: SemanticsValueVisitor) {
class DirectGetterValue (line 1075) | class DirectGetterValue extends SemanticsValue {
method constructor (line 1076) | constructor(
method forEachChild (line 1084) | forEachChild(visitor: SemanticsValueVisitor) {
class DirectCallValue (line 1090) | class DirectCallValue extends FunctionCallBaseValue {
method constructor (line 1091) | constructor(
method forEachChild (line 1103) | forEachChild(visitor: SemanticsValueVisitor) {
class DirectSetterValue (line 1109) | class DirectSetterValue extends SemanticsValue {
method constructor (line 1110) | constructor(
method forEachChild (line 1121) | forEachChild(visitor: SemanticsValueVisitor) {
class DirectGetValue (line 1127) | class DirectGetValue extends SemanticsValue {
method constructor (line 1128) | constructor(
method toString (line 1136) | toString(): string {
method forEachChild (line 1140) | forEachChild(visitor: SemanticsValueVisitor) {
type MemberGetValue (line 1146) | type MemberGetValue =
type MemberSetValue (line 1154) | type MemberSetValue =
type MemberCallValue (line 1162) | type MemberCallValue =
class NewLiteralObjectValue (line 1169) | class NewLiteralObjectValue extends SemanticsValue {
method constructor (line 1171) | constructor(type: ObjectType) {
method objectType (line 1177) | get objectType(): ObjectType {
method setField (line 1181) | setField(index: number, value: SemanticsValue) {
class NewLiteralArrayValue (line 1186) | class NewLiteralArrayValue extends SemanticsValue {
method constructor (line 1187) | constructor(type: ValueType, public initValues: SemanticsValue[]) {
class NewConstructorObjectValue (line 1195) | class NewConstructorObjectValue extends SemanticsValue {
method constructor (line 1196) | constructor(
method objectType (line 1214) | get objectType(): ObjectType {
method setTypeArguments (line 1220) | setTypeArguments(typeArgs: ValueType[]) {
method typeArguments (line 1224) | get typeArguments(): ValueType[] | undefined {
method forEachChild (line 1228) | forEachChild(visitor: SemanticsValueVisitor) {
class NewArrayValue (line 1235) | class NewArrayValue extends NewConstructorObjectValue {
method constructor (line 1236) | constructor(type: ArrayType | WASMArrayType, parameters: SemanticsValu...
class NewArrayLenValue (line 1241) | class NewArrayLenValue extends SemanticsValue {
method constructor (line 1242) | constructor(
method setTypeArguments (line 1254) | setTypeArguments(typeArgs: ValueType[]) {
method typeArguments (line 1258) | get typeArguments(): ValueType[] | undefined {
class NewFromClassObjectValue (line 1263) | class NewFromClassObjectValue extends NewConstructorObjectValue {
method constructor (line 1264) | constructor(
class BlockValue (line 1275) | class BlockValue extends SemanticsValue {
method constructor (line 1280) | constructor(
method addHead (line 1289) | addHead(value: SemanticsValue) {
method addValue (line 1295) | addValue(value: SemanticsValue) {
class BlockBranchValue (line 1302) | class BlockBranchValue extends SemanticsValue {
method constructor (line 1303) | constructor(public readonly target: BlockValue) {
class BlockBranchIfValue (line 1308) | class BlockBranchIfValue extends SemanticsValue {
method constructor (line 1309) | constructor(
class ReturnValue (line 1318) | class ReturnValue extends SemanticsValue {
method constructor (line 1319) | constructor(public expr: SemanticsValue | undefined) {
class ReBindingValue (line 1324) | class ReBindingValue extends SemanticsValue {
method constructor (line 1325) | constructor(public contextVar: VarDeclareNode) {
class SpreadValue (line 1330) | class SpreadValue extends SemanticsValue {
method constructor (line 1331) | constructor(type: ValueType, public target: SemanticsValue) {
function operatorString (line 1337) | function operatorString(kind: ts.BinaryOperator): string {
FILE: src/semantics/value_types.ts
type ValueTypeKind (line 16) | enum ValueTypeKind {
class ValueType (line 50) | class ValueType {
method constructor (line 51) | constructor(public kind: ValueTypeKind, public typeId: number) {}
method equals (line 53) | equals(other: ValueType): boolean {
method toString (line 70) | toString(): string {
method isBuiltin (line 80) | get isBuiltin(): boolean {
method setBuiltin (line 84) | setBuiltin() {
method isPrimitive (line 88) | get isPrimitive(): boolean {
method setPrimitive (line 92) | setPrimitive() {
method isWASM (line 96) | get isWASM(): boolean {
method setWASM (line 100) | setWASM() {
method setGenericOwner (line 104) | setGenericOwner(vt: ValueType) {
method genericOwner (line 108) | get genericOwner(): ValueType | undefined {
method isSpecialized (line 112) | isSpecialized(): boolean {
method genericType (line 116) | get genericType(): ValueType {
type PrimitiveValueType (line 121) | type PrimitiveValueType =
class PrimitiveType (line 129) | class PrimitiveType extends ValueType {
method constructor (line 130) | constructor(kind: ValueTypeKind, typeId: number) {
method toString (line 135) | toString(): string {
class WASMType (line 164) | class WASMType extends ValueType {
method constructor (line 165) | constructor(kind: ValueTypeKind, typeId: number) {
method toString (line 170) | toString(): string {
constant WASM (line 175) | const WASM = {
class WASMArrayType (line 183) | class WASMArrayType extends WASMType {
method constructor (line 189) | constructor(
class WASMStructType (line 209) | class WASMStructType extends WASMType {
method constructor (line 216) | constructor(
class EmptyType (line 248) | class EmptyType extends ValueType {
method constructor (line 249) | constructor() {
class ClosureContextType (line 254) | class ClosureContextType extends ValueType {
method constructor (line 255) | constructor(
class ValueTypeWithArguments (line 263) | class ValueTypeWithArguments extends ValueType {
method constructor (line 264) | constructor(kind: ValueTypeKind, typeId: number) {
method hasUninitedTypeArguments (line 271) | get hasUninitedTypeArguments(): boolean {
method addTypeParameter (line 277) | addTypeParameter(type: TypeParameterType) {
method setTypeArguments (line 288) | setTypeArguments(types: TypeParameterType[]) {
method typeArguments (line 292) | get typeArguments(): TypeParameterType[] | undefined {
method inTypeArguments (line 296) | inTypeArguments(valueType: ValueType): boolean {
method setSpecialTypeArguments (line 301) | setSpecialTypeArguments(types: ValueType[]) {
method specialTypeArguments (line 305) | get specialTypeArguments(): ValueType[] | undefined {
method getSpecialTypeArg (line 309) | getSpecialTypeArg(type: TypeParameterType) {
method getSpecialTypeArgs (line 322) | getSpecialTypeArgs(types: TypeParameterType[]) {
class SetType (line 331) | class SetType extends ValueTypeWithArguments {
method constructor (line 332) | constructor(
method equals (line 340) | equals(other: ValueType): boolean {
method toString (line 349) | toString(): string {
class MapType (line 354) | class MapType extends ValueTypeWithArguments {
method constructor (line 355) | constructor(
method equals (line 364) | equals(other: ValueType): boolean {
method toString (line 374) | toString(): string {
type ObjectTypeFlag (line 381) | enum ObjectTypeFlag {
class ObjectType (line 388) | class ObjectType extends ValueTypeWithArguments {
method constructor (line 396) | constructor(
method isClassObject (line 405) | public isClassObject(): boolean {
method isLiteralObject (line 408) | public isLiteralObject(): boolean {
method isObject (line 411) | public isObject(): boolean {
method classType (line 415) | public get classType(): ObjectType | undefined {
method classType (line 421) | public set classType(c: ObjectType | undefined) {
method instanceType (line 425) | public get instanceType(): ObjectType | undefined {
method instanceType (line 429) | public set instanceType(inst: ObjectType | undefined) {
method numberIndexType (line 433) | public get numberIndexType(): ValueType | undefined {
method setNumberIndexType (line 437) | public setNumberIndexType(type: ValueType) {
method stringIndexType (line 441) | public get stringIndexType(): ValueType | undefined {
method setStringIndexType (line 444) | public setStringIndexType(type: ValueType) {
method implId (line 448) | public get implId() {
method implId (line 452) | public set implId(id: number) {
method clone (line 456) | public clone(
method equals (line 467) | equals(other: ValueType): boolean {
method toString (line 486) | toString(): string {
class ArrayType (line 493) | class ArrayType extends ObjectType {
method constructor (line 494) | constructor(typeId: number, meta: ObjectDescription, flags: number) {
method setElement (line 501) | setElement(element: ValueType) {
method element (line 505) | get element(): ValueType {
method numberIndexType (line 510) | public get numberIndexType(): ValueType | undefined {
method equals (line 519) | equals(other: ValueType): boolean {
method clone (line 526) | public clone(
method toString (line 534) | toString(): string {
class UnionType (line 546) | class UnionType extends ValueType {
method constructor (line 547) | constructor(
method toString (line 555) | toString(): string {
method equals (line 565) | equals(other: ValueType): boolean {
class FunctionType (line 589) | class FunctionType extends ValueTypeWithArguments {
method constructor (line 590) | constructor(
method getRestParam (line 601) | getRestParam(): ValueType | undefined {
method hasParamType (line 611) | hasParamType() {
method getParamType (line 615) | getParamType(idx: number): ValueType | undefined {
method equals (line 625) | equals(other: ValueType): boolean {
method toString (line 640) | toString(): string {
type TypeParameterOwnerType (line 649) | enum TypeParameterOwnerType {
class TypeParameterType (line 655) | class TypeParameterType extends ValueType {
method constructor (line 660) | constructor(
method setSpecialTypeArgument (line 670) | setSpecialTypeArgument(type: ValueType) {
method specialTypeArgument (line 674) | get specialTypeArgument(): ValueType | undefined {
method setOwnedByFunction (line 678) | setOwnedByFunction() {
method ownedByFunction (line 681) | get ownedByFunction(): boolean {
method setOwnedByClass (line 685) | setOwnedByClass() {
method ownedByClass (line 688) | get ownedByClass(): boolean {
method setOwnedByClosure (line 692) | setOwnedByClosure() {
method ownedByClosure (line 695) | get ownedByClosure(): boolean {
method toString (line 699) | toString(): string {
method equals (line 703) | equals(other: ValueType) {
class EnumType (line 714) | class EnumType extends ValueType {
method constructor (line 715) | constructor(
method toString (line 724) | toString(): string {
class TupleType (line 739) | class TupleType extends ValueType {
method constructor (line 740) | constructor(typeId: number, public elements: ValueType[]) {
method toString (line 744) | toString(): string {
FILE: src/statement.ts
type StatementKind (line 48) | type StatementKind = ts.SyntaxKind;
class Statement (line 50) | class Statement {
method constructor (line 55) | constructor(private kind: StatementKind) {}
method statementKind (line 57) | get statementKind(): StatementKind {
method setScope (line 61) | setScope(scope: Scope) {
method getScope (line 65) | getScope(): Scope | null {
method clone (line 69) | clone() {
class ModDeclStatement (line 78) | class ModDeclStatement extends Statement {
method constructor (line 79) | constructor(public scope: Scope) {
method clone (line 83) | clone(): ModDeclStatement {
class IfStatement (line 89) | class IfStatement extends Statement {
method constructor (line 90) | constructor(
method ifCondition (line 98) | get ifCondition(): Expression {
method ifIfTrue (line 102) | get ifIfTrue(): Statement {
method ifIfFalse (line 106) | get ifIfFalse(): Statement | null {
method clone (line 110) | clone(): IfStatement {
class BlockStatement (line 120) | class BlockStatement extends Statement {
method constructor (line 121) | constructor() {
method clone (line 125) | clone(): BlockStatement {
class ReturnStatement (line 133) | class ReturnStatement extends Statement {
method constructor (line 134) | constructor(private expr: Expression | null) {
method returnExpression (line 138) | get returnExpression(): Expression | null {
method clone (line 142) | clone(): ReturnStatement {
class BaseLoopStatement (line 149) | class BaseLoopStatement extends Statement {
method constructor (line 150) | constructor(
method loopLabel (line 161) | get loopLabel(): string {
method loopBlockLabel (line 165) | get loopBlockLabel(): string {
method loopContinueLable (line 169) | get loopContinueLable(): string | null {
method loopCondtion (line 173) | get loopCondtion(): Expression {
method loopBody (line 177) | get loopBody(): Statement {
method clone (line 181) | clone(): BaseLoopStatement {
class ForStatement (line 194) | class ForStatement extends Statement {
method constructor (line 195) | constructor(
method forLoopLabel (line 208) | get forLoopLabel(): string {
method forLoopBlockLabel (line 212) | get forLoopBlockLabel(): string {
method forContinueLable (line 216) | get forContinueLable(): string | null {
method forLoopCondtion (line 220) | get forLoopCondtion(): Expression | null {
method forLoopBody (line 224) | get forLoopBody(): Statement {
method forLoopInitializer (line 228) | get forLoopInitializer(): Statement | null {
method forLoopIncrementor (line 232) | get forLoopIncrementor(): Expression | null {
method clone (line 236) | clone(): ForStatement {
class ExpressionStatement (line 250) | class ExpressionStatement extends Statement {
method constructor (line 251) | constructor(private expr: Expression) {
method expression (line 255) | get expression(): Expression {
method clone (line 259) | clone(): ExpressionStatement {
class EmptyStatement (line 265) | class EmptyStatement extends Statement {
method constructor (line 266) | constructor() {
method clone (line 270) | clone(): EmptyStatement {
class CaseClause (line 276) | class CaseClause extends Statement {
method constructor (line 277) | constructor(private expr: Expression, private statements: Statement[]) {
method caseExpr (line 281) | get caseExpr(): Expression {
method caseStatements (line 285) | get caseStatements(): Statement[] {
method clone (line 289) | clone(): CaseClause {
class DefaultClause (line 295) | class DefaultClause extends Statement {
method constructor (line 296) | constructor(private statements: Statement[]) {
method caseStatements (line 300) | get caseStatements(): Statement[] {
method clone (line 304) | clone(): DefaultClause {
class CaseBlock (line 310) | class CaseBlock extends Statement {
method constructor (line 311) | constructor(
method switchLabel (line 319) | get switchLabel(): string {
method breakLabel (line 323) | get breakLabel(): string {
method caseCauses (line 327) | get caseCauses(): Statement[] {
method clone (line 331) | clone(): CaseBlock {
class SwitchStatement (line 340) | class SwitchStatement extends Statement {
method constructor (line 341) | constructor(private cond: Expression, private caseBlock: Statement) {
method switchCondition (line 345) | get switchCondition(): Expression {
method switchCaseBlock (line 349) | get switchCaseBlock(): Statement {
method clone (line 353) | clone(): SwitchStatement {
class BreakStatement (line 362) | class BreakStatement extends Statement {
method constructor (line 363) | constructor(private label: string) {
method breakLabel (line 367) | get breakLabel(): string {
method clone (line 371) | clone(): BreakStatement {
class ContinueStatement (line 377) | class ContinueStatement extends Statement {
method constructor (line 378) | constructor(private label: string) {
method continueLabel (line 382) | get continueLabel(): string {
method clone (line 386) | clone(): ContinueStatement {
class FunctionDeclarationStatement (line 392) | class FunctionDeclarationStatement extends Statement {
method constructor (line 395) | constructor(private _funcScope: FunctionScope) {
method funcScope (line 399) | get funcScope(): FunctionScope {
method clone (line 403) | clone(): FunctionDeclarationStatement {
class VariableStatement (line 409) | class VariableStatement extends Statement {
method constructor (line 412) | constructor() {
method addVariable (line 416) | addVariable(variable: Variable) {
method varArray (line 420) | get varArray(): Variable[] {
method clone (line 424) | clone(): VariableStatement {
class ImportDeclaration (line 433) | class ImportDeclaration extends Statement {
method constructor (line 436) | constructor() {
method clone (line 440) | clone(): ImportDeclaration {
class ThrowStatement (line 446) | class ThrowStatement extends Statement {
method constructor (line 449) | constructor(expr: Expression) {
method clone (line 454) | clone(): ThrowStatement {
class CatchClauseStatement (line 460) | class CatchClauseStatement extends Statement {
method constructor (line 464) | constructor(catchBlock: BlockStatement) {
method clone (line 469) | clone(): CatchClauseStatement {
class TryStatement (line 476) | class TryStatement extends Statement {
method constructor (line 482) | constructor(tryLable: string, tryBlock: BlockStatement) {
method clone (line 488) | clone(): TryStatement {
class StatementProcessor (line 496) | class StatementProcessor {
method constructor (line 506) | constructor(private parserCtx: ParserContext) {}
method visit (line 508) | visit() {
method visitNode (line 541) | visitNode(node: ts.Node): Statement | null {
method visitNodeInternal (line 547) | visitNodeInternal(node: ts.Node): Statement | null {
method addVariableInVarStmt (line 1083) | addVariableInVarStmt(
method createFieldAssignStmt (line 1123) | createFieldAssignStmt(
method convertForOfToForLoop (line 1149) | private convertForOfToForLoop(
method convertForInToForLoop (line 1376) | private convertForInToForLoop(
method getClassIterPropNames (line 1525) | private getClassIterPropNames(classType: TSClass): Expression[] {
method getLoopContinueLabel (line 1534) | private getLoopContinueLabel(loopLabel: string): string {
class StatementSpecializationProcessor (line 1539) | class StatementSpecializationProcessor {
method constructor (line 1541) | constructor(private parserCtx: ParserContext) {}
method visit (line 1543) | visit() {
method visitScope (line 1550) | visitScope(scope: Scope) {
method foreachScopeChildren (line 1660) | foreachScopeChildren(scope: Scope) {
method processStatement (line 1667) | processStatement(
FILE: src/type.ts
type TypeKind (line 36) | const enum TypeKind {
class Type (line 67) | class Type {
method kind (line 72) | get kind(): TypeKind {
method toString (line 76) | toString(): string {
method isDeclare (line 80) | get isDeclare(): boolean {
class WasmType (line 85) | class WasmType extends Type {
method constructor (line 88) | constructor(private type: string) {
method getName (line 128) | public getName(): string {
class WasmArrayType (line 133) | class WasmArrayType extends WasmType {
method constructor (line 139) | constructor(
class WasmStructType (line 159) | class WasmStructType extends WasmType {
method constructor (line 166) | constructor(
class GenericType (line 198) | class GenericType extends Type {
method constructor (line 199) | constructor() {
class Primitive (line 205) | class Primitive extends Type {
method constructor (line 206) | constructor(private type: string) {
method toString (line 243) | toString(): string {
class TSContext (line 248) | class TSContext extends Type {
method constructor (line 249) | constructor(
method toString (line 257) | toString(): string {
class TSTypeParameter (line 292) | class TSTypeParameter extends Type {
method constructor (line 299) | constructor(name: string, wide: Type, index: number, def?: Type) {
method name (line 307) | get name(): string {
method wideType (line 311) | get wideType(): Type {
method index (line 315) | get index(): number {
method defaultType (line 319) | get defaultType(): Type | undefined {
method toString (line 323) | toString(): string {
type TsClassField (line 328) | interface TsClassField {
type FunctionKind (line 337) | const enum FunctionKind {
function getMethodPrefix (line 346) | function getMethodPrefix(kind: FunctionKind): string {
type TsClassFunc (line 359) | interface TsClassFunc {
type ClassMethod (line 365) | interface ClassMethod {
class TSTypeWithArguments (line 370) | class TSTypeWithArguments extends Type {
method constructor (line 376) | constructor() {
method typeArguments (line 380) | get typeArguments(): TSTypeParameter[] | undefined {
method addTypeParameter (line 384) | addTypeParameter(type: TSTypeParameter) {
method setTypeParameters (line 396) | setTypeParameters(types: TSTypeParameter[] | undefined) {
method getTypeParameter (line 400) | getTypeParameter(name: string): TSTypeParameter | undefined {
method genericOwner (line 408) | get genericOwner(): TSTypeWithArguments | undefined {
method setGenericOwner (line 412) | setGenericOwner(owner: TSTypeWithArguments | undefined) {
method belongedScope (line 416) | get belongedScope(): Scope | undefined {
method setBelongedScope (line 420) | setBelongedScope(scope: Scope | undefined) {
method specializedArguments (line 424) | get specializedArguments(): Type[] | undefined {
method setSpecializedArguments (line 428) | setSpecializedArguments(types: Type[] | undefined) {
type TraverseStatus (line 433) | const enum TraverseStatus {
class TSClass (line 439) | class TSClass extends TSTypeWithArguments {
method constructor (line 462) | constructor() {
method toString (line 467) | toString(): string {
method fields (line 473) | get fields(): Array<TsClassField> {
method staticFields (line 477) | get staticFields(): TsClassField[] {
method memberFuncs (line 481) | get memberFuncs(): Array<TsClassFunc> {
method ctorType (line 485) | set ctorType(ctor: TSFunction) {
method ctorType (line 489) | get ctorType(): TSFunction {
method isDeclare (line 493) | get isDeclare(): boolean {
method isDeclare (line 497) | set isDeclare(value: boolean) {
method numberIndexType (line 501) | get numberIndexType(): Type | undefined {
method setNumberIndexType (line 505) | setNumberIndexType(type: Type) {
method stringIndexType (line 509) | get stringIndexType(): Type | undefined {
method setStringIndexType (line 513) | setStringIndexType(type: Type) {
method setBase (line 517) | setBase(base: TSClass): void {
method getBase (line 521) | getBase(): TSClass | null {
method setDrivedClass (line 525) | setDrivedClass(drived: TSClass): void {
method getDrivedClasses (line 530) | getDrivedClasses(): TSClass[] | null {
method setImplInfc (line 534) | setImplInfc(infc: TSInterface | null): void {
method getImplInfc (line 538) | getImplInfc(): TSInterface | null {
method addMemberField (line 542) | addMemberField(memberField: TsClassField): void {
method getMemberField (line 546) | getMemberField(name: string): TsClassField | null {
method getMemberFieldIndex (line 554) | getMemberFieldIndex(name: string): number {
method addStaticMemberField (line 560) | addStaticMemberField(memberField: TsClassField): void {
method getStaticMemberField (line 564) | getStaticMemberField(name: string): TsClassField | null {
method getStaticFieldIndex (line 572) | getStaticFieldIndex(name: string): number {
method addMethod (line 578) | addMethod(classMethod: TsClassFunc): void {
method getMethod (line 586) | getMethod(
method updateMethod (line 599) | updateMethod(
method setClassName (line 614) | setClassName(name: string) {
method className (line 618) | get className(): string {
method mangledName (line 622) | get mangledName(): string {
method mangledName (line 626) | set mangledName(name: string) {
method typeId (line 630) | set typeId(id: number) {
method typeId (line 634) | get typeId() {
method isLiteral (line 638) | set isLiteral(b: boolean) {
method isLiteral (line 642) | get isLiteral(): boolean {
class TSInterface (line 647) | class TSInterface extends TSClass {
method constructor (line 648) | constructor() {
class TSArray (line 654) | class TSArray extends Type {
method constructor (line 655) | constructor(private _elemType: Type) {
method elementType (line 660) | set elementType(type: Type) {
method elementType (line 664) | get elementType(): Type {
method toString (line 668) | toString(): string {
class TSFunction (line 673) | class TSFunction extends TSTypeWithArguments {
method toString (line 688) | toString(): string {
method constructor (line 694) | constructor(public funcKind: FunctionKind = FunctionKind.DEFAULT) {
method returnType (line 699) | set returnType(type: Type) {
method returnType (line 703) | get returnType(): Type {
method addParamType (line 707) | addParamType(paramType: Type) {
method setParamTypes (line 711) | setParamTypes(paramTypes: Type[]) {
method getParamTypes (line 715) | getParamTypes(): Type[] {
method addIsOptionalParam (line 719) | addIsOptionalParam(isOptional: boolean) {
method isOptionalParams (line 723) | get isOptionalParams() {
method restParamIdx (line 727) | set restParamIdx(idx: number) {
method restParamIdx (line 731) | get restParamIdx() {
method hasRest (line 735) | hasRest() {
method isMethod (line 739) | get isMethod() {
method isMethod (line 743) | set isMethod(value: boolean) {
method isDeclare (line 747) | get isDeclare(): boolean {
method isDeclare (line 751) | set isDeclare(value: boolean) {
method isBinaryenImpl (line 755) | get isBinaryenImpl() {
method isBinaryenImpl (line 759) | set isBinaryenImpl(value: boolean) {
method isStatic (line 763) | get isStatic() {
method isStatic (line 767) | set isStatic(value: boolean) {
method isExport (line 771) | get isExport() {
method isExport (line 775) | set isExport(value: boolean) {
method belongedClass (line 779) | set belongedClass(clazz: TSClass | undefined) {
method belongedClass (line 783) | get belongedClass() {
method clone (line 788) | public clone(): TSFunction {
class TSUnion (line 808) | class TSUnion extends Type {
method constructor (line 812) | constructor() {
method types (line 816) | get types(): Array<Type> {
method addType (line 820) | addType(type: Type) {
method toString (line 824) | toString(): string {
class TSEnum (line 838) | class TSEnum extends Type {
method constructor (line 844) | constructor(name: string) {
method name (line 849) | get name(): string {
method memberType (line 853) | get memberType(): Type {
method addMember (line 857) | addMember(name: string, value: number | string) {
method getMember (line 878) | getMember(name: string): number | string | undefined {
method members (line 882) | get members(): Map<string, number | string> {
method toString (line 886) | toString(): string {
class TSTuple (line 902) | class TSTuple extends Type {
method constructor (line 906) | constructor() {
method elements (line 910) | get elements(): Array<Type> {
method addType (line 914) | addType(type: Type) {
method toString (line 918) | toString(): string {
type TsCustomType (line 925) | interface TsCustomType {
class TypeResolver (line 930) | class TypeResolver {
method constructor (line 947) | constructor(private parserCtx: ParserContext) {
method visitSymbolNode (line 952) | visitSymbolNode(fileList: ts.SourceFile[]) {
method visit (line 961) | visit() {
method visitObjectSymbolNode (line 983) | private visitObjectSymbolNode(node: ts.Node) {
method visitNode (line 1014) | private visitNode(node: ts.Node) {
method getTypeFromTSTypeMap (line 1239) | private getTypeFromTSTypeMap(tsType: ts.Type, customName: string) {
method addTypeToTSTypeMap (line 1251) | private addTypeToTSTypeMap(
method addTypeToScopeTypeMap (line 1273) | private addTypeToScopeTypeMap(type: Type, node: ts.Node) {
method getTsTypeRawName (line 1301) | getTsTypeRawName(node: ts.Node, isReturnType = false): string | undefi...
method getTsTypeName (line 1316) | getTsTypeName(node: ts.Node) {
method getTypeByInitializer (line 1332) | getTypeByInitializer(node: ts.Node): Type | undefined {
method generateNodeType (line 1346) | generateNodeType(node: ts.Node): Type {
method tsTypeToType (line 1455) | public tsTypeToType(
method parseTupleType (line 1649) | private parseTupleType(
method parseUnionType (line 1670) | private parseUnionType(
method parseEnumType (line 1712) | private parseEnumType(node: ts.EnumDeclaration): Type {
method parseEnumMemberValue (line 1734) | private parseEnumMemberValue(
method isObject (line 1775) | private isObject(type: ts.Type): type is ts.ObjectType {
method isTypeReference (line 1779) | private isTypeReference(type: ts.Type): type is ts.TypeReference {
method isInterface (line 1786) | private isInterface(type: ts.Type): type is ts.InterfaceType {
method isObjectLiteral (line 1793) | private isObjectLiteral(type: ts.Type) {
method isObjectType (line 1802) | private isObjectType(type: ts.Type) {
method isTupleType (line 1811) | private isTupleType(tsType: ts.Type) {
method isArray (line 1820) | private isArray(type: ts.Type): type is ts.TypeReference {
method isFunction (line 1828) | private isFunction(type: ts.Type): type is ts.ObjectType {
method parseObjectType (line 1835) | private parseObjectType(node: ts.Node, tsClass: TSClass) {
method parseSignature (line 1881) | private parseSignature(signature: ts.Signature | undefined) {
method parseNestDeclare (line 1996) | private parseNestDeclare(
method parseIndexSignature (line 2022) | private parseIndexSignature(
method parseInfcType (line 2051) | private parseInfcType(node: ts.InterfaceDeclaration, infc: TSInterface) {
method parseClassType (line 2237) | private parseClassType(node: ts.ClassDeclaration, classType: TSClass) {
method setMethod (line 2594) | private setMethod(
method parseTypeParameters (line 2689) | parseTypeParameters(
method parseStatic (line 2737) | private parseStatic(node: ts.FunctionLikeDeclaration): boolean {
method parseConstructor (line 2750) | private parseConstructor(ctor: ts.ConstructorDeclaration) {
method parseTypeRefRelationship (line 2757) | private parseTypeRefRelationship(type: TSClass) {
method parseTypeRefRelationship2 (line 2774) | private parseTypeRefRelationship2(type: Type, refsSet: Set<TSClass>) {
method typeIdAllocate (line 2790) | private typeIdAllocate(type: TSClass) {
method generateTypeId (line 2832) | private generateTypeId(typeString: string): number {
method getShapeDesc (line 2842) | private getShapeDesc(tsCla
Condensed preview — 499 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (3,143K chars).
[
{
"path": ".c8rc.json",
"chars": 260,
"preview": "{\n \"all\": true,\n \"include\": [\n \"src/**/*.ts\"\n ],\n \"exclude\": [\n \"src/backend/binaryen/glue/*.t"
},
{
"path": ".clang-format",
"chars": 1250,
"preview": "# using [clang-formt-12 options](https://releases.llvm.org/12.0.0/tools/clang/docs/ClangFormatStyleOptions.html)\nRawStri"
},
{
"path": ".clang-tidy",
"chars": 606,
"preview": "# refer to https://clang.llvm.org/extra/clang-tidy/checks/list.html\n\nChecks: '-*, readability-identifier-naming, clang-"
},
{
"path": ".devcontainer/.dockerignore",
"chars": 13,
"preview": "node_modules\n"
},
{
"path": ".devcontainer/Dockerfile",
"chars": 1558,
"preview": "#\n# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exceptio"
},
{
"path": ".devcontainer/devcontainer.json",
"chars": 764,
"preview": "{\n \"name\": \"DevContainers\", // dev container name\n \"dockerComposeFile\": [\n \"docker-compose.yml\" // docker-c"
},
{
"path": ".devcontainer/docker-compose.yml",
"chars": 476,
"preview": "version: '3.7' # which syntax version the file uses.\n\nservices:\n devcontainer:\n image: acme/workspace:0.1 # the ima"
},
{
"path": ".dockerignore",
"chars": 16,
"preview": "**/node_modules/"
},
{
"path": ".eslintignore",
"chars": 216,
"preview": "# cant test switch-case-statement.ts because of eslint checking, add the line temporarily\ntests/samples/*\nruntime-librar"
},
{
"path": ".eslintrc.json",
"chars": 991,
"preview": "{\n \"parser\": \"@typescript-eslint/parser\",\n \"parserOptions\": {\n \"warnOnUnsupportedTypeScriptVersion\": false,"
},
{
"path": ".github/workflows/benchmark.yml",
"chars": 2959,
"preview": "# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception\n"
},
{
"path": ".github/workflows/build_llvm_libraries.yml",
"chars": 3729,
"preview": "# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception\n"
},
{
"path": ".github/workflows/libdyntype_ci.yaml",
"chars": 996,
"preview": "#\n# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exceptio"
},
{
"path": ".github/workflows/ts2wasm_aot.yml",
"chars": 3495,
"preview": "# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception\n"
},
{
"path": ".github/workflows/ts2wasm_ci.yaml",
"chars": 2547,
"preview": "#\n# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exceptio"
},
{
"path": ".github/workflows/ts2wasm_macos.yml",
"chars": 2814,
"preview": "#\n# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exceptio"
},
{
"path": ".github/workflows/ts2wasm_windows.yml",
"chars": 1409,
"preview": "#\n# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exceptio"
},
{
"path": ".gitignore",
"chars": 223,
"preview": "node_modules\nbuild\ndist\nout\n.nyc_output\ncoverage\nc-backend\nlogs\nlib/builtin/watFile/\nlogs\n*.swp\n*.wat\n*.wasm\n*.log\n*.swo"
},
{
"path": ".mocharc.json",
"chars": 92,
"preview": "{\n \"extension\": [\"ts\"],\n \"loader\": \"ts-node/esm\",\n \"spec\": \"tests/**/**.test.ts\"\n}\n"
},
{
"path": ".prettierignore",
"chars": 82,
"preview": "runtime-library/*\ntests/samples/*\ntools/playground/server/assets/samples/*\nfuzz/*\n"
},
{
"path": ".prettierrc.json",
"chars": 378,
"preview": " {\n \"printWidth\": 80,\n \"tabWidth\": 4,\n \"useTabs\": false,\n \"semi\": true,\n \"singleQuote\": true,\n \"quote"
},
{
"path": "ATTRIBUTIONS.md",
"chars": 2299,
"preview": "Wasmnizer-ts Attributions\n======================================\n\nWasmnizer-ts project reused some components from other"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 5438,
"preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nWe as members, contributors, and leaders pledge to make participa"
},
{
"path": "CONTRIBUTING.md",
"chars": 3620,
"preview": "# Contributing\n\n### License\n\n`Wasmnizer-ts` is licensed under the terms in [LICENSE](./LICENSE). By contributing to the "
},
{
"path": "LICENSE",
"chars": 12242,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 4899,
"preview": "<div align=\"center\">\n <h1><code>Wasmnizer-ts</code></h1>\n\n <p>\n <strong>Toolchain for compiling TypeScript to WasmG"
},
{
"path": "cli/options.json",
"chars": 2175,
"preview": "{\n \"version\": {\n \"category\": \"General\",\n \"description\": \"Print the compiler's version.\",\n \"alias"
},
{
"path": "cli/ts2wasm.ts",
"chars": 11046,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "config/config_mgr.ts",
"chars": 822,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "config/log4js.ts",
"chars": 1146,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "doc/additonal_sematic_check.md",
"chars": 5204,
"preview": "# Additional Sematic Check\n\n## Motivation\nDue to the partially features of TypeScript and the current limitations of Web"
},
{
"path": "doc/architecture.md",
"chars": 38,
"preview": ""
},
{
"path": "doc/dev_environment.md",
"chars": 1667,
"preview": "# ts2wasm development environment\n\nA VSCode dev-container is available for this project.\n\n### Enter the container\n\nAfter"
},
{
"path": "doc/developer-guide/any_object.md",
"chars": 4254,
"preview": "# Any-objects\n\nIf the type of a variable is not decided, you can use `any` as the type annotation, and this variable wil"
},
{
"path": "doc/developer-guide/basic_concepts.md",
"chars": 3444,
"preview": "# Basic concepts\n\n## Types in TypeScript\n\nIn TypeScript, every variable is associated with a type annotation, these anno"
},
{
"path": "doc/developer-guide/class.md",
"chars": 3850,
"preview": "# Class\n\nClasses are declared using the `class` keyword\n\n## Class fields\n\n``` TypeScript\nclass Car {\n price: number ="
},
{
"path": "doc/developer-guide/expose_host_API.md",
"chars": 3807,
"preview": "# ts2wasm-compiler host API mechanism\n\nts2wasm-compiler allows developer to expose their own native APIs to the applicat"
},
{
"path": "doc/developer-guide/fallback.md",
"chars": 1428,
"preview": "# ts2wasm-compiler fallback mechanism\n\nThe strategy of ts2wasm-compiler is to apply static compilation as much as possib"
},
{
"path": "doc/developer-guide/feature_list.md",
"chars": 6621,
"preview": "# Wasmnizer-ts feature list\n\nTable column definition:\n- `feature`\n TypeScript keyword/type/syntax/concepts\n\n- `WAMR`\n"
},
{
"path": "doc/developer-guide/function.md",
"chars": 2384,
"preview": "# Function and closure\n\n## Declaration\n\nThere are three kind of syntax to define a function:\n\n1. Function declaration sy"
},
{
"path": "doc/developer-guide/generic.md",
"chars": 5493,
"preview": "# Generic Type Process\n\n## Generic Types\nAt present, the processing of generic types mainly focuses on generic functions"
},
{
"path": "doc/developer-guide/import_export.md",
"chars": 1221,
"preview": "# import and export\n\nIn ts2wasm-compiler, every file can import/export element from/to other files. The dependencies are"
},
{
"path": "doc/developer-guide/index.md",
"chars": 1377,
"preview": "# Wasmnizer-ts developer guide\n\nTypeScript is a typed superset of JavaScript, its rich type information has been employe"
},
{
"path": "doc/developer-guide/interface.md",
"chars": 1887,
"preview": "# interface\n\n## Interface declaration\n\n``` TypeScript\ninterface I {\n x: number;\n readonly z: string; // field with"
},
{
"path": "doc/developer-guide/wasmType_usage.md",
"chars": 7131,
"preview": "# Use wasmType in typescript\n## wasmType declaration\nNow we support use wasmType directly in typescript, these below typ"
},
{
"path": "doc/environment_variables.md",
"chars": 420,
"preview": "# ts2wasm environment variables\n\nThis document record useful environment variables used during development, these variab"
},
{
"path": "doc/faq.md",
"chars": 3809,
"preview": "# Frequently Asked Questions (FAQ)\n\nThis document provides answers to some of the most frequently asked questions about "
},
{
"path": "doc/getting_started.md",
"chars": 1122,
"preview": "# Getting Started\n\n## Build the compiler\n1. clone the repo\n ``` bash\n git clone https://github.com/intel/Wasmnizer"
},
{
"path": "doc/libdyntype_api_spec.md",
"chars": 19391,
"preview": "# libdyntype API spec\n\n## Overview\n\n`libdyntype` is a library for supporting dynamic objects for WebAssembly. It provide"
},
{
"path": "doc/libstruct_indirect_api_spec.md",
"chars": 3472,
"preview": "# libstruct_indirect API spec\n\n## Overview\n\nThe `libstruct_indirect` API is used to access WasmGC struct fields through "
},
{
"path": "doc/standard-library/array.md",
"chars": 6674,
"preview": "# Array API\n\nThe standard array APIs are implemented by `native`. Here we list the APIs supported by `Wasmnizer-ts`.\n\nPl"
},
{
"path": "doc/standard-library/console.md",
"chars": 293,
"preview": "# console API\n\n- **[`log(...values: any[]): void`](https://github.com/microsoft/TypeScript/blob/c532603633178c552b9747ee"
},
{
"path": "doc/standard-library/index.md",
"chars": 1544,
"preview": "# Wasmnizer-ts standard library\n\nTypeScript doesn't introduce its own standard library, instead it relies on APIs provid"
},
{
"path": "doc/standard-library/math.md",
"chars": 1210,
"preview": "# Math API\n\nThe standard math APIs are implemented by `source code` and `binaryen API`. Here we list the APIs supported "
},
{
"path": "doc/standard-library/string.md",
"chars": 3310,
"preview": "# string API\n\nThe standard string APIs are implemented by `binaryen API`. Below are the string APIs supported by `Wasmni"
},
{
"path": "doc/validation_strategy.md",
"chars": 4248,
"preview": "# ts2wasm-compiler validation strategy (WIP)\n\nTs2wasm-compiler aims to compile TypeScript source code to WebAssembly byt"
},
{
"path": "example/app-framework/CMakeLists.txt",
"chars": 3085,
"preview": "# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception\n"
},
{
"path": "example/app-framework/app/connection.ts",
"chars": 2297,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "example/app-framework/app/request_handler.ts",
"chars": 856,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "example/app-framework/app/request_sender.ts",
"chars": 939,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "example/app-framework/app/timer.ts",
"chars": 650,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "example/app-framework/build.sh",
"chars": 3505,
"preview": "#\n# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exceptio"
},
{
"path": "example/app-framework/lib/attr_container.ts",
"chars": 11999,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "example/app-framework/lib/connection.ts",
"chars": 3188,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "example/app-framework/lib/request.ts",
"chars": 15406,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "example/app-framework/lib/timer.ts",
"chars": 2096,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "example/app-framework/lib/utils.ts",
"chars": 800,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "example/app-framework/profiles/host-aot/wamr_config_wasmnizer_ts.cmake",
"chars": 995,
"preview": "# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception\n"
},
{
"path": "example/app-framework/profiles/host-interp/wamr_config_wasmnizer_ts.cmake",
"chars": 971,
"preview": "# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception\n"
},
{
"path": "example/app-framework/src/iwasm_main.c",
"chars": 15788,
"preview": "/*\n * Copyright (C) 2019 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "example/app-framework/src/main.c",
"chars": 236,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "lib/builtin/builtin_name.ts",
"chars": 10958,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "lib/builtin/lib.type.d.ts",
"chars": 8983,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "lib/builtin/lib_builtin.ts",
"chars": 1328,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "package.json",
"chars": 2233,
"preview": "{\n \"name\": \"Wasmnizer-ts\",\n \"version\": \"0.0.1\",\n \"description\": \"\",\n \"main\": \"index.js\",\n \"type\": \"module\",\n \"dire"
},
{
"path": "runtime-library/CMakeLists.txt",
"chars": 3010,
"preview": "#\n# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exceptio"
},
{
"path": "runtime-library/LICENSE",
"chars": 12242,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "runtime-library/README.md",
"chars": 1417,
"preview": "# ts2wasm runtime library\n\nThis folder contains code to be built into WAMR runtime to expose required APIs for executing"
},
{
"path": "runtime-library/build.sh",
"chars": 331,
"preview": "#!/bin/bash\n\n# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LL"
},
{
"path": "runtime-library/deps/.gitignore",
"chars": 18,
"preview": "quickjs/\nwamr-gc/\n"
},
{
"path": "runtime-library/deps/download.sh",
"chars": 388,
"preview": "#!/bin/bash\n\n#\n# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH "
},
{
"path": "runtime-library/libdyntype/CMakeLists.txt",
"chars": 1240,
"preview": "#\n# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exceptio"
},
{
"path": "runtime-library/libdyntype/README.md",
"chars": 827,
"preview": "# Dynamic type library\n\nDynamic type library is an independent library which provide APIs to create/operate the dynamic "
},
{
"path": "runtime-library/libdyntype/dynamic-qjs/context.c",
"chars": 2020,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/dynamic-qjs/fallback.c",
"chars": 2183,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/dynamic-qjs/object.c",
"chars": 26933,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/dynamic-qjs/pure_dynamic.h",
"chars": 4794,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/dynamic-qjs/type.h",
"chars": 418,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/dynamic-simple/README.md",
"chars": 499,
"preview": "# libdyntype with simple implementation\n\nThis folder provides a simplified implementation of libdyntype without dependen"
},
{
"path": "runtime-library/libdyntype/dynamic-simple/context.c",
"chars": 700,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/dynamic-simple/dyn-value/README.md",
"chars": 56,
"preview": "# dynamic value design\n\n\n"
},
{
"path": "runtime-library/libdyntype/dynamic-simple/dyn-value/class/date.c",
"chars": 4747,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/dynamic-simple/dyn-value/class/dyn_class.c",
"chars": 3110,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/dynamic-simple/dyn-value/class/dyn_class.h",
"chars": 1168,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/dynamic-simple/dyn-value/class/object.c",
"chars": 1043,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/dynamic-simple/dyn-value/class/string.c",
"chars": 1634,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/dynamic-simple/dyn-value/dyn_value.c",
"chars": 9106,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/dynamic-simple/dyn-value/dyn_value.h",
"chars": 2430,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/dynamic-simple/fallback.c",
"chars": 517,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/dynamic-simple/object.c",
"chars": 20776,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/dynamic-simple/pure_dynamic.h",
"chars": 4825,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/extref/extref.c",
"chars": 10718,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/extref/extref.h",
"chars": 1056,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/lib_dyntype_wrapper.c",
"chars": 25228,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/libdyntype.c",
"chars": 9994,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/libdyntype.cmake",
"chars": 889,
"preview": "#\n# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exceptio"
},
{
"path": "runtime-library/libdyntype/libdyntype.h",
"chars": 13128,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/libdyntype_export.h",
"chars": 5126,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/test/CMakeLists.txt",
"chars": 2643,
"preview": "#\n# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exceptio"
},
{
"path": "runtime-library/libdyntype/test/dump.cc",
"chars": 2247,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/test/object_property_test.cc",
"chars": 27643,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/test/operator_test.cc",
"chars": 5679,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/test/prototype_test.cc",
"chars": 2352,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/test/test_app.h",
"chars": 5165,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/libdyntype/test/types_test.cc",
"chars": 19492,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/main.c",
"chars": 29942,
"preview": "/*\n * Copyright (C) 2019 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/stdlib/lib_array.c",
"chars": 71475,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/stdlib/lib_console.c",
"chars": 1953,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/stdlib/lib_timer.c",
"chars": 1343,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "runtime-library/stringref/README.md",
"chars": 154,
"preview": "# stringref implementation for WAMR based on libdyntype\n\nThis implementation uses dynamic typed string from libdyntype t"
},
{
"path": "runtime-library/stringref/stringref_qjs.c",
"chars": 5787,
"preview": "/*\n * Copyright (C) 2019 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-except"
},
{
"path": "runtime-library/stringref/stringref_simple.c",
"chars": 3472,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-except"
},
{
"path": "runtime-library/struct-indirect/lib_struct_indirect.c",
"chars": 7149,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/struct-indirect/lib_struct_indirect.h",
"chars": 1516,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/utils/object_utils.c",
"chars": 17003,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/utils/object_utils.h",
"chars": 1049,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/utils/type_utils.c",
"chars": 43683,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/utils/type_utils.h",
"chars": 8905,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/utils/wamr_utils.c",
"chars": 1358,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/utils/wamr_utils.h",
"chars": 453,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "runtime-library/wamr_config.cmake",
"chars": 1489,
"preview": "#\n# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exceptio"
},
{
"path": "scripts/LICENSE.txt",
"chars": 9142,
"preview": "Apache License\n\nVersion 2.0, January 2004\n\nhttp://www.apache.org/licenses/ \n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION,"
},
{
"path": "scripts/copy_lib_files.js",
"chars": 888,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "scripts/gdb/.gitignore",
"chars": 11,
"preview": "__pycache__"
},
{
"path": "scripts/gdb/constants.py",
"chars": 1423,
"preview": "#\n# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exceptio"
},
{
"path": "scripts/gdb/utils.py",
"chars": 1096,
"preview": "#\n# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exceptio"
},
{
"path": "scripts/gdb/wamr_dbg.py",
"chars": 5324,
"preview": "#\n# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exceptio"
},
{
"path": "scripts/gdb/wamr_exec_env.py",
"chars": 12272,
"preview": "#\n# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exceptio"
},
{
"path": "scripts/gdb/wamr_objects.py",
"chars": 6349,
"preview": "#\n# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exceptio"
},
{
"path": "scripts/gdb/wamr_types.py",
"chars": 5713,
"preview": "#\n# Copyright (C) 2023 Intel Corporation. All rights reserved.\n# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exceptio"
},
{
"path": "scripts/hooks/pre-commit",
"chars": 16,
"preview": "npx lint-staged\n"
},
{
"path": "scripts/link_hooks.js",
"chars": 1059,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "security.md",
"chars": 406,
"preview": "# Security Policy\nIntel is committed to rapidly addressing security vulnerabilities affecting our customers and providin"
},
{
"path": "src/backend/README.md",
"chars": 492,
"preview": "# ts2wasm backend\n\nts2wasm is designed to support multiple backends, every backend should inherit the `Ts2wasmBackend` c"
},
{
"path": "src/backend/binaryen/glue/LICENSE",
"chars": 11357,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "src/backend/binaryen/glue/NOTICE",
"chars": 3151,
"preview": "The following authors have all licensed their contributions to AssemblyScript\nunder the licensing terms detailed in LICE"
},
{
"path": "src/backend/binaryen/glue/binaryen.d.ts",
"chars": 86318,
"preview": "/**\n * @fileoverview Portable definitions for Binaryen's C-API.\n *\n * tsc uses the .js file next to it, while asc makes "
},
{
"path": "src/backend/binaryen/glue/binaryen.js",
"chars": 23506,
"preview": "/**\n * @fileoverview Binaryen glue code for JavaScript.\n * @license Apache-2.0\n */\n\n/* This file is modified base on:\n *"
},
{
"path": "src/backend/binaryen/glue/packType.ts",
"chars": 1313,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/backend/binaryen/glue/transform.ts",
"chars": 14355,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/backend/binaryen/glue/utils.ts",
"chars": 398,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/backend/binaryen/index.ts",
"chars": 45900,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/backend/binaryen/lib/array_utils.ts",
"chars": 726,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/backend/binaryen/lib/dyntype/utils.ts",
"chars": 5603,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/backend/binaryen/lib/env_init.ts",
"chars": 16796,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/backend/binaryen/lib/init_builtin_api.ts",
"chars": 200591,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/backend/binaryen/lib/interface/meta.c",
"chars": 2237,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/backend/binaryen/memory.ts",
"chars": 2095,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/backend/binaryen/utils.ts",
"chars": 99609,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/backend/binaryen/wasm_expr_gen.ts",
"chars": 195071,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/backend/binaryen/wasm_stmt_gen.ts",
"chars": 16038,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/backend/binaryen/wasm_type_gen.ts",
"chars": 61001,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/backend/index.ts",
"chars": 3362,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/dump_ast.ts",
"chars": 29256,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "src/error.ts",
"chars": 1328,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/expression.ts",
"chars": 75824,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/frontend.ts",
"chars": 10121,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/import_resolve.ts",
"chars": 8037,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/log.ts",
"chars": 2525,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/scope.ts",
"chars": 41977,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/semantic_check.ts",
"chars": 12170,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/semantics/builder_context.ts",
"chars": 14083,
"preview": "/*\n\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exc"
},
{
"path": "src/semantics/builtin.ts",
"chars": 9776,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "src/semantics/dump.ts",
"chars": 491,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "src/semantics/expression_builder.ts",
"chars": 101921,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "src/semantics/flatten.ts",
"chars": 16841,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "src/semantics/index.ts",
"chars": 28729,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "src/semantics/internal.ts",
"chars": 454,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "src/semantics/ir/data_pool.ts",
"chars": 2385,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "src/semantics/ir/function.ts",
"chars": 48176,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "src/semantics/ir/ir_context.ts",
"chars": 8826,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "src/semantics/ir/ircode.ts",
"chars": 22110,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "src/semantics/ir/irmodule.ts",
"chars": 14969,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "src/semantics/predefined_types.ts",
"chars": 6043,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "src/semantics/runtime.ts",
"chars": 15834,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "src/semantics/semantics_nodes.ts",
"chars": 27885,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "src/semantics/statement_builder.ts",
"chars": 21476,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "src/semantics/type_creator.ts",
"chars": 49705,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "src/semantics/value.ts",
"chars": 38188,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "src/semantics/value_types.ts",
"chars": 20970,
"preview": "/*\n * Copyright (C) 2023 Xiaomi Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exce"
},
{
"path": "src/statement.ts",
"chars": 74397,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/type.ts",
"chars": 108839,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/utils.ts",
"chars": 68489,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "src/variable.ts",
"chars": 14449,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "tests/benchmark/README.md",
"chars": 2425,
"preview": "## Wasmnizer-ts benchmarks\n\nThese benchmarks are based on some open source efforts to measure performance of the `ts2was"
},
{
"path": "tests/benchmark/any_basic_type_access.js",
"chars": 463,
"preview": "\"use strict\";\n/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 W"
},
{
"path": "tests/benchmark/any_basic_type_access.ts",
"chars": 457,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "tests/benchmark/any_complex_type_access.js",
"chars": 665,
"preview": "\"use strict\";\n/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 W"
},
{
"path": "tests/benchmark/any_complex_type_access.ts",
"chars": 570,
"preview": "/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 WITH LLVM-excep"
},
{
"path": "tests/benchmark/array_access.js",
"chars": 526,
"preview": "\"use strict\";\n/*\n * Copyright (C) 2023 Intel Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0 W"
}
]
// ... and 299 more files (download for full content)
About this extraction
This page contains the full source code of the web-devkits/Wasmnizer-ts GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 499 files (2.9 MB), approximately 773.8k tokens, and a symbol index with 4663 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.