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

Failed to conform to ES5.1, Section 10.2.1.1.3 SetMutableBinding (N,V,S), Step 4 #59

Open
daejunpark opened this issue Apr 7, 2015 · 2 comments

Comments

@daejunpark
Copy link

It seems to me that S5 does not conform to ES5.1, Section 10.2.1.1.3 SetMutableBinding (N,V,S), Step 4, if-condition is true.

For the following test program:

// 10.2.1.1.3 SetMutableBinding (N,V,S), Step 4, if-condition is true

// 4. Else this must be an attempt to change the value of an immutable binding so if S if true throw a TypeError exception.

// In a strict mode, assigning an immutable binding throws TypeError.

// There are only two ways to create an immutable binding:
//   1. 'arguments' is an immutable binding in a strict mode function.
//   2. name of a recursive function expression (it should be a function 'expression', not a function 'declaration') is an immutable binding of the function body's environment.
// In the first case, assigning such binding raises a syntax error, in advance, in a strict mode code, thus it cannot reach here.
// Thus, assigning the second kind of binding is the only case that can reach here, and the below example represents this case.

// In the example below, 'g' is a name of recursive function expression, thus inside the function body, 'g' is a immutable binding.
// Note that 'g' is not visible outside of the function body, that is, it is not visible in a global scope.

"use strict";
var f = function g() {
  g = 0;
};
try {
  f(); // TypeError
  throw "Not here!";
} catch (e) {
  if (!(e instanceof TypeError)) {
    $ERROR('"use strict"; var f = function g() { g = 0; }; f(); throws TypeError. Actual: ' + e);
  }
}

S5 throws an exception, while it should have succeeded:

$ ./s5-test262 /tmp/09.js 
../envs/es5.env:6:0-5029:0
<unknown>:20:-1--4
<unknown>:20:-1--4
<unknown>:20:-1--4
<unknown>:24:-3-25:-98
<unknown>:25:-5--97
<unknown>:25:-5--11
../envs/es5.env:977:28-983:3
../envs/es5.env:980:11-982:5
../envs/es5.env:287:28-293:1
Uncaught exception: {[#proto: @9, #class: "Object", #extensible: true,]
 'message' : {#value "Unbound identifier: $ERROR" ,
              #writable true ,
              #configurable false}}

Fatal error: exception Failure("Runtime error")

Is there anything that I'm missing?

@daejunpark daejunpark changed the title Failed to conform to ES5.1, Section 10.2.1.1.3 SetMutableBinding (N,V,S), Step 4, if-condition is true Failed to conform to ES5.1, Section 10.2.1.1.3 SetMutableBinding (N,V,S), Step 4 Apr 7, 2015
@daejunpark
Copy link
Author

@jpolitz
Copy link
Member

jpolitz commented Apr 15, 2015

In this example, I think that some support code is missing. S5 is reporting that $ERROR is unbound, so maybe this was part of the test infrastructure that's missing?

The program on the WebKit page

(function f() { f = 123; })()

does indeed produce undefined rather than an error though, so I think there's something to investigate in S5 here. Thanks!

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

No branches or pull requests

2 participants