You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Request: {
"files": [
{
"type": "full",
"name": "test.js",
"text": "function f(){};try{}catch{f=function(){}}"
}
]
}
Response: {}
/Users/idc/idk/node_modules/tern/lib/infer.js:1444
var inner = node.scope, fn = inner.fnType;
^
TypeError: Cannot read properties of undefined (reading 'fnType')
at /Users/idc/idk/node_modules/tern/lib/infer.js:1444:42
at /Users/idc/idk/node_modules/tern/lib/infer.js:1384:15
at infer (/Users/idc/idk/node_modules/tern/lib/infer.js:1653:22)
at /Users/idc/idk/node_modules/tern/lib/infer.js:1501:15
at /Users/idc/idk/node_modules/tern/lib/infer.js:1384:15
at infer (/Users/idc/idk/node_modules/tern/lib/infer.js:1653:22)
at Object.Expression (/Users/idc/idk/node_modules/tern/lib/infer.js:1662:7)
at c (/Users/idc/idk/node_modules/acorn-walk/dist/walk.js:58:37)
at base.ExpressionStatement.base.ParenthesizedExpression (/Users/idc/idk/node_modules/acorn-walk/dist/walk.js:204:37)
at c (/Users/idc/idk/node_modules/acorn-walk/dist/walk.js:58:37)
I've tried the following snippets too:
functionf(){};try{}catch{f=function(){}}// errorfunctionf(){}try{f=function(){}}catch{}// okfunctionf(){}if(1){f=function(){}}// okfunctionf(){}{f=function(){}}// ok
For what it's worth, I'm trying to use tern to parse minified browser JS files, and have a programmatic interface for LSP-like behaviour (go-to-definition / go-to-reference). I'm not sure if there are better suited tools out there, so this could just be me having xy problems. (I guess I'm just looking for a scope analyser.)
I'm not sure if I'm supposed to load a plugin or configure tern differently? I've skimmed and tried a few of the bundled plugins and browsed plugins available on GitHub, but they seem to mostly be for local development.
Edit:
I realise this may be a syntax thing.
functionf(){};try{}catch(){f=function(){}}
(parentheses after catch) works fine. Apparently, catch binding is optional is ES2019.
The text was updated successfully, but these errors were encountered:
I've been testing tern on some minified files, but tern doesn't like the following code. I've been banging my head on this for a while to no avail.
curl localhost:52433 -d '{"files":[{"type":"full","name":"test.js","text":"function f(){};try{}catch{f=function(){}}"}]}'
Output:
I've tried the following snippets too:
I've also tried this:
Same error.
For what it's worth, I'm trying to use tern to parse minified browser JS files, and have a programmatic interface for LSP-like behaviour (go-to-definition / go-to-reference).
I'm not sure if there are better suited tools out there, so this could just be me having xy problems.(I guess I'm just looking for a scope analyser.)I'm not sure if I'm supposed to load a plugin or configure tern differently? I've skimmed and tried a few of the bundled plugins and browsed plugins available on GitHub, but they seem to mostly be for local development.
Edit:
I realise this may be a syntax thing.
(parentheses after
catch
) works fine. Apparently, catch binding is optional is ES2019.The text was updated successfully, but these errors were encountered: