| Differences between
and this patch
- a/Source/JavaScriptCore/ChangeLog +29 lines
Lines 1-5 a/Source/JavaScriptCore/ChangeLog_sec1
1
2015-03-13  Ryosuke Niwa  <rniwa@webkit.org>
1
2015-03-13  Ryosuke Niwa  <rniwa@webkit.org>
2
2
3
        ES6 class syntax should allow computed name method as well as static getters and setters
4
        https://bugs.webkit.org/show_bug.cgi?id=142690
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Added the support for computed property names in ES6 class syntax. e.g.
9
        class A {
10
            ["bar" + 1]() { }
11
        }
12
        (new A).bar1();
13
14
        Also fixed a bug that we were disallowing static getters and setters. e.g.
15
        class B {
16
            static get foo() { }
17
        }
18
19
        * parser/ASTBuilder.h:
20
        (JSC::ASTBuilder::createProperty):
21
        * parser/NodeConstructors.h:
22
        (JSC::PropertyNode::PropertyNode):
23
        * parser/Nodes.h:
24
        * parser/Parser.cpp:
25
        (JSC::Parser<LexerType>::parseClass): Added the support for parsing methods with computed names.
26
        Much of the code change is about indenting the exiting code.
27
        * parser/SyntaxChecker.h:
28
        (JSC::SyntaxChecker::createProperty):
29
30
2015-03-13  Ryosuke Niwa  <rniwa@webkit.org>
31
3
        Add support for default constructor
32
        Add support for default constructor
4
        https://bugs.webkit.org/show_bug.cgi?id=142388
33
        https://bugs.webkit.org/show_bug.cgi?id=142388
5
34
- a/Source/JavaScriptCore/parser/ASTBuilder.h -1 / +4 lines
Lines 350-356 public: a/Source/JavaScriptCore/parser/ASTBuilder.h_sec1
350
    {
350
    {
351
        return new (m_parserArena) PropertyNode(parserArena.identifierArena().makeNumericIdentifier(vm, propertyName), node, type, putType);
351
        return new (m_parserArena) PropertyNode(parserArena.identifierArena().makeNumericIdentifier(vm, propertyName), node, type, putType);
352
    }
352
    }
353
    PropertyNode* createProperty(ExpressionNode* propertyName, ExpressionNode* node, PropertyNode::Type type, PropertyNode::PutType putType, bool) { return new (m_parserArena) PropertyNode(propertyName, node, type, putType); }
353
    PropertyNode* createProperty(ExpressionNode* propertyName, ExpressionNode* node, PropertyNode::Type type, PropertyNode::PutType putType, bool, SuperBinding superBinding = SuperBinding::NotNeeded)
354
    {
355
        return new (m_parserArena) PropertyNode(propertyName, node, type, putType, superBinding);
356
    }
354
    PropertyListNode* createPropertyList(const JSTokenLocation& location, PropertyNode* property) { return new (m_parserArena) PropertyListNode(location, property); }
357
    PropertyListNode* createPropertyList(const JSTokenLocation& location, PropertyNode* property) { return new (m_parserArena) PropertyListNode(location, property); }
355
    PropertyListNode* createPropertyList(const JSTokenLocation& location, PropertyNode* property, PropertyListNode* tail) { return new (m_parserArena) PropertyListNode(location, property, tail); }
358
    PropertyListNode* createPropertyList(const JSTokenLocation& location, PropertyNode* property, PropertyListNode* tail) { return new (m_parserArena) PropertyListNode(location, property, tail); }
356
359
- a/Source/JavaScriptCore/parser/NodeConstructors.h -2 / +2 lines
Lines 173-184 namespace JSC { a/Source/JavaScriptCore/parser/NodeConstructors.h_sec1
173
    {
173
    {
174
    }
174
    }
175
175
176
    inline PropertyNode::PropertyNode(ExpressionNode* name, ExpressionNode* assign, Type type, PutType putType)
176
    inline PropertyNode::PropertyNode(ExpressionNode* name, ExpressionNode* assign, Type type, PutType putType, SuperBinding superBinding)
177
        : m_name(0)
177
        : m_name(0)
178
        , m_expression(name)
178
        , m_expression(name)
179
        , m_assign(assign)
179
        , m_assign(assign)
180
        , m_type(type)
180
        , m_type(type)
181
        , m_needsSuperBinding(false)
181
        , m_needsSuperBinding(superBinding == SuperBinding::Needed)
182
        , m_putType(putType)
182
        , m_putType(putType)
183
    {
183
    {
184
    }
184
    }
- a/Source/JavaScriptCore/parser/Nodes.h -1 / +1 lines
Lines 512-518 namespace JSC { a/Source/JavaScriptCore/parser/Nodes.h_sec1
512
        enum PutType { Unknown, KnownDirect };
512
        enum PutType { Unknown, KnownDirect };
513
513
514
        PropertyNode(const Identifier&, ExpressionNode*, Type, PutType, SuperBinding);
514
        PropertyNode(const Identifier&, ExpressionNode*, Type, PutType, SuperBinding);
515
        PropertyNode(ExpressionNode* propertyName, ExpressionNode*, Type, PutType);
515
        PropertyNode(ExpressionNode* propertyName, ExpressionNode*, Type, PutType, SuperBinding);
516
516
517
        ExpressionNode* expressionName() const { return m_expression; }
517
        ExpressionNode* expressionName() const { return m_expression; }
518
        const Identifier* name() const { return m_name; }
518
        const Identifier* name() const { return m_name; }
- a/Source/JavaScriptCore/parser/Parser.cpp -31 / +43 lines
Lines 1489-1497 template <class TreeBuilder> TreeClassExpression Parser<LexerType>::parseClass(T a/Source/JavaScriptCore/parser/Parser.cpp_sec1
1489
    consumeOrFailWithFlags(OPENBRACE, TreeBuilder::DontBuildStrings, "Expected opening '{' at the start of a class body");
1489
    consumeOrFailWithFlags(OPENBRACE, TreeBuilder::DontBuildStrings, "Expected opening '{' at the start of a class body");
1490
1490
1491
    TreeExpression constructor = 0;
1491
    TreeExpression constructor = 0;
1492
    TreePropertyList staticMethods = 0;
1493
    TreePropertyList instanceMethods = 0;
1492
    TreePropertyList instanceMethods = 0;
1494
    TreePropertyList instanceMethodsTail = 0;
1493
    TreePropertyList instanceMethodsTail = 0;
1494
    TreePropertyList staticMethods = 0;
1495
    TreePropertyList staticMethodsTail = 0;
1495
    TreePropertyList staticMethodsTail = 0;
1496
    while (!match(CLOSEBRACE)) {
1496
    while (!match(CLOSEBRACE)) {
1497
        if (match(SEMICOLON))
1497
        if (match(SEMICOLON))
Lines 1505-1545 template <class TreeBuilder> TreeClassExpression Parser<LexerType>::parseClass(T a/Source/JavaScriptCore/parser/Parser.cpp_sec2
1505
        if (isStaticMethod)
1505
        if (isStaticMethod)
1506
            next();
1506
            next();
1507
1507
1508
        matchOrFail(IDENT, "Expected an indentifier");
1509
1510
        const CommonIdentifiers& propertyNames = *m_vm->propertyNames;
1508
        const CommonIdentifiers& propertyNames = *m_vm->propertyNames;
1511
        const Identifier& ident = *m_token.m_data.ident;
1512
        bool isGetter = ident == propertyNames.get;
1513
        bool isSetter = ident == propertyNames.set;
1514
1515
        TreeProperty property;
1509
        TreeProperty property;
1516
        const bool alwaysStrictInsideClass = true;
1510
        const bool alwaysStrictInsideClass = true;
1517
        if (isGetter || isSetter) {
1511
        if (match(OPENBRACKET)) {
1518
            semanticFailIfTrue(isStaticMethod, "Cannot declare a static", stringForFunctionMode(isGetter ? GetterMode : SetterMode));
1512
            next();
1519
            nextExpectIdentifier(LexerFlagsIgnoreReservedWords);
1513
            TreeExpression computedName = parseExpression(context);
1520
            property = parseGetterSetter(context, alwaysStrictInsideClass, isGetter ? PropertyNode::Getter : PropertyNode::Setter, methodStart, constructorKind, SuperBinding::Needed);
1514
            failIfFalse(computedName, "Cannot parse computed property name");
1521
            failIfFalse(property, "Cannot parse this method");
1515
            handleProductionOrFail(CLOSEBRACKET, "]", "end", "computed property name");
1516
            ParserFunctionInfo<TreeBuilder> computedMethodInfo;
1517
            computedMethodInfo.name = &propertyNames.nullIdentifier;
1518
            failIfFalse((parseFunctionInfo(context, FunctionNoRequirements,
1519
                isStaticMethod ? FunctionMode : MethodMode, false, constructorKind, computedMethodInfo)), "Cannot parse this method");
1520
            TreeExpression computedMethod = context.createFunctionExpr(methodLocation, computedMethodInfo, methodStart);
1521
            property = context.createProperty(computedName, computedMethod, PropertyNode::Constant, PropertyNode::KnownDirect, alwaysStrictInsideClass, SuperBinding::Needed);
1522
        } else {
1522
        } else {
1523
            ParserFunctionInfo<TreeBuilder> methodInfo;
1523
            matchOrFail(IDENT, "Expected an indentifier");
1524
            failIfFalse((parseFunctionInfo(context, FunctionNeedsName, isStaticMethod ? FunctionMode : MethodMode, false, constructorKind, methodInfo)), "Cannot parse this method");
1524
1525
            failIfFalse(methodInfo.name, "method must have a name");
1525
            const Identifier& ident = *m_token.m_data.ident;
1526
            failIfFalse(declareVariable(methodInfo.name), "Cannot declare a method named '", methodInfo.name->impl(), "'");
1526
            bool isGetter = ident == propertyNames.get;
1527
1527
            bool isSetter = ident == propertyNames.set;
1528
            bool isConstructor = !isStaticMethod && *methodInfo.name == propertyNames.constructor;
1529
            if (isConstructor)
1530
                methodInfo.name = className;
1531
1532
            TreeExpression method = context.createFunctionExpr(methodLocation, methodInfo, methodStart);
1533
            if (isConstructor) {
1534
                semanticFailIfTrue(constructor, "Cannot declare multiple constructors in a single class");
1535
                constructor = method;
1536
                continue;
1537
            }
1538
1528
1539
            // FIXME: Syntax error when super() is called
1529
            if (isGetter || isSetter) {
1540
            semanticFailIfTrue(isStaticMethod && *methodInfo.name == propertyNames.prototype,
1530
                nextExpectIdentifier(LexerFlagsIgnoreReservedWords);
1541
                "Cannot declare a static method named 'prototype'");
1531
                property = parseGetterSetter(context, alwaysStrictInsideClass, isGetter ? PropertyNode::Getter : PropertyNode::Setter, methodStart, constructorKind, SuperBinding::Needed);
1542
            property = context.createProperty(methodInfo.name, method, PropertyNode::Constant, PropertyNode::Unknown, alwaysStrictInsideClass, SuperBinding::Needed);
1532
                failIfFalse(property, "Cannot parse this method");
1533
            } else {
1534
                ParserFunctionInfo<TreeBuilder> methodInfo;
1535
                failIfFalse((parseFunctionInfo(context, FunctionNeedsName, isStaticMethod ? FunctionMode : MethodMode, false, constructorKind, methodInfo)), "Cannot parse this method");
1536
                failIfFalse(methodInfo.name, "method must have a name");
1537
                failIfFalse(declareVariable(methodInfo.name), "Cannot declare a method named '", methodInfo.name->impl(), "'");
1538
1539
                bool isConstructor = !isStaticMethod && *methodInfo.name == propertyNames.constructor;
1540
                if (isConstructor)
1541
                    methodInfo.name = className;
1542
1543
                TreeExpression method = context.createFunctionExpr(methodLocation, methodInfo, methodStart);
1544
                if (isConstructor) {
1545
                    semanticFailIfTrue(constructor, "Cannot declare multiple constructors in a single class");
1546
                    constructor = method;
1547
                    continue;
1548
                }
1549
1550
                // FIXME: Syntax error when super() is called
1551
                semanticFailIfTrue(isStaticMethod && *methodInfo.name == propertyNames.prototype,
1552
                    "Cannot declare a static method named 'prototype'");
1553
                property = context.createProperty(methodInfo.name, method, PropertyNode::Constant, PropertyNode::Unknown, alwaysStrictInsideClass, SuperBinding::Needed);
1554
            }
1543
        }
1555
        }
1544
1556
1545
        TreePropertyList& tail = isStaticMethod ? staticMethodsTail : instanceMethodsTail;
1557
        TreePropertyList& tail = isStaticMethod ? staticMethodsTail : instanceMethodsTail;
- a/Source/JavaScriptCore/parser/SyntaxChecker.h -1 / +1 lines
Lines 189-195 public: a/Source/JavaScriptCore/parser/SyntaxChecker.h_sec1
189
            return Property(type);
189
            return Property(type);
190
        return Property(&parserArena.identifierArena().makeNumericIdentifier(vm, name), type);
190
        return Property(&parserArena.identifierArena().makeNumericIdentifier(vm, name), type);
191
    }
191
    }
192
    Property createProperty(int, int, PropertyNode::Type type, PropertyNode::PutType, bool)
192
    Property createProperty(int, int, PropertyNode::Type type, PropertyNode::PutType, bool, SuperBinding = SuperBinding::NotNeeded)
193
    {
193
    {
194
        return Property(type);
194
        return Property(type);
195
    }
195
    }
- a/LayoutTests/ChangeLog +19 lines
Lines 1-5 a/LayoutTests/ChangeLog_sec1
1
2015-03-13  Ryosuke Niwa  <rniwa@webkit.org>
1
2015-03-13  Ryosuke Niwa  <rniwa@webkit.org>
2
2
3
        ES6 class syntax should allow computed name method as well as static getters and setters
4
        https://bugs.webkit.org/show_bug.cgi?id=142690
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Added a test for computed method names.
9
10
        Also added test cases for static getters and setters to existing tests.
11
12
        * js/class-syntax-computed-method-name-expected.txt: Added.
13
        * js/class-syntax-computed-method-name.html: Added.
14
        * js/class-syntax-declaration-expected.txt:
15
        * js/class-syntax-expression-expected.txt:
16
        * js/script-tests/class-syntax-computed-method-name.js: Added.
17
        * js/script-tests/class-syntax-declaration.js:
18
        * js/script-tests/class-syntax-expression.js:
19
20
2015-03-13  Ryosuke Niwa  <rniwa@webkit.org>
21
3
        Implement default constructor
22
        Implement default constructor
4
23
5
        Add support for default constructor
24
        Add support for default constructor
- a/LayoutTests/js/class-syntax-computed-method-name-expected.txt +21 lines
Line 0 a/LayoutTests/js/class-syntax-computed-method-name-expected.txt_sec1
1
This test checks the behavior of computed property names in ES6 class syntax.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
PASS (class { static ["hi"]() { return 1; } }).hi() is 1
7
PASS (new (class { ["hi"]() { return 2; } })).hi() is 2
8
PASS (class { static ["hi"]() { return 3; } static hi() { return 4; } }).hi() is 4
9
PASS var c = new (class { hi() { return 5; } ["hi"]() { return 6; } }); c.hi() is 6
10
PASS var c = new (class { [NaN]() { return 7; } }); c[NaN](); is 7
11
PASS var a = "hello", b = 8; (new (class { [a + b]() { return 9; } })).hello8() is 9
12
PASS var c = new (class { [2 * 5]() { return 11; } }); c["10"]() is 11
13
PASS var c = new (class { [null]() { return 12; } [undefined]() { return 13; } }); c[undefined]() is 13
14
PASS var c = new (class { [14 + 0.01 + "x"](x) { return x + 15; } }); c["14.01x"](1) is 16
15
PASS new (class { [1+]() { } }) threw exception SyntaxError: Unexpected token ']'.
16
PASS new (class { [var]() { } }) threw exception SyntaxError: Unexpected keyword 'var'.
17
PASS new (class { [baz]() { } }) threw exception ReferenceError: Can't find variable: baz.
18
PASS successfullyParsed is true
19
20
TEST COMPLETE
21
- a/LayoutTests/js/class-syntax-computed-method-name.html +8 lines
Line 0 a/LayoutTests/js/class-syntax-computed-method-name.html_sec1
1
<!DOCTYPE html>
2
<html>
3
<body>
4
<script src="../resources/js-test-pre.js"></script>
5
<script src="script-tests/class-syntax-computed-method-name.js"></script>
6
<script src="../resources/js-test-post.js"></script>
7
</body>
8
</html>
- a/LayoutTests/js/class-syntax-declaration-expected.txt -3 / +3 lines
Lines 5-18 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE a/LayoutTests/js/class-syntax-declaration-expected.txt_sec1
5
5
6
PASS constructorCallCount is 0
6
PASS constructorCallCount is 0
7
PASS A.someStaticMethod() is staticMethodValue
7
PASS A.someStaticMethod() is staticMethodValue
8
PASS A.someStaticGetter is getterValue
9
PASS setterValue = undefined; A.someStaticSetter = 123; setterValue is 123
8
PASS (new A).someInstanceMethod() is instanceMethodValue
10
PASS (new A).someInstanceMethod() is instanceMethodValue
9
PASS constructorCallCount is 1
11
PASS constructorCallCount is 1
10
PASS (new A).someGetter is getterValue
12
PASS (new A).someGetter is getterValue
11
PASS constructorCallCount is 2
13
PASS constructorCallCount is 2
12
PASS (new A).someGetter is getterValue
14
PASS (new A).someGetter is getterValue
13
PASS setterValue is undefined
15
PASS setterValue = undefined; (new A).someSetter = 789; setterValue is 789
14
PASS (new A).someSetter = 789 did not throw exception.
15
PASS setterValue is 789
16
PASS (new A).__proto__ is A.prototype
16
PASS (new A).__proto__ is A.prototype
17
PASS A.prototype.constructor is A
17
PASS A.prototype.constructor is A
18
PASS class threw exception SyntaxError: Unexpected end of script.
18
PASS class threw exception SyntaxError: Unexpected end of script.
- a/LayoutTests/js/class-syntax-expression-expected.txt -3 / +3 lines
Lines 5-18 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE a/LayoutTests/js/class-syntax-expression-expected.txt_sec1
5
5
6
PASS constructorCallCount is 0
6
PASS constructorCallCount is 0
7
PASS A.someStaticMethod() is staticMethodValue
7
PASS A.someStaticMethod() is staticMethodValue
8
PASS A.someStaticGetter is getterValue
9
PASS setterValue = undefined; A.someStaticSetter = 123; setterValue is 123
8
PASS (new A).someInstanceMethod() is instanceMethodValue
10
PASS (new A).someInstanceMethod() is instanceMethodValue
9
PASS constructorCallCount is 1
11
PASS constructorCallCount is 1
10
PASS (new A).someGetter is getterValue
12
PASS (new A).someGetter is getterValue
11
PASS constructorCallCount is 2
13
PASS constructorCallCount is 2
12
PASS (new A).someGetter is getterValue
14
PASS (new A).someGetter is getterValue
13
PASS setterValue is undefined
15
PASS setterValue = undefined; (new A).someSetter = 789; setterValue is 789
14
PASS (new A).someSetter = 789 did not throw exception.
15
PASS setterValue is 789
16
PASS (new A).__proto__ is A.prototype
16
PASS (new A).__proto__ is A.prototype
17
PASS A.prototype.constructor is A
17
PASS A.prototype.constructor is A
18
PASS x = class threw exception SyntaxError: Unexpected end of script.
18
PASS x = class threw exception SyntaxError: Unexpected end of script.
- a/LayoutTests/js/script-tests/class-syntax-computed-method-name.js +17 lines
Line 0 a/LayoutTests/js/script-tests/class-syntax-computed-method-name.js_sec1
1
description("This test checks the behavior of computed property names in ES6 class syntax.");
2
3
shouldBe('(class { static ["hi"]() { return 1; } }).hi()', '1');
4
shouldBe('(new (class { ["hi"]() { return 2; } })).hi()', '2');
5
shouldBe('(class { static ["hi"]() { return 3; } static hi() { return 4; } }).hi()', '4');
6
shouldBe('var c = new (class { hi() { return 5; } ["hi"]() { return 6; } }); c.hi()', '6');
7
shouldBe('var c = new (class { [NaN]() { return 7; } }); c[NaN]();', '7');
8
shouldBe('var a = "hello", b = 8; (new (class { [a + b]() { return 9; } })).hello8()', '9');
9
shouldBe('var c = new (class { [2 * 5]() { return 11; } }); c["10"]()', '11');
10
shouldBe('var c = new (class { [null]() { return 12; } [undefined]() { return 13; } }); c[undefined]()', '13');
11
shouldBe('var c = new (class { [14 + 0.01 + "x"](x) { return x + 15; } }); c["14.01x"](1)', '16');
12
13
shouldThrow('new (class { [1+]() { } })', '"SyntaxError: Unexpected token \']\'"');
14
shouldThrow('new (class { [var]() { } })', '"SyntaxError: Unexpected keyword \'var\'"');
15
shouldThrow('new (class { [baz]() { } })', '"ReferenceError: Can\'t find variable: baz"');
16
17
var successfullyParsed = true;
- a/LayoutTests/js/script-tests/class-syntax-declaration.js -3 / +5 lines
Lines 9-14 var setterValue = undefined; a/LayoutTests/js/script-tests/class-syntax-declaration.js_sec1
9
class A {
9
class A {
10
    constructor() { constructorCallCount++; }
10
    constructor() { constructorCallCount++; }
11
    static someStaticMethod() { return staticMethodValue; }
11
    static someStaticMethod() { return staticMethodValue; }
12
    static get someStaticGetter() { return getterValue; }
13
    static set someStaticSetter(value) { setterValue = value; }
12
    someInstanceMethod() { return instanceMethodValue; }
14
    someInstanceMethod() { return instanceMethodValue; }
13
    get someGetter() { return getterValue; }
15
    get someGetter() { return getterValue; }
14
    set someSetter(value) { setterValue = value; }
16
    set someSetter(value) { setterValue = value; }
Lines 16-29 class A { a/LayoutTests/js/script-tests/class-syntax-declaration.js_sec2
16
18
17
shouldBe("constructorCallCount", "0");
19
shouldBe("constructorCallCount", "0");
18
shouldBe("A.someStaticMethod()", "staticMethodValue");
20
shouldBe("A.someStaticMethod()", "staticMethodValue");
21
shouldBe("A.someStaticGetter", "getterValue");
22
shouldBe("setterValue = undefined; A.someStaticSetter = 123; setterValue", "123");
19
shouldBe("(new A).someInstanceMethod()", "instanceMethodValue");
23
shouldBe("(new A).someInstanceMethod()", "instanceMethodValue");
20
shouldBe("constructorCallCount", "1");
24
shouldBe("constructorCallCount", "1");
21
shouldBe("(new A).someGetter", "getterValue");
25
shouldBe("(new A).someGetter", "getterValue");
22
shouldBe("constructorCallCount", "2");
26
shouldBe("constructorCallCount", "2");
23
shouldBe("(new A).someGetter", "getterValue");
27
shouldBe("(new A).someGetter", "getterValue");
24
shouldBe("setterValue", "undefined");
28
shouldBe("setterValue = undefined; (new A).someSetter = 789; setterValue", "789");
25
shouldNotThrow("(new A).someSetter = 789");
26
shouldBe("setterValue", "789");
27
shouldBe("(new A).__proto__", "A.prototype");
29
shouldBe("(new A).__proto__", "A.prototype");
28
shouldBe("A.prototype.constructor", "A");
30
shouldBe("A.prototype.constructor", "A");
29
31
- a/LayoutTests/js/script-tests/class-syntax-expression.js -3 / +5 lines
Lines 9-14 var setterValue = undefined; a/LayoutTests/js/script-tests/class-syntax-expression.js_sec1
9
var A = class {
9
var A = class {
10
    constructor() { constructorCallCount++; }
10
    constructor() { constructorCallCount++; }
11
    static someStaticMethod() { return staticMethodValue; }
11
    static someStaticMethod() { return staticMethodValue; }
12
    static get someStaticGetter() { return getterValue; }
13
    static set someStaticSetter(value) { setterValue = value; }
12
    someInstanceMethod() { return instanceMethodValue; }
14
    someInstanceMethod() { return instanceMethodValue; }
13
    get someGetter() { return getterValue; }
15
    get someGetter() { return getterValue; }
14
    set someSetter(value) { setterValue = value; }
16
    set someSetter(value) { setterValue = value; }
Lines 16-29 var A = class { a/LayoutTests/js/script-tests/class-syntax-expression.js_sec2
16
18
17
shouldBe("constructorCallCount", "0");
19
shouldBe("constructorCallCount", "0");
18
shouldBe("A.someStaticMethod()", "staticMethodValue");
20
shouldBe("A.someStaticMethod()", "staticMethodValue");
21
shouldBe("A.someStaticGetter", "getterValue");
22
shouldBe("setterValue = undefined; A.someStaticSetter = 123; setterValue", "123");
19
shouldBe("(new A).someInstanceMethod()", "instanceMethodValue");
23
shouldBe("(new A).someInstanceMethod()", "instanceMethodValue");
20
shouldBe("constructorCallCount", "1");
24
shouldBe("constructorCallCount", "1");
21
shouldBe("(new A).someGetter", "getterValue");
25
shouldBe("(new A).someGetter", "getterValue");
22
shouldBe("constructorCallCount", "2");
26
shouldBe("constructorCallCount", "2");
23
shouldBe("(new A).someGetter", "getterValue");
27
shouldBe("(new A).someGetter", "getterValue");
24
shouldBe("setterValue", "undefined");
28
shouldBe("setterValue = undefined; (new A).someSetter = 789; setterValue", "789");
25
shouldNotThrow("(new A).someSetter = 789");
26
shouldBe("setterValue", "789");
27
shouldBe("(new A).__proto__", "A.prototype");
29
shouldBe("(new A).__proto__", "A.prototype");
28
shouldBe("A.prototype.constructor", "A");
30
shouldBe("A.prototype.constructor", "A");
29
31

Return to Bug 142690