-
Notifications
You must be signed in to change notification settings - Fork 708
Description
Describe the bug
Arising from support ticket https://support.microbit.org/helpdesk/tickets/97465 (private)
Switching to blocks mode changes the order of JavaScript functions, and modifies comments.
The original example was some code created in JavaScript mode. Here is a very similar example:
https://makecode.microbit.org/_TasfM9biJgFx
After a round trip to Blocks mode and back, without any code modification, the JavaScript functions are reordered, and the global comments are changed to block specific ones.
I tried a simpler example, creating functions a b c d e f in that order. Whether I create then in Blocks mode or JavaScript, the involvement of Blocks mode seems to enforce the JavaScript order ecfbad. The commits in these GitHub repos record the steps.
https://github.com/martinwork/test-code-order-simple/ (starting in Blocks mode)
https://github.com/martinwork/test-code-order-simple-js2/ (starting in JavaScript mode)
To Reproduce
Steps to reproduce the behavior:
- Open https://makecode.microbit.org/_TasfM9biJgFx
- Click on Blocks
- Click on JavaScript
- See error
Expected behavior
Could the order after a mode switch be based on the order before?
And comments preserved?
Screenshots
Add screenshots to help explain your problem. You can copy paste the screenshot in the github report. The .gif screen recording is very useful as well.
micro:bit version (please complete the following information):
not hardware related ]
Desktop (please complete the following information):
- OS: [e.g. iOS] Windows 11
- Browser [e.g. chrome, safari] Chrome
- Version [e.g. 22] 145