[Webkit-unassigned] [Bug 168684] [JSC] It should be possible create a label named let when parsing Statement in non strict mode

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Mar 12 11:45:49 PDT 2017


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

Saam Barati <sbarati at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #304118|review?                     |review+
              Flags|                            |

--- Comment #13 from Saam Barati <sbarati at apple.com> ---
Comment on attachment 304118
  --> https://bugs.webkit.org/attachment.cgi?id=304118
Patch

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

r=me with comments

> Source/JavaScriptCore/parser/Parser.cpp:1729
> +    case LET: {
> +        if (!strictMode()) {
> +            bool allowFunctionDeclarationAsStatement = false;
> +            result = parseExpressionOrLabelStatement(context, allowFunctionDeclarationAsStatement);
> +            shouldSetPauseLocation = !context.shouldSkipPauseLocation(result);
> +            break;
> +        }
> +        goto defaultCase;
> +    }

This is duplicate code with he IDENT/AWAIT/YIELD case below. Maybe add a goto to that case, or make a lambda that is called both here and there.

> LayoutTests/js/script-tests/let-syntax.js:56
> +function shouldNotHaveSyntaxErrorSloopyOnly(str)

Typo: "Sloopy" => "Sloppy"

> LayoutTests/js/script-tests/let-syntax.js:96
> +shouldNotHaveSyntaxErrorSloopyOnly("let x; with ({}) let: y = 3;");

Can you also add a test where you omit the ":" after the label. Something like:

"let x; with ({}) let y = 3;"

And it should be a syntax error in sloppy mode.

-- 
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/20170312/9f1a95f2/attachment.html>


More information about the webkit-unassigned mailing list