You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support expr when use typescript_custom_section attribute (#3901)
* feat: support expr when use `typescript_custom_section` attribute
* test: update typescript-tests
* chore: update "APPROVED_SCHEMA_FILE_HASH" of shared lib
* chore: cargo fmt
* Apply suggestions from code review
include fix typo and adding whitespace to ensure consistent code style.
Co-authored-by: Liam Murphy <[email protected]>
* chore(backend): fix typo
* chore(typescript-tests): rename custom_section_type to custom_section_type.d.ts
* fix(backend/codegen): change method flat_slices to flat_byte_slices in order to avoid unsafe code
* fix(backend/codegen): use dynamic wasm_bindgen path as import entry
* chore(typescript-tests): ignore *.d.ts file when test
* chore(shared/program): rename CustomSection to LitOrExpr
* doc(shared/lib): add doc for program[typescript_custom_sections], explain why there are different types of LitOrExpr when encoding and decoding
* chore(shared): update "APPROVED_SCHEMA_FILE_HASH" of shared lib
* doc: add docs for method encode_u32_to_fixed_len_bytes
* refactor(backend/encode): rename method shared_typescript_custom_section to shared_lit_or_expr
* refactor(__rt): extract methods from nested mod directly into `__rt`
* chore: cargo fmt
* chore(__rt): remove unnecessary TODO
* chore(changelog): update change log
Support Expressions when using the `typescript_custom_section` attribute[#3901]
* Update CHANGELOG.md
Copy file name to clipboardExpand all lines: crates/shared/src/lib.rs
+5-1
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,11 @@ macro_rules! shared_api {
17
17
enums:Vec<Enum<'a>>,
18
18
imports:Vec<Import<'a>>,
19
19
structs:Vec<Struct<'a>>,
20
-
typescript_custom_sections:Vec<&'a str>,
20
+
// NOTE: Originally typescript_custom_sections are just some strings
21
+
// But the expression type can only be parsed into a string during compilation
22
+
// So when encoding, LitOrExpr contains two types, one is that expressions are parsed into strings during compilation, and the other is can be parsed directly.
23
+
// When decoding, LitOrExpr can be decoded as a string.
0 commit comments