[FunctionSearch] Variables not listed in 'variables' list

The following variables should've been listed as variables
- fn1
- noDeclaredString
- nonDeclaredVariable
- someMember
@jasonLaster @wldcordeiro - I've figured out what needs to be done, just need someone's confirmation if this bug holds true
I think those are technically syntax errors? They're undeclared so I don't think it makes sense to include them in the lists.
Doesn't JS allow undeclared variables (I know its a bad practice, throws error in use strict) ? I know we shouldn't support use of that, but... isnt' it theoretically a variable 😄
and someMember ?
someMember is part of an undeclared variable so it's by association there. I'm not sure what the best opinion here is since JS does create those variables on the global scope.
I was thinking that our main concern might be that developers want to search for these variables despite them being syntactically incorrect. This could actually be a good path for people searching for errors.
Based on @clarkbw comment, I wonder if we could do something like below - highlight incorrectly created variables.

Thanks @ruturajv , this is an interesting problem.
I think we're limited by what babel offers. If it's in the AST we can do it...
If not, we can always offer a link at the bottom of search results to search the text: "10 matches in file"...
noDeclaredString = "howdy!";
var declaredString = "abc";
let letString = "abc";
for the above, the first line comes as ExpressionStatement and the next two lines are VariableDeclaration in AST
hmm - do we show ExpressionStatement in the variables list? I'd be okay doing that if we're in an assignment expression
Hey @ruturajv,
-
it looks like functions are picked up here
-
I worry we'll pick up every variable assignment which will lead to a lot of duplication:
-
we'll miss global variables assigned this way, but that's probably okay for now. Given we'll have a simpler system for the time being.
let a = 2;
a = 3;
a = 4;