[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
Fri May 15 19:48:28 PDT 2015
https://bugs.webkit.org/show_bug.cgi?id=144955
--- Comment #8 from Saam Barati <saambarati1 at gmail.com> ---
(In reply to comment #7)
> Comment on attachment 253195 [details]
> Patch
>
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=253195&action=review
>
> > Source/JavaScriptCore/parser/ASTBuilder.h:372
> > + ? m_sourceCode->subArrowExpression(info.arrowFunctionOffset, info.closeBraceOffset, info.bodyStartLine, info.bodyStartColumn)
> > + : m_sourceCode->subExpression(info.openBraceOffset, info.closeBraceOffset, info.bodyStartLine, info.bodyStartColumn);
>
> Wrong indentation. ? and : should be exactly 4 spaces to the right from the
> beginning of "SourceCode source".
>
> > Source/JavaScriptCore/parser/ASTBuilder.h:375
> > + info.body->setLoc(info.bodyStartLine, info.bodyEndLine, location.startOffset, location.lineStartOffset);
>
> Ditto. Indent the second line by exactly 4 spaces further to the right (12
> total spaces).
>
> > Source/JavaScriptCore/parser/Lexer.cpp:1824
> > + tokenData->line = savedlineNumber;
> > + tokenData->offset = savedOffset;
> > + tokenData->lineStartOffset = savedLineStartOffset;
> > +
> > + ASSERT(tokenData->offset >= tokenData->lineStartOffset);
>
> I don't think we want to shift() and then set offset back manually like this.
> We should use peek() instead.
>
> > Source/JavaScriptCore/parser/Parser.cpp:605
> > + setEndOfStatement();
>
> Why do we need this?
>
> > Source/JavaScriptCore/parser/Parser.cpp:1203
> > + context.setEndOffset(result, m_lastTokenEndPosition.offset);
>
> What is this setEndOffset for?
I believe this is for the controlFlowProfiler
>
> > Source/JavaScriptCore/parser/Parser.cpp:1260
> > + // Consume the end of arrow function ,;]) and prevent
> > + // parse this symbols by parseStatement as separate statement
>
> I don't understand this comment.
> In general, we prefer adding assertions to document conditions rather than
> adding comments.
> Is there a way to express this as an assertion instead?
>
> > Source/JavaScriptCore/parser/Parser.cpp:1341
> > +#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
> > + if (parseType == StandardFunctionParseType) {
> > + next();
> > + if (match(CLOSEBRACE)) {
> > + unsigned endColumn = tokenColumn();
> > + return context.createFunctionBody(startLocation, tokenLocation(), startColumn, endColumn, functionKeywordStart, functionNameStart, parametersStart, strictMode(), constructorKind);
> > + }
> > + }
> > +#else
>
> It's not great to duplicate the code like this.
> Since FunctionParseType is always define, we should just use that without
> wrapping in if-def.
--
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/20150516/4a943cc1/attachment.html>
More information about the webkit-unassigned
mailing list