Changeset 207569 in webkit


Ignore:
Timestamp:
Oct 19, 2016 2:27:51 PM (8 years ago)
Author:
caitp@igalia.com
Message:

[JSC] forbid "use strict" directive in generator functions with non-simple parameters
https://bugs.webkit.org/show_bug.cgi?id=163683

Reviewed by Geoffrey Garen.

JSTests:

Update various generator*-non-simple-param.js tests to be passing.

  • test262.yaml:

Source/JavaScriptCore:

Because generator functions and async functions both have an implicit
inner function whose arguments are inherited from its parent, "use strict"
directives within these functions did not yield a SyntaxError.

Now, the correct syntax error is reported, fixing several test262 failures
for generators and async functions.

  • parser/Parser.cpp:

(JSC::Parser<LexerType>::parseFunctionInfo):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r207518 r207569  
     12016-10-19  Caitlin Potter  <caitp@igalia.com>
     2
     3        [JSC] forbid "use strict" directive in generator functions with non-simple parameters
     4        https://bugs.webkit.org/show_bug.cgi?id=163683
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Update various generator*-non-simple-param.js tests to be passing.
     9
     10        * test262.yaml:
     11
    1122016-10-18  Mark Lam  <mark.lam@apple.com>
    213
  • trunk/JSTests/test262.yaml

    r207461 r207569  
    6308963089  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    6309063090- path: test262/test/language/expressions/generators/use-strict-with-non-simple-param.js
    63091   cmd: runTest262 :fail, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
     63091  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
    6309263092- path: test262/test/language/expressions/generators/use-strict-with-non-simple-param.js
    63093   cmd: runTest262 :fail, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
     63093  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    6309463094- path: test262/test/language/expressions/generators/yield-as-binding-identifier.js
    6309563095  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
     
    6655166551  cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
    6655266552- path: test262/test/language/expressions/object/method-definition/generator-use-strict-with-non-simple-param.js
    66553   cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
     66553  cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
    6655466554- path: test262/test/language/expressions/object/method-definition/generator-use-strict-with-non-simple-param.js
    66555   cmd: runTest262 :fail, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
     66555  cmd: runTest262 :normal, "SyntaxError", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], [:strict]
    6655666556- path: test262/test/language/expressions/object/method-definition/name-invoke-ctor.js
    6655766557  cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
     
    8424584245  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    8424684246- path: test262/test/language/statements/generators/use-strict-with-non-simple-param.js
    84247   cmd: runTest262 :fail, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
     84247  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
    8424884248- path: test262/test/language/statements/generators/use-strict-with-non-simple-param.js
    84249   cmd: runTest262 :fail, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
     84249  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    8425084250- path: test262/test/language/statements/generators/yield-as-binding-identifier.js
    8425184251  cmd: runTest262 :normal, "SyntaxError", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
  • trunk/Source/JavaScriptCore/ChangeLog

    r207568 r207569  
     12016-10-19  Caitlin Potter  <caitp@igalia.com>
     2
     3        [JSC] forbid "use strict" directive in generator functions with non-simple parameters
     4        https://bugs.webkit.org/show_bug.cgi?id=163683
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Because generator functions and async functions both have an implicit
     9        inner function whose arguments are inherited from its parent, "use strict"
     10        directives within these functions did not yield a SyntaxError.
     11
     12        Now, the correct syntax error is reported, fixing several test262 failures
     13        for generators and async functions.
     14
     15        * parser/Parser.cpp:
     16        (JSC::Parser<LexerType>::parseFunctionInfo):
     17
    1182016-10-19  Ryan Haddad  <ryanhaddad@apple.com>
    219
  • trunk/Source/JavaScriptCore/parser/Parser.cpp

    r207312 r207569  
    23542354        generatorBodyScope->setExpectedSuperBinding(expectedSuperBinding);
    23552355
     2356        // Disallow 'use strict' directives in the implicit inner function if
     2357        // needed.
     2358        if (functionScope->hasNonSimpleParameterList())
     2359            generatorBodyScope->setHasNonSimpleParameterList();
     2360
    23562361        functionInfo.body = performParsingFunctionBody();
    23572362
Note: See TracChangeset for help on using the changeset viewer.