Skip to content
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

Modules #1

Merged
merged 163 commits into from
Jul 8, 2024
Merged

Modules #1

merged 163 commits into from
Jul 8, 2024

Conversation

mstoykov
Copy link
Collaborator

TBD

oleiade and others added 30 commits December 8, 2021 16:20
This mostly gets some test failing in a different way - not certain it's
correct
Also includes tons of parsing and other small fixes
@mstoykov mstoykov requested a review from a team as a code owner June 20, 2024 13:54
@mstoykov mstoykov requested review from oleiade and codebien June 20, 2024 13:54
vm.go Outdated
@@ -542,6 +548,7 @@ func (s *stash) deleteBinding(name unistring.String) {
func (vm *vm) newStash() {
vm.stash = &stash{
outer: vm.stash,
vm: vm, // TODO fix

Choose a reason for hiding this comment

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

Is it expected?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've made a better note for future refactoring

compiler.go Outdated Show resolved Hide resolved
compiler.go Outdated Show resolved Hide resolved
compiler.go Outdated Show resolved Hide resolved
compiler.go Outdated Show resolved Hide resolved
compiler_expr.go Outdated Show resolved Hide resolved
@@ -2327,6 +2336,12 @@ func (c *compiler) compileArrowFunctionLiteral(v *ast.ArrowFunctionLiteral) *com

func (c *compiler) emitLoadThis() {
b, eval := c.scope.lookupThis()

if c.module != nil && c.scope.outer != nil && c.scope.outer.outer == nil { // modules don't have this defined
// TODO maybe just add isTopLevel and rewrite the rest of the code

Choose a reason for hiding this comment

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

Is it expected?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am going to try to do this in the next weeks, but AFAIR it was pretty hard to do this.

A bunch of other similar stuff also have ... strange ways of figuring out what is happening through the codebase, in part because the specification has some really cool corner cases.

But I will try to look into this specifically.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would like to leave this as a note on a thing I will like to refactor, but I don't think it is going to be easy, so given the time pressure I will prefer to leave it for now.

compiler_expr.go Outdated Show resolved Hide resolved
modules_namespace.go Outdated Show resolved Hide resolved
vm.go Outdated

func (_loadDynamicImport) exec(vm *vm) {
// https://262.ecma-international.org/13.0/#sec-import-call-runtime-semantics-evaluation
vm.push(vm.r.ToValue(func(specifier Value) Value { // TODO remove this function

Choose a reason for hiding this comment

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

Suggested change
vm.push(vm.r.ToValue(func(specifier Value) Value { // TODO remove this function
vm.push(vm.r.ToValue(func(specifier Value) Value {

Why, when is it expected to happen?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not in this PR - looking at the code I do realize that I did this in order to get this done isntead of writing it to be more optimal.

We are not going to use dynamic import right now, and it still is fast enough, but it will be nice to fix it in the future.

I have added a note for it.

Copy link
Member

@oleiade oleiade left a comment

Choose a reason for hiding this comment

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

Looking really good as far as I can tell 👀 👏🏻 🚀

I've spotted a couple of TODOs behind, but nothing felt dramatically important, so I assumed it was good to go 👍🏻

@mstoykov mstoykov requested a review from codebien July 5, 2024 08:17
@mstoykov mstoykov merged commit 482a08f into main Jul 8, 2024
8 checks passed
@mstoykov mstoykov deleted the modules branch July 8, 2024 12:30
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.

3 participants