-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ModuleNamespace Support #1401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ModuleNamespace Support #1401
Conversation
Add support for module namespace. The basic syntax is export * as myNS from 'submodule.js' The namespace is a sealed object with all the exported properties from the currently module. The properties are not changable. They are also "reference property" in that it should look up the original property instead of caching the value of the property. There are three set of properties in the namespace object: . builtin Symbol properties, include Symbol.toStringTag & Symbol.iterator at this time. . local exports. As the local exports are allocated in the specific slot array. . nonlocal exports. We need to forward the call to other referencing module namespace object. Similarly, the enumerator needs to take care of the different kinds of properties. However, the iterator need to iterate through the property names in sorted order. We'll create the iterator for a sorted name list. CreateListIterator operation (7.4.8) is implemented as well. Add a set of unittests to cover the object behavior of namespace object.
lib/Runtime/Base/JnDirectFields.h
Outdated
| ENTRY(decodeURIComponent) | ||
| ENTRY2(default_, _u("default")) | ||
| ENTRY2(delete_, _u("delete")) // "delete" cannot be an identifier in C++ so using "delete_" instead | ||
| ENTRY2(star, _u("*")) |
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.
Should we indicate this is a symbol (change name to "_star" or similar)? It seems unlikely, but a built-in API might come along with the name of star (String.prototype.star maybe). #Resolved
| TypeIds_HostObject = 72, | ||
| TypeIds_ActivationObject = 73, | ||
| TypeIds_SpreadArgument = 74, | ||
| TypeIds_ModuleNamespace = 75, |
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.
TypeIds_ModuleNamespace [](start = 4, length = 23)
Is this object a "TrueJavascriptObjectType" ? #ByDesign
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.
|
Cool stuff! 👍 |
|
@dotnet-bot test Windows x86_test please |
Merge pull request #1401 from Yongqu:modulens Add support for module namespace. The basic syntax is export * as myNS from 'submodule.js' The namespace is a sealed object with all the exported properties from the currently module. The properties are not changable. They are also "reference property" in that it should look up the original property instead of caching the value of the property. There are three set of properties in the namespace object: . builtin Symbol properties, include Symbol.toStringTag & Symbol.iterator at this time. . local exports. As the local exports are allocated in the specific slot array. . nonlocal exports. We need to forward the call to other referencing module namespace object. Similarly, the enumerator needs to take care of the different kinds of properties. However, the iterator need to iterate through the property names in sorted order. We'll create the iterator for a sorted name list. CreateListIterator operation (7.4.8) is implemented as well. Add a set of unittests to cover the object behavior of namespace object.
Add support for module namespace. The basic syntax is
export * as myNS from 'submodule.js'
The namespace is a sealed object with all the exported properties from the currently
module. The properties are not changable. They are also "reference property" in that
it should look up the original property instead of caching the value of the property.