Support get/set function declarations in classes in the pre-scanner. (#3098)
Fixes #3094 Fixes #3095 Fixes #3096 JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
committed by
Robert Fancsik
parent
fc30f003ba
commit
57de923770
@@ -125,11 +125,21 @@ class E {
|
||||
set e(e) {
|
||||
this._e = e;
|
||||
}
|
||||
|
||||
get () {
|
||||
return 11;
|
||||
}
|
||||
|
||||
set () {
|
||||
return 12;
|
||||
}
|
||||
}
|
||||
var e = new E (5);
|
||||
assert (e.e === 5);
|
||||
e.e = 10;
|
||||
assert (e.e === 10);
|
||||
assert (e.get() === 11);
|
||||
assert (e.set() === 12);
|
||||
assert (e.constructor === E);
|
||||
|
||||
var F = class ClassF {
|
||||
@@ -193,6 +203,14 @@ var G = class {
|
||||
return this._a;
|
||||
}
|
||||
|
||||
static get() {
|
||||
return 11;
|
||||
}
|
||||
|
||||
static set() {
|
||||
return 12;
|
||||
}
|
||||
|
||||
static set constructor(a) {
|
||||
this._a = a;
|
||||
}
|
||||
@@ -214,6 +232,8 @@ assert (G.a === 10);
|
||||
assert (G.g1() === 10);
|
||||
G["1"] = 20;
|
||||
assert (G["1"] === 20);
|
||||
assert (G.get() == 11);
|
||||
assert (G.set() == 12);
|
||||
G.constructor = 30;
|
||||
assert (G.constructor === 30);
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
// 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.
|
||||
|
||||
class $ {
|
||||
set ( ) {
|
||||
switch ( $ ) { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// 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.
|
||||
|
||||
class $ {
|
||||
set ( ) {}
|
||||
}
|
||||
for ( ; 10 ; i )
|
||||
@@ -0,0 +1,19 @@
|
||||
// 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.
|
||||
|
||||
class $ {
|
||||
set ( ) {
|
||||
while ( done )
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user