You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "matthiasblaesing (via GitHub)" <gi...@apache.org> on 2023/05/27 20:39:16 UTC
[GitHub] [netbeans] matthiasblaesing opened a new pull request, #5995: [JS] Improve resolving this in ClassElements and in arrow functions
matthiasblaesing opened a new pull request, #5995:
URL: https://github.com/apache/netbeans/pull/5995
Inside initialisation statements:
```javascript
class Test {
var1 = 123;
var2 = this.var1;
}
```
this needs to evaluate to the surrounding class, to handle this
correctly, search for the right definition of "this" needs to start
at the surrounding object, not the declaration scope of the wrapping
function.
Before:
![image](https://github.com/apache/netbeans/assets/2179736/a64c5b32-4cf2-4ab5-aa1e-4a9006ca8cc4)
After:
![image](https://github.com/apache/netbeans/assets/2179736/b3a7f85f-3c6a-4664-97ff-bea568a3f90e)
In arrow functions this is not redefined, but inherited from the outer
scope. In this sample:
```javascript
class Foo {
bar = {};
test(someArray) {
this.bar = {}; // Mark
someArray.forEach((val) => {
this.bar[val] = 1; // Mark
});
}
}
```
this in the lines with the "Mark" comment is an instance of `Foo` and
thus it is always the same bar. The this scanning needs to skip arrow
functions.
Before (notice, that only property under the cursor is highlighted):
![image](https://github.com/apache/netbeans/assets/2179736/9b074089-52bc-4721-992a-57ed9d6ab491)
After (notice, that now all occurences are marked):
![image](https://github.com/apache/netbeans/assets/2179736/5f19f847-6dae-45d6-8752-c02143913dc4)
After:
Closes: https://github.com/apache/netbeans/issues/5740
Closes: https://github.com/apache/netbeans/issues/4376
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] matthiasblaesing commented on pull request #5995: [JS] Improve resolving this in ClassElements and in arrow functions
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on PR #5995:
URL: https://github.com/apache/netbeans/pull/5995#issuecomment-1567240566
@qmegas thank you for testing this.
I plan to merge this next weekend to give people time to review.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] matthiasblaesing merged pull request #5995: [JS] Improve resolving this in ClassElements and in arrow functions
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing merged PR #5995:
URL: https://github.com/apache/netbeans/pull/5995
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] matthiasblaesing commented on pull request #5995: [JS] Improve resolving this in ClassElements and in arrow functions
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on PR #5995:
URL: https://github.com/apache/netbeans/pull/5995#issuecomment-1567239900
@qmegs thank you for testing this.
I plan to merge this next weekend to give people time to review.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] matthiasblaesing commented on pull request #5995: [JS] Improve resolving this in ClassElements and in arrow functions
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on PR #5995:
URL: https://github.com/apache/netbeans/pull/5995#issuecomment-1575644473
Hearning no objections, will merge this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists