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

Prototype with intermediary not converted to class #358

Open
github-nilsson opened this issue Apr 30, 2024 · 1 comment
Open

Prototype with intermediary not converted to class #358

github-nilsson opened this issue Apr 30, 2024 · 1 comment

Comments

@github-nilsson
Copy link

function A() {}
A.prototype.func = A_func;
function A_func() { return 5; }

confuses lebab and produces

1:  warning  Function A looks like class, but has no prototype  (class)
3:  warning  Function A_func looks like class, but has no prototype  (class)
function A() {}
A.prototype.func = A_func;
function A_func() { return 5; }

instead of the expected

class A {
  func() { return 5; }
}
@nene
Copy link
Collaborator

nene commented May 3, 2024

Yeah, this code is a more tricky case to transform, e.g. one would need to check that A_func is not referenced anywhere else in the code.

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

No branches or pull requests

2 participants