vassilych / cscs

CSCS: Customized Scripting in C#
MIT License
166 stars 47 forks source link

Weirdness and parser errors when using array elements as function args #2

Closed AndreNeedham closed 7 years ago

AndreNeedham commented 7 years ago

Run the following script: set(a(0),3); set(a(1),2); print(pow(a(0),a(1))); print(a(0)): print(a(1));

Expect output to be: 9 3 2

Actual result: 9 3

(what happened to the 2?)

Another example actually runs into a parser error (which is how I found this bug). Run this script: set(a(0),3); set(a(1),2); print(pow(a(0),a(1))); while(1==1) { print(a(0)): print(a(1)); }

Expect: some kind of infinite loop but whatever. Actual: parser error: "Couldn't parse token [}]" I worked around this in my script by setting two variables x and y to a(0) and a(1). That works fine.

AndreNeedham commented 7 years ago

Closed this because I see the GitHub code is quite different from your original code from MSDN, and this bug doesn't exist.