Rework ES2015 module system and add missing features. (#2792)

Co-authored-by: Dániel Bátyai <dbatyai@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Daniel Vince vinced@inf.u-szeged.hu
This commit is contained in:
Daniel Vince
2019-04-25 14:57:17 +02:00
committed by Robert Fancsik
parent 938e9c7530
commit 37b7645e6a
59 changed files with 2209 additions and 991 deletions
+1 -1
View File
@@ -13,4 +13,4 @@
* limitations under the License.
*/
import { , as b } from "tests/jerry/es2015/module-imported.js";
import { , as b } from "tests/jerry/es2015/module-export-01.js";
+1 -1
View File
@@ -13,4 +13,4 @@
* limitations under the License.
*/
import , as b from "tests/jerry/es2015/module-imported.js";
import , as b from "tests/jerry/es2015/module-export-01.js";
+1 -1
View File
@@ -13,4 +13,4 @@
* limitations under the License.
*/
import { b as , } from "tests/jerry/es2015/module-imported.js";
import { b as , } from "tests/jerry/es2015/module-export-01.js";
+2 -1
View File
@@ -13,4 +13,5 @@
* limitations under the License.
*/
import b as , from "tests/jerry/es2015/module-imported.js";
/* Named imports must be in a NamedImports block. */
import b as , from "tests/jerry/es2015/module-export-01.js";
+2 -1
View File
@@ -13,4 +13,5 @@
* limitations under the License.
*/
import { as as as } from "tests/jerry/es2015/module-imported.js";
/* Can't have reserved words for the referenced bindings. */
export { yield as y };
+2 -1
View File
@@ -13,4 +13,5 @@
* limitations under the License.
*/
import { from as as } from "tests/jerry/es2015/module-imported.js";
/* Module requests must always be evaluated. */
import "tests/jerry/fail/module-sideeffect.js"
+2 -1
View File
@@ -13,4 +13,5 @@
* limitations under the License.
*/
import { b } from
/* A string literal must always follow the 'from' keyword. */
import { b } from
+1
View File
@@ -13,4 +13,5 @@
* limitations under the License.
*/
/* A string literal must always follow the 'from' keyword. */
import { b } from 3
+2 -1
View File
@@ -13,4 +13,5 @@
* limitations under the License.
*/
import { c as a, d as a } from "tests/jerry/es2015/module-imported.js";
/* Can't have duplicate local bindings */
import { c as a, d as a } from "tests/jerry/es2015/module-export-01.js";
+2 -1
View File
@@ -13,6 +13,7 @@
* limitations under the License.
*/
/* Import/export statements must be in the global scope. */
if (true) {
import { c } from "tests/jerry/es2015/module-imported.js";
import { c } from "tests/jerry/es2015/module-export-01.js";
}
+2 -1
View File
@@ -13,6 +13,7 @@
* limitations under the License.
*/
/* Import/export statements must be in the global scope. */
function someFunction() {
import { c } from "tests/jerry/es2015/module-imported.js";
import { c } from "tests/jerry/es2015/module-export-01.js";
}
+2 -1
View File
@@ -13,4 +13,5 @@
* limitations under the License.
*/
eval ("import { c } from 'tests/jerry/es2015/module-imported.js';");
/* Import/export statements must be in the global scope. */
eval ('import { c } from "tests/jerry/es2015/module-export-01.js";');
+2 -2
View File
@@ -13,5 +13,5 @@
* limitations under the License.
*/
// File does not exist.
import { a } from "tests/jerry/fail/module-exports.js"
/* NamedImports must always be followed by a FromClause. */
import { b }, from "tests/jerry/es2015/module-export-01.js"
+2 -5
View File
@@ -13,8 +13,5 @@
* limitations under the License.
*/
export function getString () {
return prefix;
}
assert (getString());
/* An import statement can have either a NameSpaceImport or NamedIpmorts */
import * as mod, { b } from "tests/jerry/es2015/module-export-01.js"
+1
View File
@@ -13,4 +13,5 @@
* limitations under the License.
*/
/* An ImportClause must be followed by a FromClause. */
import { c }
+17
View File
@@ -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.
*/
/* '*' is not valid inside NamedImports. */
import { *, d } from "tests/jerry/es2015/module-imported-01.js"
+18
View File
@@ -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.
*/
/* Can't have duplicated local bindings. */
import { b } from "tests/jerry/es2015/module-export-01.js"
import { b } from "tests/jerry/es2015/module-export-02.js"
+17
View File
@@ -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.
*/
/* FromClause must follow an ImportClause. */
import from "tests/jerry/es2015/module-export-02.js"
+17
View File
@@ -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.
*/
/* Namespace imports must have a local name. */
import * from "tests/jerry/es2015/module-export-01.js"
+17
View File
@@ -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.
*/
/* Star exports can't have an export name. */
export * as star from "tests/jerry/es2015/module-export-01.js"
+17
View File
@@ -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.
*/
/* Indirect exports must be checked if they are resolvable. */
export { l } from "tests/jerry/es2015/module-export-01.js"
+17
View File
@@ -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.
*/
/* Can't have circular imports/exports. */
export { b } from "tests/jerry/fail/module-027.js"
+17
View File
@@ -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.
*/
/* Can't have circular imports/exports. */
export { b } from "tests/jerry/fail/module-026.js"
+17
View File
@@ -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.
*/
/* Ambiguous import */
import { x } from "tests/jerry/es2015/module-export-05.js"
+17
View File
@@ -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.
*/
/* Import/export statements must be in the global scope. */
Function('','import { c } from "tests/jerry/es2015/module-export-01.js";')
+17
View File
@@ -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.
*/
/* No default export found. */
import def from "tests/jerry/es2015/module-export-06.js"
+16
View File
@@ -0,0 +1,16 @@
/* 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.
*/
throw new Error("side-effect")