Skip to content

Support (module definition ...) constructs - #2829

Merged
zherczeg merged 1 commit into
WebAssembly:mainfrom
zherczeg:definition
Aug 20, 2026
Merged

zherczeg merged 1 commit into
WebAssembly:mainfrom
zherczeg:definition

Conversation

@zherczeg

Copy link
Copy Markdown
Collaborator

Related patch: #2666

@sbc100

sbc100 commented Aug 19, 2026

Copy link
Copy Markdown
Member

Does this replace #2666? Is it an alternative implementation?

Comment thread include/wabt/ir.h Outdated
class TextScriptModule : public ScriptModuleMixin<ScriptModuleType::Text> {
public:
const Location& location() const override { return module.loc; }
bool IsDefinition() const override { return is_definition; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to just just make is_definition a public field on ScriptModule? i.e. do we need to use a virtual method here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. I will change this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is even simpler this way.

@sbc100 sbc100 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! A surprisingly small patch to make this work.

@zherczeg

Copy link
Copy Markdown
Collaborator Author

Yes this is a replacement.

Comment thread src/prebuilt/lexer-keywords.cc Outdated
@@ -1,4 +1,4 @@
/* C++ code produced by gperf version 3.2.1 */
/* C++ code produced by gperf version 3.3 */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we do not pin the exact version that we use here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. Shall I use an older one?

@zherczeg zherczeg Aug 20, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have downloaded and compiled a 3.2.1 gperf from here: https://ftp.gnu.org/gnu/gperf/

Anyway the README says this:

## Adding new keywords to the lexer

If you want to add new keywords, you'll need to install
[gperf](https://www.gnu.org/software/gperf/). Before you upload your PR, please
run `make update-gperf` to update the prebuilt C++ sources in `src/prebuilt/`.

If we want to use a specific gperf version, we should add its version here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, yes this change seems fine. I was just wondering if we used a pinned version, for consistency, but its seems we don't. Not a huge deal i think,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newer versions likely fix some issues. I think the only rule we should use is that we never go back to older gperf. Otherwise file updates will be chaos.

@zherczeg
zherczeg merged commit dce6242 into WebAssembly:main Aug 20, 2026
17 checks passed
@zherczeg
zherczeg deleted the definition branch August 20, 2026 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants