[Webkit-unassigned] [Bug 172031] [ESnext] Parsing Object Rest Destructuring isn't handle errors cases properly

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun May 14 11:48:19 PDT 2017


--- Comment #1 from Caio Lima <ticaiolima at gmail.com> ---
After code analysis I realized that when destructuring is being parsed with rest element, i.e, we find a "...", then we call parseBindingOrAssignmentElement (https://github.com/caiolima/webkit/blob/master/Source/JavaScriptCore/parser/Parser.cpp#L985) and then check if innerPattern is null. Looking into parseBindingOrAssignmentElement (https://github.com/caiolima/webkit/blob/master/Source/JavaScriptCore/parser/Parser.cpp#L903) we have 2 cases:

1) kind == DestructuringKind::DestructureToExpressions
In that case, we goes to parseAssignmentElement with can return a null inner pattern.

2) kind != DestructuringKind::DestructureToExpressions
In that case, the parser falls to parseDestructuringPattern and it only return 0 if kind == DestructuringKind::DestructureToExpressions with will never be the case in that.

It means that this check in https://github.com/caiolima/webkit/blob/master/Source/JavaScriptCore/parser/Parser.cpp#L986 has redundant kind check, since innerPattern only can be true if and only if kind == DestructuringKind::DestructureToExpressions.

I'm going to send a Patch ro remove that, because the code right now looks buggy with kind check.

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

More information about the webkit-unassigned mailing list