bytecodealliance / bytecodealliance/ComponentizeJS

ReferenceError when resource has no functions

オープン
#221 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
Rust
スター
391
フォーク
53
平均マージ
3日 5時間
マージ済み PR(30日)
1

説明

Having an empty resource:
```wit
interface execution {

resource join-set-id {
// id: func() -> string;
}

new-join-set: func() -> join-set-id;
}
```
Calling `new-join-set` from a JavaScript guest fails with an error: `ReferenceError: import_execution_1_0_0$JoinSetId is not defined`.
This is because the generated `initializer.js`does not contain `class import_execution_1_0_0$JoinSetId {...}`, but tries to use it in the generated `new-join-set` function: `var rsc2 = new.target === import_execution_1_0_0$JoinSetId ? this : Object.create(import_execution_1_0_0$JoinSetId.prototype);`

The workaround is to add a function, which triggers the `class` generation.
Tested with componentize-js version 0.18.2 .

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。