[Webkit-unassigned] [Bug 144955] [ES6] Implement ES6 arrow function syntax. Parser of arrow function with execution as common function

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Jun 6 22:56:31 PDT 2015


https://bugs.webkit.org/show_bug.cgi?id=144955

--- Comment #48 from Saam Barati <saambarati1 at gmail.com> ---
Comment on attachment 254239
  --> https://bugs.webkit.org/attachment.cgi?id=254239
Patch

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

>> Source/JavaScriptCore/parser/Parser.cpp:2027
>> +    doParseConditionalExpression = !isArrowFunctionEmptyParamterList();
> 
> In isArrowFunctionEmptyPararmeterList, we create SavePoint. So I think the above `createSavevPoint` and SavePoint are duplicate.
> Could you change to the implementation that `isArrowFunctionEmptyParamterList` always restore the state?
> With that implementation, the above SavePoint is not necessary.

I agree with Yusuke here, the implementation should always restore the save point. It's weird
for a function that tests this to sometimes restore and sometimes not depending on if it found 
a match. You can have that function always restore the save point and then ASSERT that
the assumption is held. Also, the structuring of these two if statements is weird to me, we know
for sure one or the other will execute. I'd structure it such that if we match an empty arrow function
then we early return and then remove the doParseConditionalExpression. Like so:
if (emptyArrow) {
   ASSERT (...)
    Blah
   return ...
}

TreeExpression lhs = parseConditionalExpression(...)
...

> Source/JavaScriptCore/tests/stress/arrowfunction-syntax-error.js:9
> +  var errorSyntaxError = false;

Should we be doing something with the "statement" parameter?

> Source/JavaScriptCore/tests/stress/arrowfunction-syntax-error.js:27
> +testCase(forceRaiseException('debug(=>x+1)'), true, "Error: No exception during parse wrong statement '=>{}'");

Also add a test for this syntax error: "x, y => ..."
(And maybe other cases, I'm not super familiar with the grammar on arrow functions.)

-- 
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/20150607/505c8d0f/attachment.html>


More information about the webkit-unassigned mailing list