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

JS: Highlighting of supposed classes and/or functions? #1471

Closed
RunDevelopment opened this issue Jul 9, 2018 · 0 comments · Fixed by #1482
Closed

JS: Highlighting of supposed classes and/or functions? #1471

RunDevelopment opened this issue Jul 9, 2018 · 0 comments · Fixed by #1482

Comments

@RunDevelopment
Copy link
Member

RunDevelopment commented Jul 9, 2018

When reading JS code, you sometimes come across a line like this:

Foo.prototype.foobar = function() { ... };
Bar.constructor.apply();
foo.bind(this);
bar.apply(...);

We then use our common knowledge of JS and assume that Foo is a class because its prototype field was used to add the function foobar . Similar for Bar, foo and bar.

Generally: Can't we assume that the word left from prototype or constructor is a class and that the word to the right of prototype or the left of either apply, bind or call is a function?

Of course, this will cause false positives, but it will only do so on very few occasions.

mAAdhaTTah pushed a commit that referenced this issue Aug 19, 2018
Fixes #1471.

It also extends function-variable to include object properties.

e.g.

```js
{foo: function() {}}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants