On Fri Jun 16 13:03:45 2023 +0000, Jacek Caban wrote:
I also made use of the scope's dispex now instead of allocating the
default variable object, because we're already using it, and there's no reason to have *two* objects just for some couple extra props like `arguments` or the function's name in ES5, which feels too much like a waste. We shouldn't need variable object for function name. `identifier_eval` already has handing for that, I would suggest to make it work for detached scope (probably by storing function instance in the buffer) and remove its setting from `detach_scope`. It even uses `EXPRVAL_JSVAL`, so there is no problem with addressing that. arguments object is similar: we already special-case it in `identifier_eval`. We could probably just reserve the first or last slot of scope indexes. Also, I would suggest introducing a helper like `dispex_get_idx_dispid` that would return DISPID for given index.
What about functions in inner scopes exposed back to the base scope? (the last jsdisp_propput_name in detach_scope). Won't we still need variable obj for them, since they can be names not found in the base scope's locals at all?
And if we still need it then I think special casing those two isn't worth it. Unless you have an idea how to handle it in acceptable way?