<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [ES6] Implement ES6 arrow function syntax. Parser of arrow function with execution as common function"
href="https://bugs.webkit.org/show_bug.cgi?id=144955#c8">Comment # 8</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [ES6] Implement ES6 arrow function syntax. Parser of arrow function with execution as common function"
href="https://bugs.webkit.org/show_bug.cgi?id=144955">bug 144955</a>
from <span class="vcard"><a class="email" href="mailto:saambarati1@gmail.com" title="Saam Barati <saambarati1@gmail.com>"> <span class="fn">Saam Barati</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=144955#c7">comment #7</a>)
<span class="quote">> Comment on <span class=""><a href="attachment.cgi?id=253195&action=diff" name="attach_253195" title="Patch">attachment 253195</a> <a href="attachment.cgi?id=253195&action=edit" title="Patch">[details]</a></span>
> Patch
>
> View in context:
> <a href="https://bugs.webkit.org/attachment.cgi?id=253195&action=review">https://bugs.webkit.org/attachment.cgi?id=253195&action=review</a>
>
> > 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?</span >
I believe this is for the controlFlowProfiler
<span class="quote">>
> > 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.</span ></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>