Alternative approach for assignment operators
We currently have a function that is able to handle values for binary operators (for add: https://gitlab.inria.fr/star-explain/jsexplain/blob/3cbb4acbffe0eb5912875a48c1ee8eb05257900d/jsref/JsInterpreter.ml#L3753 called from https://gitlab.inria.fr/star-explain/jsexplain/blob/3cbb4acbffe0eb5912875a48c1ee8eb05257900d/jsref/JsInterpreter.ml#L3753 and from https://gitlab.inria.fr/star-explain/jsexplain/blob/3cbb4acbffe0eb5912875a48c1ee8eb05257900d/jsref/JsInterpreter.ml#L3923, this last case for the assignment operator, https://gitlab.inria.fr/star-explain/jsexplain/blob/3cbb4acbffe0eb5912875a48c1ee8eb05257900d/jsref/JsInterpreter.ml#L4302).
To be closer to the spec, we could try to define a function literal_of_value
that create a term from a value, then call the usual binary operator function. This is easy for every value except undefined
and for objects. For objects, we could do it recursively.
This is not clear this is a nicer approach than what we currently do.