Re-target for ES.Next (#3901)

A list of changes:
- 'es2015-subset' profile is deprecated, and an 'es.next' profile is added.
- The default profile is changed to 'es.next'
- Renamed the JERRY_ES2015 guard to JERRY_ESNEXT
- Renamed JERRY_ES2015_BUILTIN_* guards to JERRY_BUILTIN_*
- Moved es2015 specific tests to a new 'es.next' subdirectory
- Updated docs, targets, and test runners to reflect these changes

Resolves #3737.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
This commit is contained in:
Dániel Bátyai
2020-06-12 17:55:00 +02:00
committed by GitHub
parent c0270c4887
commit fde0d556ac
832 changed files with 3053 additions and 3046 deletions
@@ -0,0 +1,17 @@
/* 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 a = new Int8Array(5);
assert(a.length === 5);
@@ -0,0 +1,17 @@
/* 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 a = new Int8Array(5);
assert(a.byteOffset === 0);
@@ -0,0 +1,17 @@
/* 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 a = new Int8Array(5);
assert(a.byteLength === 5);
@@ -0,0 +1,17 @@
/* 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 a = new Int8Array(5);
assert(a.buffer instanceof ArrayBuffer);
@@ -0,0 +1,22 @@
/* 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 a = new Int8Array([1,2,3,4,5]);
var b = new Int8Array(a.buffer, 2, 3);
assert(a.buffer === b.buffer);
assert(b.length === 3);
assert(b.byteOffset === 2);
assert(b.byteLength === 3);
@@ -0,0 +1,20 @@
/* 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 a = new Int8Array([1,2,3,4,5]);
var b = new Int8Array(a.buffer, 2, 3);
b[0] = 5.6;
assert(a[2] === 5);
@@ -0,0 +1,37 @@
/* 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 a = new Uint8Array([10, 20, 30, 40]);
var o = {
"small":0,
"large":0
};
var func = function(v, k)
{
if (v < 25)
{
this.small = this.small + k;
}
else
{
this.large = this.large + k;
}
}
var ret = a.forEach(func, o);
assert(ret === undefined);
assert(o.small === 1); // 0+1
assert(o.large === 5); // 2+3
@@ -0,0 +1,27 @@
/* 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 a = new Uint8Array([1, 2, 3]);
var b = a.map(function(num) {
return num * 2;
});
assert(a[0] === 1);
assert(a[1] === 2);
assert(a[2] === 3);
assert(b[0] === 2);
assert(b[1] === 4);
assert(b[2] === 6);
@@ -0,0 +1,28 @@
/* 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 a = new Uint8Array([1, 2, 3, 4]);
var count = 0;
function f_every(num)
{
count++;
return num < 3;
}
var ret = a.every(f_every);
assert(ret === false);
assert(count === 3);
@@ -0,0 +1,28 @@
/* 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 a = new Uint8Array([1, 2, 3, 4]);
var count = 0;
function f_some(num)
{
count++;
return num > 3;
}
var ret = a.some(f_some);
assert(ret === true);
assert(count === 4);
@@ -0,0 +1,27 @@
/* 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 a = new Float32Array([1.25, 2.5, 3.75]);
var b = a.map(function(num) {
return num * 2;
});
assert(a[0] === 1.25);
assert(a[1] === 2.5);
assert(a[2] === 3.75);
assert(b[0] === 2.5);
assert(b[1] === 5);
assert(b[2] === 7.5);
@@ -0,0 +1,28 @@
/* 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 a = new Float32Array([1.1, 2.2, 3.3, 4.4]);
var count = 0;
function f_every(num)
{
count++;
return num < 3;
}
var ret = a.every(f_every);
assert(ret === false);
assert(count === 3);
@@ -0,0 +1,28 @@
/* 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 a = new Float32Array([1.1, 2.2, 3.3, 4.4]);
var count = 0;
function f_some(num)
{
count++;
return num > 3;
}
var ret = a.some(f_some);
assert(ret === true);
assert(count === 3);
@@ -0,0 +1,37 @@
/* 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 a = new Float32Array([-1.1, 0.1, 2.5, 3.0]);
var o = {
"small":0,
"large":0
};
var func = function(v, k)
{
if (v < 2)
{
this.small = this.small + k;
}
else
{
this.large = this.large + k;
}
}
var ret = a.forEach(func, o);
assert(ret === undefined);
assert(o.small === 1); // 0+1
assert(o.large === 5); // 2+3
@@ -0,0 +1,20 @@
/* 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 total = new Float32Array([-1.5, 0, 1.5, 2]).reduce(function(a, b, c) {
return a + b + c;
}, 10);
assert(total === 18); // 10 + (-1.5) + 0 + 0 + 1 + 1.5 + 2 + 2 + 3
@@ -0,0 +1,20 @@
/* 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 total = new Float32Array([-1.5, 0, 1.5, 2]).reduceRight(function(a, b) {
return a - b;
});
assert (total === 2) // 2 - 1.5 - 0 - (-1.5)
@@ -0,0 +1,27 @@
/* 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 a = new Float32Array([-1.5, 0, 1.5, 2]);
var b = a.filter(function(x){
return x > 0;
});
assert(a[0] === -1.5);
assert(a[1] === 0);
assert(a[2] === 1.5);
assert(a[3] === 2);
assert(b[0] === 1.5);
assert(b[1] === 2);
assert(b.length === 2);
@@ -0,0 +1,23 @@
/* 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 a = new Float32Array([-1.5, 0, 1.5]);
var b = a.reverse()
assert(a === b);
assert(a[0] === 1.5);
assert(a[1] === 0);
assert(a[2] === -1.5);
@@ -0,0 +1,74 @@
/* 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 uint8 = new Uint8Array(4);
// 22.2.3.22
assert(uint8.set.length === 1)
try
{
uint8.set([1], -1);
assert(false);
} catch (e)
{
assert(e instanceof RangeError);
}
try
{
uint8.set([1], - (Math.pow(2, 32) + 1));
assert(false);
} catch (e)
{
assert(e instanceof RangeError);
}
try
{
uint8.set([1], -Infinity);
assert(false);
} catch (e)
{
assert(e instanceof RangeError);
}
try
{
uint8.set([1], Infinity);
assert(false);
} catch (e)
{
assert(e instanceof RangeError);
}
try
{
uint8.set([1], (Math.pow(2, 32) + 1));
assert(false);
} catch (e)
{
assert(e instanceof RangeError);
}
try
{
// 22.2.3.22.1 step 20
uint8.set([17, 18, 19], 2);
assert(false);
} catch (e)
{
assert(e instanceof RangeError)
}
@@ -0,0 +1,53 @@
/* 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 uint8 = new Uint8Array(4);
uint8.set([10, "11", 12]);
assert(uint8[0] === 10 && uint8[1] === 11 && uint8[2] === 12);
uint8.set([13, 14.3, 15], 1);
assert(uint8[0] === 10 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);
uint8.set([16], NaN);
assert(uint8[0] === 16 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);
uint8.set([17], "");
assert(uint8[0] === 17 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);
uint8.set([18], "0");
assert(uint8[0] === 18 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);
uint8.set([19], false);
assert(uint8[0] === 19 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);
uint8.set([20], 0.2);
assert(uint8[0] === 20 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);
uint8.set([21], 0.9);
assert(uint8[0] === 21 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);
uint8.set([22], null);
assert(uint8[0] === 22 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);
uint8.set([23], {});
assert(uint8[0] === 23 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);
uint8.set([24], []);
assert(uint8[0] === 24 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);
uint8.set([25], true);
assert(uint8[0] === 24 && uint8[1] === 25 && uint8[2] === 14 && uint8[3] === 15);
@@ -0,0 +1,31 @@
/* 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 float64 = new Float64Array(4);
float64.set([10.1, "11.2", 12.3]);
assert(float64[0] === 10.1 && float64[1] === 11.2 && float64[2] === 12.3);
float64.set([13.1, 14.2, 15.3], 1);
assert(float64[0] === 10.1 && float64[1] === 13.1 && float64[2] === 14.2 && float64[3] === 15.3);
try
{
// 22.2.3.22.1 step 20
float64.set([17.1, 18.2, 19.3], 2);
assert(false);
} catch (e)
{
assert(e instanceof RangeError)
}