Implement environment record for class constructors (#4207)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
// Copyright JS Foundation and other contributors, http://js.foundation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
var count = 0
|
||||
|
||||
class C1 {
|
||||
constructor() {
|
||||
assert(++count === 3)
|
||||
}
|
||||
|
||||
a = (assert(++count === 2), 1.1)
|
||||
}
|
||||
|
||||
class C2 extends C1 {
|
||||
constructor() {
|
||||
var s = () => super()
|
||||
|
||||
function g() {
|
||||
assert(++count === 1)
|
||||
eval("s()");
|
||||
}
|
||||
|
||||
g();
|
||||
assert(++count === 5)
|
||||
}
|
||||
|
||||
b = (assert(++count === 4), "prop")
|
||||
}
|
||||
|
||||
var c = new C2
|
||||
assert(count === 5)
|
||||
assert(c.a === 1.1)
|
||||
assert(c.b === "prop")
|
||||
|
||||
var o = {}
|
||||
count = 0
|
||||
|
||||
class C3 extends C1 {
|
||||
constructor() {
|
||||
var s = () => () => eval("() => eval('super()')")
|
||||
|
||||
function g() {
|
||||
assert(++count === 1)
|
||||
s()()()
|
||||
}
|
||||
|
||||
g();
|
||||
assert(++count === 5)
|
||||
}
|
||||
|
||||
b = (assert(++count === 4), o)
|
||||
}
|
||||
|
||||
c = new C3
|
||||
assert(count === 5)
|
||||
assert(c.a === 1.1)
|
||||
assert(c.b === o)
|
||||
|
||||
var f
|
||||
class C4 extends Array {
|
||||
a = 6.6
|
||||
|
||||
constructor() {
|
||||
f = () => super()
|
||||
super()
|
||||
}
|
||||
}
|
||||
c = new C4
|
||||
assert(c.a === 6.6)
|
||||
|
||||
try {
|
||||
f()
|
||||
assert(false)
|
||||
} catch(e) {
|
||||
assert(e instanceof ReferenceError)
|
||||
}
|
||||
@@ -244,7 +244,6 @@
|
||||
<test id="language/asi/S7.9_A5.7_T1.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration.js"><reason>No longer a SyntaxError in ES11</reason></test>
|
||||
<test id="language/default-parameters/function-length.js"><reason></reason></test>
|
||||
<test id="language/expressions/arrow-function/lexical-super-call-from-within-constructor.js"><reason></reason></test>
|
||||
<test id="language/expressions/assignment/S11.13.1_A5_T1.js"><reason></reason></test>
|
||||
<test id="language/expressions/assignment/S11.13.1_A5_T2.js"><reason></reason></test>
|
||||
<test id="language/expressions/assignment/S11.13.1_A5_T3.js"><reason></reason></test>
|
||||
|
||||
@@ -2897,7 +2897,6 @@
|
||||
<test id="language/expressions/arrow-function/dstr/obj-ptrn-rest-val-obj.js"><reason></reason></test>
|
||||
<test id="language/expressions/arrow-function/eval-var-scope-syntax-err.js"><reason></reason></test>
|
||||
<test id="language/expressions/arrow-function/length-dflt.js"><reason></reason></test>
|
||||
<test id="language/expressions/arrow-function/lexical-super-call-from-within-constructor.js"><reason></reason></test>
|
||||
<test id="language/expressions/arrow-function/name.js"><reason></reason></test>
|
||||
<test id="language/expressions/arrow-function/param-dflt-yield-expr.js"><reason></reason></test>
|
||||
<test id="language/expressions/assignment/S11.13.1_A5_T1.js"><reason></reason></test>
|
||||
@@ -5982,7 +5981,6 @@
|
||||
<test id="language/expressions/class/elements/direct-eval-err-contains-newtarget.js"><reason></reason></test>
|
||||
<test id="language/expressions/class/elements/fields-anonymous-function-length.js"><reason></reason></test>
|
||||
<test id="language/expressions/class/elements/fields-multiple-definitions-static-private-methods-proxy.js"><reason></reason></test>
|
||||
<test id="language/expressions/class/elements/fields-run-once-on-double-super.js"><reason></reason></test>
|
||||
<test id="language/expressions/class/elements/gen-private-method-static/yield-spread-arr-multiple.js"><reason></reason></test>
|
||||
<test id="language/expressions/class/elements/gen-private-method-static/yield-spread-arr-single.js"><reason></reason></test>
|
||||
<test id="language/expressions/class/elements/gen-private-method-static/yield-spread-obj.js"><reason></reason></test>
|
||||
|
||||
Reference in New Issue
Block a user