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 13
13
* limitations under the License.
14
14
*/
15
15
16
- #include "lit-magic-strings.h"
17
- #include "lit-strings.h"
18
-
19
16
#include "jerryscript-core.h"
20
17
#include "jerryscript-port.h"
21
18
22
19
#include "ecma-errors.h"
23
20
21
+ #include "lit-magic-strings.h"
22
+ #include "lit-strings.h"
23
+
24
24
#if JERRY_MODULE_SYSTEM
25
25
26
26
/**
Original file line number Diff line number Diff line change @@ -932,38 +932,17 @@ ecma_module_connect_imports (ecma_module_t *module_p)
932
932
{
933
933
ecma_module_names_t * import_names_p = import_node_p -> module_names_p ;
934
934
935
+ JERRY_ASSERT (local_env_p -> type_flags_refs & ECMA_OBJECT_FLAG_BLOCK );
936
+
935
937
while (import_names_p != NULL )
936
938
{
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 );
947
940
948
941
if (binding_p != NULL )
949
942
{
950
943
return ecma_raise_syntax_error (ECMA_ERR_IMPORTED_BINDING_SHADOWS_LOCAL_VARIABLE );
951
944
}
952
945
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
-
967
946
import_names_p = import_names_p -> next_p ;
968
947
}
969
948
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
43
43
tests/jerry/module-import-05.mjs
44
44
tests/jerry/module-import-06.mjs
45
45
tests/jerry/module-import-07.mjs
46
+ tests/jerry/module-import-global.mjs
46
47
tests/jerry/module-namespace-01.mjs
47
48
tests/jerry/module-namespace-02.mjs
48
49
tests/jerry/module-namespace-03.mjs
You can’t perform that action at this time.
0 commit comments