Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor function literal tests for parsers #1404

Merged
merged 2 commits into from
Feb 5, 2018

Conversation

jugglinmike
Copy link
Contributor

A number of tests for the parsing of function literals were expressed
using eval. This made the tests more complex than necessary and also
prevented the tests from providing value to ECMAScript parsers.

Remove the use of eval in the relevant tests and instead express the
expectations with literal source text.


While writing this patch, I re-discovered a potential conflict between
implementations and the specification text. I filed a patch to the spec here:
tc39/ecma262#1091

I've tried to limit this patch to refactoring and avoid changing test behavior.
Since the issue referenced above is a long-standing one and unrelated to the
intent of this patch, I'd like to address that separately (pending the
resolution of the ECMA-262 issue).

This is in service of gh-1356

A number of tests for the parsing of function literals were expressed
using `eval`. This made the tests more complex than necessary and also
prevented the tests from providing value to ECMAScript parsers.

Remove the use of `eval` in the relevant tests and instead express the
expectations with literal source text.

throw "Test262: This statement should not be evaluated.";

function __func(){# ABC}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol

eval("function\u0009\u2029w(\u000C)\u00A0{\u000D};");
// The following function expression is expressed with literal unicode
// characters so that parsers may benefit from this test. The included code
// points are as follows:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for adding this comment.

@leobalter leobalter merged commit 31dfa87 into tc39:master Feb 5, 2018
jugglinmike added a commit to jugglinmike/ecma262 that referenced this pull request Mar 29, 2018
In the March 2018 meeting of TC39, the committee elected to extend the
definition of "function code" to include the BindingIdentifier of the
productions where a BindingIdentifier is present. This decision was
motivated by a desire to match implementation reality.

This alteration does not require a change to Test262 because like the
majority of modern implementations, Test262 already enforces the new
behavior [1].

[1] tc39/test262#1404
jugglinmike added a commit to jugglinmike/ecma262 that referenced this pull request May 18, 2019
In the March 2018 meeting of TC39, the committee elected to extend the
definition of "function code" to include the BindingIdentifier of the
productions where a BindingIdentifier is present. This decision was
motivated by a desire to match implementation reality.

This alteration does not require a change to Test262 because like the
majority of modern implementations, Test262 already enforces the new
behavior [1].

[1] tc39/test262#1404
ljharb pushed a commit to jugglinmike/ecma262 that referenced this pull request Jun 19, 2019
In the March 2018 meeting of TC39, the committee elected to extend the
definition of "function code" to include the BindingIdentifier of the
productions where a BindingIdentifier is present. This decision was
motivated by a desire to match implementation reality.

This alteration does not require a change to Test262 because like the
majority of modern implementations, Test262 already enforces the new
behavior [1].

[1] tc39/test262#1404
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants