NeilFraser / JS-Interpreter

A sandboxed JavaScript interpreter in JavaScript.
Apache License 2.0
1.96k stars 352 forks source link

Fix matchToPresdo for match groups #264

Closed ayahito-saji closed 4 months ago

ayahito-saji commented 4 months ago

Thank you for the quick bug fix the other day.

We have now confirmed that the error occurs with the following code:

alert(new RegExp("(?<a>b)", "g").exec("b").groups.a);
Uncaught TypeError: Expecting native value or pseudo object
    at Interpreter.getProperty (interpreter.js:2717:11)
    at Interpreter.stepMemberExpression (interpreter.js:4436:22)
    at Interpreter.step (interpreter.js:421:53)
    at Interpreter.run (interpreter.js:466:32)
    at runButton (JS-Interpreter/:55:25)

The problem was that the groups was not converted to a pseudo object, so I fixed it. Best regards.