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

refactor(vm): Refactor simple object patterns #398

Merged
merged 2 commits into from
Aug 25, 2024

Conversation

andreubotella
Copy link
Collaborator

This patch prepares object patterns to be split into simple and complex similarly to array patterns (see #394), where complex patterns (having either initializers or computed property keys) would be transpiled into regular bytecode.

Since only a subset of simple object patterns were supported so far, this patch refines the compilation to only use two binding properties, BindingPatternBind and BindingPatternBindNamed. In the future, rest bindings will also be supported.

Despite being a refactoring, this patch makes certain tests pass due to bugs in the original implementation of object patterns.

This patch prepares object patterns to be split into simple and
complex similarly to array patterns (see trynova#394), where complex patterns
(having either initializers or computed property keys) would be
transpiled into regular bytecode.

Since only a subset of simple object patterns were supported so far,
this patch refines the compilation to only use two binding properties,
`BindingPatternBind` and `BindingPatternBindNamed`. In the future,
rest bindings will also be supported.

Despite being a refactoring, this patch makes certain tests pass due
to bugs in the original implementation of object patterns.
aapoalas
aapoalas previously approved these changes Aug 25, 2024
Copy link
Collaborator

@aapoalas aapoalas left a comment

Choose a reason for hiding this comment

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

Looks very good to me! Thank you, great to see my idiocy get fixed :) <3

nova_vm/src/engine/bytecode/executable.rs Outdated Show resolved Hide resolved
nova_vm/src/engine/bytecode/vm.rs Outdated Show resolved Hide resolved
@aapoalas aapoalas merged commit 15c8e2d into trynova:main Aug 25, 2024
1 check passed
@andreubotella andreubotella deleted the refactor-simple-object-patterns branch August 25, 2024 15:15
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