navinsubramani / LabVIEW-Script-Language

Developing a platform to develop scripts, compile and execute it in the LabVIEW development or run time environment
MIT License
8 stars 2 forks source link

While loop indentation problem #7

Closed pranay001 closed 5 years ago

pranay001 commented 5 years ago

Scenario: consider the while loop code as shown below.

a=0 while(a<10) ->a=a+1 ->print(a)

Reason: the a<10 in while loop will be validated only during Run init core., but it has to executed each time during the loop executes.

So did a similar implementation as Run init core inside Run pre core, and It works well. except for the scenario shown above. because a=a+1 cannot access "a" value which is inside while loop.(due to one intend back)

navinsubramani commented 5 years ago

This is a good use case. Now the variable has to be read every time during the while loop run. I would suggest calling the 'Run Init Core' in 'Run Pre Core' instead of redoing the logic.

a should be accessible inside the one indent since the lifetime of a is for indents >= 0

pranay001 commented 5 years ago

Thanks, Navin. It looks like with the updates done by you it is working as expected. I have also committed the code.

pranay001 commented 5 years ago

While loop indentation issue is resolved now