huajun07 / codesketcher

Visualise your code in action!
https://main.d1fr5et3wgts3j.amplifyapp.com/
MIT License
0 stars 0 forks source link

Feat/variable scope #36

Closed limanjun99 closed 1 year ago

limanjun99 commented 1 year ago

This PR implements this feature on the backend.

Implementation details can be found in the README of services/executor. (TL;DR splits variable_changes field into local_variable_changes and global_variable_changes, and adds a function_scope field).

Tested by adding testcases to executor service. Frontend can be tested here.

Note that the frontend simply merges the local_variable_changes and global_variable_changes for now, which can lead to bugs like this. This is something to keep in mind when we implement the frontend part of this feature. Screenshot 2023-06-08 at 11 24 50 PM (since a in the f1 scope is not modified in the last line, we end up with a = 2 instead of a = 1 being displayed)

limanjun99 commented 1 year ago

Pending this issue to be resolved

limanjun99 commented 1 year ago

The issue should be fixed now, details are documented in the corresponding issue.

Tested against dev environment.

Screenshot 2023-06-16 at 10 15 57 PM

Screenshot 2023-06-16 at 10 16 25 PM