Placeholder variable not recognised as object instance (PyCharm JS internal code quality linter)

Settings: EcmaScript 5.1, non-strict

So I have an object:

device = {
........

emptyStr: function emptyStr(val, isSelector) {
if (isSelector) val = $(val).val();
return (val == undefined || val == null) ? "" : val;
},

copyStatus: function () {
var self = this;
var e = function (val) { return self.emptyStr('#' + val, true); }; // <-- unresolved function or method emptyStr()
.........

If I replace "self" with "this", the function is easily recognised, but the code being as it is, the recognition fails, presumably because self could be modified somewhere further along the copyStatus function.

How can I instruct the linter to "recognise" "self" as actually being "this"?

0
2 comments

I'm really sorry, it's not only similar to 28015, it's even the same! I just forgot about that original posting and google also could not find it for me when I tried to get around to it again the other day. Please close this issue, let's continue there.

1

Looks similar to https://youtrack.jetbrains.com/issue/WEB-28015, but I have been unable to recreate it:

Please try invalidating caches (File | Invalidate caches, Invalidate and restart) - does the issue persist?

0

Please sign in to leave a comment.