This repository was archived by the owner on Jul 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Adapt namespacing to Scala.js core conventions. #127
Merged
sjrd
merged 12 commits into
tanishiking:main
from
sjrd:adapt-namespacing-to-core-conventions
May 14, 2024
Merged
Adapt namespacing to Scala.js core conventions. #127
sjrd
merged 12 commits into
tanishiking:main
from
sjrd:adapt-namespacing-to-core-conventions
May 14, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11d24cf
to
d8bc76e
Compare
tanishiking
approved these changes
May 14, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you very much for well-explained commit messages!
Comment on lines
+349
to
+350
* ¹ We use the Unicode character `⟦` to represent two consecutive `[` characters in order | ||
* not to confuse Scaladoc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤣
Everything in the package is "Wasm". This file is specifically about the module structure, as described in https://webassembly.github.io/gc/core/syntax/modules.html
We put everything from `Modules.scala` inside `object Modules`, and everything from `Instructions.scala` inside `object Instructions`.
So that `FunctionBuilder` does not need to know about IR Trees.
Import Wasm types as `watpe` (similar to `irtpe` or `jstpe`, which we use in the JS backend and the compiler backend). Import IR elements without namespacing.
In the CoreWasmLib, we manipulate IR types and names, but not trees, so we import the former two without namespacing. We produce a lot of Wasm types and instructions, so those are imported without namespacing either. This is similar to the import strategy of the `CoreJSLib` in the JS backend.
The Preprocessor never manipulates any WebAssembly things, so we can import IR things without namespace.
The competition is a bit tight, but WasmContext manipulates more IR concepts than Wasm contexts. Therefore, we import IR things without namespace, and Wasm things under short namespaces. We use `wa`, `watpe`, `wamod` and `wanme` by analogy to the compiler backend and JS backend conventions, which use `js` and `jsnme`.
The choice of what to import with or without namespace is the same as the `Emitter` in the JS backend. IR trees are only required in `genStartFunction`, so we confine their imports there. Arguably `genStartFunction` conceptually belongs more to `ClassEmitter` than `Emitter`.
The choice of what to import with or without namespace is the same as the `ClassEmitter` in the JS backend.
The choice of what to import with or without namespace is the same as the `FunctionEmitter` in the JS backend.
Now that everything is properly namespaced, we do not need this artificial namespacing in the class names.
d8bc76e
to
5287949
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.