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 methods are returned as anonymous functions #7

Closed
PhaserEditor2D opened this issue Dec 1, 2015 · 7 comments
Closed

Prototype methods are returned as anonymous functions #7

PhaserEditor2D opened this issue Dec 1, 2015 · 7 comments

Comments

@PhaserEditor2D
Copy link

Given this code:

function Juan() {
}
Juan.prototype = Object.create(Window.prototype);
Juan.prototype.constructor = Juan;  
Juan.prototype.hello = function () {
};

function Maria() {
}
Maria.prototype = Object.create(Juan.prototype);
Maria.prototype.constructor = Maria;  
Maria.prototype.hola = function () {
};

The tern outline plugin shows this tree (taken from Tern IDE):

image

I think it is not recognizing the prototype methods, for example in JSDT we get a better result:

image

@angelozerr
Copy link
Owner

Thanks for reporting this issue. I will try to fix when I will find time.

angelozerr added a commit to angelozerr/tern.java that referenced this issue Dec 3, 2015
@angelozerr
Copy link
Owner

@boniatillo-com I have fixed this issue, but I use type to do that.

Here a screenshot with your sample, where Windows doesn't exists:

juan1

If you fix it, here the result:

juan2

Hope you will like it.

@PhaserEditor2D
Copy link
Author

Very nice @angelozerr here my screenshot with the fixes.

image

@angelozerr
Copy link
Owner

Cool:) An other advantage to format outline on the server side is that other editor (which ar enot written in Java) can benefit with those kind of fix.

@PhaserEditor2D
Copy link
Author

Well, a local var is "breaking" it :(

Look this example:

function A() {

}

A.prototype = Object.create(null);
A.prototype.constructor = A;
A.prototype.hello = function () {
    var j = 0;
};

The result is:

image

The j var is out.

Cool:) An other advantage to format outline on the server side is that other editor (which ar enot
written in Java) can benefit with those kind of fix.

Agree.

angelozerr added a commit that referenced this issue Dec 4, 2015
angelozerr added a commit to angelozerr/tern.java that referenced this issue Dec 4, 2015
@angelozerr
Copy link
Owner

@boniatillo-com I have fixed the problem:

a

And it was a bad idea to use type, so I have changed and it shoud work, even if type is not good (your sample with Window.prototype).

@PhaserEditor2D
Copy link
Author

Good, now it works much better.

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