source-academy / js-slang

Implementations of sublanguages of JavaScript, TypeScript, Scheme and Python
https://source-academy.github.io/source/
Apache License 2.0
70 stars 104 forks source link

Stepper: Incorrect evaluation sequence in Program #1562

Closed hanscau closed 8 months ago

hanscau commented 8 months ago

From the specs:

  1. The first value is kept if the following statements are reducible.
  2. The first value is reduced if the second statement is also a value.
image

However, the current implementation does not mirror this behaviour

image

(Notice how "1;" is being evaluated even though it is a value and the second statement is a constant declaration and thus is reducible)