Given class C {} print(C.toString()); this should print "class C {}" and not "function C() {}" This is important because it is a https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.tostring "If the object was defined using ECMAScript code and the returned string representation is not in the form of a MethodDefinition or GeneratorMethod then the representation must be such that if the string is evaluated, using eval in a lexical context that is equivalent to the lexical context used to create the original object, it will result in a new functionally equivalent object. In that case the returned source code must not mention freely any variables that were not mentioned freely by the original function’s source code, even if these “extra” names were originally in scope." The behavior of a FunctionDeclaration/FunctionExpression is not equivalent to a ClassDeclaration/ClassExpression. For example try this: class C {} assertThrows(function() { eval(C.toString())(); }, TypeError); // Class constructors cannot be invoked without 'new' This fails in JSC.
<rdar://problem/20795345>
Created attachment 252446 [details] WIP
*** This bug has been marked as a duplicate of bug 155336 ***