-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
This mostly gets some test failing in a different way - not certain it's correct
Also includes tons of parsing and other small fixes
ast/node.go: reduce diff func.go: revert to master parser/lexer.go: revert to master vm.go: revert some parts runtime.go: revert print stuff tc39_test.go: comment on dumpcode builtin_promise.go: formatting changes
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 |
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.
Is it expected?
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.
I've made a better note for future refactoring
@@ -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 |
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.
Is it expected?
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.
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.
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.
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.
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 |
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.
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?
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.
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.
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.
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 👍🏻
Co-authored-by: Ivan <[email protected]>
Co-authored-by: Ivan <[email protected]>
Co-authored-by: Ivan <[email protected]>
TBD