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

Can not convert Private Fields #29

Open
azu opened this issue May 5, 2022 · 1 comment
Open

Can not convert Private Fields #29

azu opened this issue May 5, 2022 · 1 comment
Labels
Type: Bug Bug or Bug fixes

Comments

@azu
Copy link
Owner

azu commented May 5, 2022

class PrivateExampleClass {
    #privateField = 42;
    dump() {
        console.log(this.#privateField); // => 42
    }
}

When conver the above code, and get an error

Private name #privateField is not defined. (1:24)
@azu azu added the Type: Bug Bug or Bug fixes label May 5, 2022
@azu
Copy link
Owner Author

azu commented May 5, 2022

Error is occurred on

try {
const result = transformSync(code, {
plugins: [babelPluginEspower],
filename: options.filePath,
sourceFileName: options.filePath,
ast: true,
code: true,
configFile: false,
babelrc: false,
sourceType: "module"
});
if (!result) {
throw new Error("Fail to convert espower in power-doctest");
}
return result.ast;
} catch (error) {
// TODO: workaround https://github.com/azu/power-doctest/issues/29
if (process.env.DEBUG) {
console.error("espower error", error);
console.log(code);
console.log(AST);
}
return AST;

I've add a try-catch as a workaround #30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug or Bug fixes
Projects
None yet
Development

No branches or pull requests

1 participant