UnrealScript-Language-Service icon indicating copy to clipboard operation
UnrealScript-Language-Service copied to clipboard

[Bug 0.6.3]: Expression does not evaluate to an iteratable

Open Shtoyan opened this issue 1 year ago • 2 comments

Describe the bug

I saw this error accidentally, don't know how to reliably reproduce it. Fixes when you add curly brackets.

Screenshots

image

Shtoyan avatar Feb 10 '23 19:02 Shtoyan

Yeah, basically the parser picks this expression up as a binary expression.

UnrealScript has this odd feature where you can define a new binary operator with an [a-z] identifier, like for instance the Dot operator.

So, the parser sees this as follows:

forEachStatement > ExpressionStatement > BinaryExpression (left: DynamicActors(), operator: AddPRI, right: (PRI) as a ParenthesizedExpression)

EliotVU avatar Feb 12 '23 09:02 EliotVU

A proper fix would be to delay the parsing of function blocks entirely until all related documents have been indexed. Once indexed, all the functions can be re-parsed with the knowledge of indexed binary operators, so that a non-binary identifier cannot be mistaken for one. (this is how the actual compiler works).

EliotVU avatar Feb 12 '23 09:02 EliotVU