maekawatoshiki / rapidus

ECMAScript implementation in Rust
MIT License
519 stars 21 forks source link

improper pop_env in try clause. #37

Closed sisshiki1969 closed 5 years ago

sisshiki1969 commented 5 years ago
let a = 100
try {
  let a = 0
  throw a
} catch (e) {
  console.log(e)   //should be 0, 100 in new-gen rapidus.
}
sisshiki1969 commented 5 years ago
0000 PushInt8 100             
0002 SetValue 'a'             
0007 PushEnv '["a"]'          
000c PushInt8 0               
000e SetValue 'a'             
0013 PopEnv      <- the position of PopEnv may be improper.                  
0014 GetValue 'a'             
0019 Throw
001a PopEnv        
001b JmpSub 004f
0020 JmpSub 0050
maekawatoshiki commented 5 years ago

Appreciate your issue.