[Webkit-unassigned] [Bug 145132] [ES6] Arrow function syntax. Arrow function specific features. Lexical bind "arguments"

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jan 19 15:02:01 PST 2016


--- Comment #55 from GSkachkov <gskachkov at gmail.com> ---
Comment on attachment 268326
  --> https://bugs.webkit.org/attachment.cgi?id=268326

View in context: https://bugs.webkit.org/attachment.cgi?id=268326&action=review

>> Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:4123
>> +RegisterID* BytecodeGenerator::emitPutArgumentsToArrowFunctionContextBlockScope()
> I see what you're going for here in this function, but this seems a bit hacky to me.
> I think there might be an alternate solution that might be cleaner:
> We currently don't allow functions to declare the variable named "arguments"
> as being captured (you can see this in the "collectFreeVariables" function inside Parser.h).
> But, in the case of an arrow function, we really do want "arguments" to act like a captured variable.
> If we teach the parser we can really capture "arguments", then we could probably do away
> with a lot of this specialized code. We wouldn't need this function (because "arguments" would already
> be in whatever environment is represented by scopeRegister()). We probably wouldn't need a specialized
> argumentsLocalPrivateName either. We would need some BytecodeGenerator code just to teach it
> that we don't have a local "arguments" that we created, but that's about it. I think most of this change
> could be a parser change.
> You would basically have to teach the parser that any arrow function implicitly captures the name "arguments".
> Or we could be smart about it, and only capture "arguments" if we use "arguments" or "eval" inside the
> arrow function.

Fixed. Oh I did not know about this collectFreeVariables. This approach is much better because allow to decrease amount of code

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160119/77387723/attachment.html>

More information about the webkit-unassigned mailing list