rokucommunity / brighterscript

A superset of Roku's BrightScript language
MIT License
152 stars 47 forks source link

Adds AugmentedAssignmentStatement #1196

Closed markwpearce closed 1 month ago

markwpearce commented 1 month ago

code like this:

sub foo(t)
   t += 1
end sub

used to be an assignment statement, with a binary Expression... eg:

Assignment (t, '=') -> 
     BinaryExpression (t, '+=', 1)

which included "t" twice

This is changed to a single AugmentedAssignmentStatement

AugmentedAssignment (t, '+=', 1)

Additionally, this PR makes sure the parser only builds Assignments (including typed Assignments) when it is allowed to.

I also added tests for AugmentedAssignmentStatement and IncrementStatement

Addresses #1186