rokucommunity / brighterscript

A superset of Roku's BrightScript language
MIT License
162 stars 46 forks source link

Runtime crash in Parser #332

Closed chrisdp closed 2 years ago

chrisdp commented 3 years ago
[01:25:21 PM] Parsing files
[01:25:21 PM] Validating project
[01:25:21 PM] Found 1 error
TypeError: Cannot read property '0' of undefined
    at mapNode (/Users/chris/.vscode/extensions/rokucommunity.brightscript-2.17.1/node_modules/brighterscript/dist/parser/SGParser.js:171:36)
    at /Users/chris/.vscode/extensions/rokucommunity.brightscript-2.17.1/node_modules/brighterscript/dist/parser/SGParser.js:219:85
    at Array.map (<anonymous>)
    at mapNodes (/Users/chris/.vscode/extensions/rokucommunity.brightscript-2.17.1/node_modules/brighterscript/dist/parser/SGParser.js:219:70)
    at mapElement (/Users/chris/.vscode/extensions/rokucommunity.brightscript-2.17.1/node_modules/brighterscript/dist/parser/SGParser.js:159:37)
    at mapElements (/Users/chris/.vscode/extensions/rokucommunity.brightscript-2.17.1/node_modules/brighterscript/dist/parser/SGParser.js:200:31)
    at mapElement (/Users/chris/.vscode/extensions/rokucommunity.brightscript-2.17.1/node_modules/brighterscript/dist/parser/SGParser.js:137:38)
    at buildAST (/Users/chris/.vscode/extensions/rokucommunity.brightscript-2.17.1/node_modules/brighterscript/dist/parser/SGParser.js:112:16)
    at SGParser.parse (/Users/chris/.vscode/extensions/rokucommunity.brightscript-2.17.1/node_modules/brighterscript/dist/parser/SGParser.js:79:34)
    at XmlFile.parse (/Users/chris/.vscode/extensions/rokucommunity.brightscript-2.17.1/node_modules/brighterscript/dist/files/XmlFile.js:132:21)
[Error - 1:34:07 PM] Request textDocument/completion failed.
  Message: Request textDocument/completion failed with message: Cannot read property 'kind' of undefined
  Code: -32603 
[Error - 1:34:13 PM] [object Object]

I was typing an import at the time of doing this but I wasn't able to narrow it down as to a root cause.

TwitchBronBron commented 3 years ago

That's right here in the code: image

This isn't obvious what the problem is, so could you try to get more accurate reproducible steps?

elsassph commented 3 years ago

That's a valid error, we need to test that the tag has a name. Incomplete tags can happen.

chrisdp commented 3 years ago

@elsassph can you give some more info. I'm not sure I understand what needs to be done.

elsassph commented 3 years ago

Completely forgot about this one. Code should check the tag has a name and otherwise default to an empty name.

elsassph commented 3 years ago

@chrisdp do you have a reproductible scenario? I just can't make it happen.

TwitchBronBron commented 2 years ago

@elsassph @chrisdp is this still an issue?

chrisdp commented 2 years ago

Likely not anymore.