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
External scope vars used in computed method key not captured where var with same name used inside method #102
Comments
Babel bug babel/babel#12790 now fixed and fix is in latest Babel releases. |
This doesn't actually work yet due to #102.
Uncomment these tests once this is fixed: Line 368 in 3f687fe
|
This doesn't actually work yet due to #102.
This is at least partially solved after the bug fix in Babel. The example above does now serialize correctly. However, does not work for |
This may have been fixed by ebf9322. Need to check. |
These inputs are now serialized as expected: const x = 'q';
let fn;
({
[ fn = (0, () => x) ](x) {}
});
export default fn; let fn;
(function() {
({
[ fn = (0, () => [this, arguments]) ]() {}
});
}).call( 1, 2, 3, 4 );
export default fn; export default function() {
return () => ({
[ () => [this, arguments] ]() {}
});
}.call(1, 2, 3, 4); let fn;
class X {
constructor() {
({
[ fn = (0, () => super.toString) ]() {}
});
}
}
new X();
export default fn; let fn;
({
foo() {
({
[ fn = (0, () => super.toString) ]() {}
});
}
}).foo();
export default fn; Appears to be fixed. Leaving issue open as still need to write tests. |
Input:
Serialized output:
The external scope var
x
with value'q'
has not been captured, so this serialized output will throw an error when run.This is at least partly due to bug in Babel babel/babel#12790 but may also require a fix in Livepack's Babel plugin to correctly track what function the visitor is currently in while processing computed method keys.
The text was updated successfully, but these errors were encountered: