File tree Expand file tree Collapse file tree 4 files changed +30
-27
lines changed Expand file tree Collapse file tree 4 files changed +30
-27
lines changed Original file line number Diff line number Diff line change 1313 * limitations under the License.
1414 */
1515
16- #include "lit-magic-strings.h"
17- #include "lit-strings.h"
18-
1916#include "jerryscript-core.h"
2017#include "jerryscript-port.h"
2118
2219#include "ecma-errors.h"
2320
21+ #include "lit-magic-strings.h"
22+ #include "lit-strings.h"
23+
2424#if JERRY_MODULE_SYSTEM
2525
2626/**
Original file line number Diff line number Diff line change @@ -932,38 +932,17 @@ ecma_module_connect_imports (ecma_module_t *module_p)
932932 {
933933 ecma_module_names_t * import_names_p = import_node_p -> module_names_p ;
934934
935+ JERRY_ASSERT (local_env_p -> type_flags_refs & ECMA_OBJECT_FLAG_BLOCK );
936+
935937 while (import_names_p != NULL )
936938 {
937- ecma_object_t * lex_env_p = local_env_p ;
938- ecma_property_t * binding_p = NULL ;
939-
940- if (lex_env_p -> type_flags_refs & ECMA_OBJECT_FLAG_BLOCK )
941- {
942- binding_p = ecma_find_named_property (lex_env_p , import_names_p -> local_name_p );
943-
944- JERRY_ASSERT (lex_env_p -> u2 .outer_reference_cp != JMEM_CP_NULL );
945- lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t , lex_env_p -> u2 .outer_reference_cp );
946- }
939+ ecma_property_t * binding_p = ecma_find_named_property (local_env_p , import_names_p -> local_name_p );
947940
948941 if (binding_p != NULL )
949942 {
950943 return ecma_raise_syntax_error (ECMA_ERR_IMPORTED_BINDING_SHADOWS_LOCAL_VARIABLE );
951944 }
952945
953- ecma_value_t status = ecma_op_has_binding (lex_env_p , import_names_p -> local_name_p );
954-
955- #if JERRY_BUILTIN_PROXY
956- if (ECMA_IS_VALUE_ERROR (status ))
957- {
958- return status ;
959- }
960- #endif /* JERRY_BUILTIN_PROXY */
961-
962- if (ecma_is_value_true (status ))
963- {
964- return ecma_raise_syntax_error (ECMA_ERR_IMPORTED_BINDING_SHADOWS_LOCAL_VARIABLE );
965- }
966-
967946 import_names_p = import_names_p -> next_p ;
968947 }
969948
Original file line number Diff line number Diff line change 1+ // Copyright JS Foundation and other contributors, http://js.foundation
2+ //
3+ // Licensed under the Apache License, Version 2.0 (the "License");
4+ // you may not use this file except in compliance with the License.
5+ // You may obtain a copy of the License at
6+ //
7+ // http://www.apache.org/licenses/LICENSE-2.0
8+ //
9+ // Unless required by applicable law or agreed to in writing, software
10+ // distributed under the License is distributed on an "AS IS" BASIS
11+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ // See the License for the specific language governing permissions and
13+ // limitations under the License.
14+
15+ import JSON , { counter as Object } from 'module-export-default-1.mjs'
16+
17+ // Overwriting globals.
18+ assert ( typeof JSON === "function" )
19+ assert ( Object === 1.1 )
20+
21+ // Globals are still available.
22+ assert ( typeof globalThis . JSON === "object" )
23+ assert ( typeof globalThis . Object === "function" )
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ tests/jerry/module-import-04.mjs
4343tests/jerry/module-import-05.mjs
4444tests/jerry/module-import-06.mjs
4545tests/jerry/module-import-07.mjs
46+ tests/jerry/module-import-global.mjs
4647tests/jerry/module-namespace-01.mjs
4748tests/jerry/module-namespace-02.mjs
4849tests/jerry/module-namespace-03.mjs
You can’t perform that action at this time.
0 commit comments