[Webkit-unassigned] [Bug 144285] New: ES6 classes invalid toString

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Apr 27 15:54:18 PDT 2015


            Bug ID: 144285
           Summary: ES6 classes invalid toString
    Classification: Unclassified
           Product: WebKit
           Version: 528+ (Nightly build)
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: arv at chromium.org


class C {}

this should print

"class C {}"

and not

"function C() {}"

This is important because it is a


"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() {
}, TypeError); // Class constructors cannot be invoked without 'new'

This fails in JSC.

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/20150427/668de098/attachment-0001.html>

More information about the webkit-unassigned mailing list