<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#c12">Comment # 12</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:gskachkov@gmail.com" title="GSkachkov <gskachkov@gmail.com>"> <span class="fn">GSkachkov</span></a>
</span></b>
<pre>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>
<span class="quote">>>> Source/JavaScriptCore/parser/ASTBuilder.h:372
>>> + : 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".
>
> I believe this is for the controlFlowProfiler</span >
Fixed. Please check if correct.
<span class="quote">>> 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).</span >
Why do we need indent for 'info.body->setLoc()' statement?
<span class="quote">>> Source/JavaScriptCore/parser/Lexer.cpp:1824
>> + 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.</span >
Done
<span class="quote">>> Source/JavaScriptCore/parser/Parser.cpp:605
>> + setEndOfStatement();
>
> Why do we need this?</span >
Ohh, it will be difficult to explain with my English, but I'll try.
I need invoke this function to set correctly position inside of the lexer. It is added by me in Source/JavaScriptCore/parser/Lexer.cpp line 1723 and repeat the same statement as do for '}' in lexer <a href="https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/parser/Lexer.cpp#L1990">https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/parser/Lexer.cpp#L1990</a>.
It is necessary because incase of arrow function with expression (var f = x=> x+1;) symbols ';', ']', '}', ')', and ',' has two meaning first it is end of statement and second end of arrow function body. I haven't found way move this logic to lexer because only parser knowing context when it is only end of statement or end of arrow function body as well.
<span class="quote">>>> Source/JavaScriptCore/parser/Parser.cpp:1203
>>> + context.setEndOffset(result, m_lastTokenEndPosition.offset);
>>
>> What is this setEndOffset for?
>
> Actually, this is wrong. How does this code not segfault?
> setEndOffset is meant to be called with non-null AST nodes</span >
Hmm, I run this method to set correct ending of the block for arrow function with expression for instance var f = x => x + 10;
Where ';' is used as end of the statement var f...; and end of arrow function x=>x+10;
For the same purpose as in this method <a href="https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/parser/Parser.cpp#L1426">https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/parser/Parser.cpp#L1426</a>
<span class="quote">>> Source/JavaScriptCore/parser/Parser.cpp:2852
>> + while (newCount--)
>
> This should be tested.</span >
I've removed this code.</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>