-
Notifications
You must be signed in to change notification settings - Fork 1
/
spec.emu
1482 lines (1440 loc) · 57.7 KB
/
spec.emu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<meta charset="utf8">
<link rel="stylesheet" href="./spec.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/github.min.css">
<script src="./spec.js"></script>
<pre class="metadata">
title: ECMAScript Module Phase Imports
stage: 2
contributors: Luca Casonato, Guy Bedford
</pre>
<emu-clause id="sec-ecmascript-data-types-and-values" aoid="Type">
<h1>ECMAScript Data Types and Values</h1>
<emu-clause id="sec-ecmascript-language-types">
<h1>ECMAScript Language Types</h1>
<emu-clause id="sec-object-type">
<h1>Object Type</h1>
<emu-clause id="sec-well-known-intrinsic-objects">
<h1>Well-Known Intrinsic Objects</h1>
<p>Well-known intrinsics are built-in objects that are explicitly referenced by the algorithms of this specification and which usually have realm-specific identities. Unless otherwise specified each intrinsic object actually corresponds to a set of similar objects, one per realm.</p>
<p>Within this specification a reference such as %name% means the intrinsic object, associated with the current realm, corresponding to the name. A reference such as %name.a.b% means, as if the *"b"* property of the value of the *"a"* property of the intrinsic object %name% was accessed prior to any ECMAScript code being evaluated. Determination of the current realm and its intrinsics is described in <emu-xref href="#sec-execution-contexts"></emu-xref>. The well-known intrinsics are listed in <emu-xref href="#table-well-known-intrinsic-objects"></emu-xref>.</p>
<emu-table id="table-well-known-intrinsic-objects" caption="Well-Known Intrinsic Objects" oldids="table-7">
<table>
<thead>
<tr>
<th>
Intrinsic Name
</th>
<th>
Global Name
</th>
<th>
ECMAScript Language Association
</th>
</tr>
</thead>
<tr>
<td>
%AbstractModuleSource%
</td>
<td>
`AbstractModuleSource`
</td>
<td>
The `AbstractModuleSource` constructor (<emu-xref href="#sec-abstractmodulesource-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%AggregateError%
</td>
<td>
`AggregateError`
</td>
<td>
The `AggregateError` constructor (<emu-xref href="#sec-aggregate-error-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Array%
</td>
<td>
`Array`
</td>
<td>
The Array constructor (<emu-xref href="#sec-array-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%ArrayBuffer%
</td>
<td>
`ArrayBuffer`
</td>
<td>
The ArrayBuffer constructor (<emu-xref href="#sec-arraybuffer-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%ArrayIteratorPrototype%
</td>
<td>
</td>
<td>
The prototype of Array iterator objects (<emu-xref href="#sec-array-iterator-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%AsyncFromSyncIteratorPrototype%
</td>
<td>
</td>
<td>
The prototype of async-from-sync iterator objects (<emu-xref href="#sec-async-from-sync-iterator-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%AsyncFunction%
</td>
<td>
</td>
<td>
The constructor of async function objects (<emu-xref href="#sec-async-function-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%AsyncGeneratorFunction%
</td>
<td>
</td>
<td>
The constructor of async generator function objects (<emu-xref href="#sec-asyncgeneratorfunction-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%AsyncGeneratorPrototype%
</td>
<td>
</td>
<td>
The prototype of async generator objects (<emu-xref href="#sec-asyncgenerator-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%AsyncIteratorPrototype%
</td>
<td>
</td>
<td>
An object that all standard built-in async iterator objects indirectly inherit from
</td>
</tr>
<tr>
<td>
%Atomics%
</td>
<td>
`Atomics`
</td>
<td>
The `Atomics` object (<emu-xref href="#sec-atomics-object"></emu-xref>)
</td>
</tr>
<tr>
<td>
%BigInt%
</td>
<td>
`BigInt`
</td>
<td>
The BigInt constructor (<emu-xref href="#sec-bigint-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%BigInt64Array%
</td>
<td>
`BigInt64Array`
</td>
<td>
The BigInt64Array constructor (<emu-xref href="#sec-typedarray-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%BigUint64Array%
</td>
<td>
`BigUint64Array`
</td>
<td>
The BigUint64Array constructor (<emu-xref href="#sec-typedarray-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Boolean%
</td>
<td>
`Boolean`
</td>
<td>
The Boolean constructor (<emu-xref href="#sec-boolean-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%DataView%
</td>
<td>
`DataView`
</td>
<td>
The DataView constructor (<emu-xref href="#sec-dataview-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Date%
</td>
<td>
`Date`
</td>
<td>
The Date constructor (<emu-xref href="#sec-date-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%decodeURI%
</td>
<td>
`decodeURI`
</td>
<td>
The `decodeURI` function (<emu-xref href="#sec-decodeuri-encodeduri"></emu-xref>)
</td>
</tr>
<tr>
<td>
%decodeURIComponent%
</td>
<td>
`decodeURIComponent`
</td>
<td>
The `decodeURIComponent` function (<emu-xref href="#sec-decodeuricomponent-encodeduricomponent"></emu-xref>)
</td>
</tr>
<tr>
<td>
%encodeURI%
</td>
<td>
`encodeURI`
</td>
<td>
The `encodeURI` function (<emu-xref href="#sec-encodeuri-uri"></emu-xref>)
</td>
</tr>
<tr>
<td>
%encodeURIComponent%
</td>
<td>
`encodeURIComponent`
</td>
<td>
The `encodeURIComponent` function (<emu-xref href="#sec-encodeuricomponent-uricomponent"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Error%
</td>
<td>
`Error`
</td>
<td>
The Error constructor (<emu-xref href="#sec-error-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%eval%
</td>
<td>
`eval`
</td>
<td>
The `eval` function (<emu-xref href="#sec-eval-x"></emu-xref>)
</td>
</tr>
<tr>
<td>
%EvalError%
</td>
<td>
`EvalError`
</td>
<td>
The EvalError constructor (<emu-xref href="#sec-native-error-types-used-in-this-standard-evalerror"></emu-xref>)
</td>
</tr>
<tr>
<td>
%FinalizationRegistry%
</td>
<td>
`FinalizationRegistry`
</td>
<td>
The FinalizationRegistry constructor (<emu-xref href="#sec-finalization-registry-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Float32Array%
</td>
<td>
`Float32Array`
</td>
<td>
The Float32Array constructor (<emu-xref href="#sec-typedarray-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Float64Array%
</td>
<td>
`Float64Array`
</td>
<td>
The Float64Array constructor (<emu-xref href="#sec-typedarray-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%ForInIteratorPrototype%
</td>
<td>
</td>
<td>
The prototype of For-In iterator objects (<emu-xref href="#sec-for-in-iterator-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Function%
</td>
<td>
`Function`
</td>
<td>
The Function constructor (<emu-xref href="#sec-function-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%GeneratorFunction%
</td>
<td>
</td>
<td>
The constructor of generator function objects (<emu-xref href="#sec-generatorfunction-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%GeneratorPrototype%
</td>
<td>
</td>
<td>
The prototype of generator objects (<emu-xref href="#sec-generator-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Int8Array%
</td>
<td>
`Int8Array`
</td>
<td>
The Int8Array constructor (<emu-xref href="#sec-typedarray-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Int16Array%
</td>
<td>
`Int16Array`
</td>
<td>
The Int16Array constructor (<emu-xref href="#sec-typedarray-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Int32Array%
</td>
<td>
`Int32Array`
</td>
<td>
The Int32Array constructor (<emu-xref href="#sec-typedarray-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%isFinite%
</td>
<td>
`isFinite`
</td>
<td>
The `isFinite` function (<emu-xref href="#sec-isfinite-number"></emu-xref>)
</td>
</tr>
<tr>
<td>
%isNaN%
</td>
<td>
`isNaN`
</td>
<td>
The `isNaN` function (<emu-xref href="#sec-isnan-number"></emu-xref>)
</td>
</tr>
<tr>
<td>
%IteratorPrototype%
</td>
<td>
</td>
<td>
An object that all standard built-in iterator objects indirectly inherit from
</td>
</tr>
<tr>
<td>
%JSON%
</td>
<td>
`JSON`
</td>
<td>
The `JSON` object (<emu-xref href="#sec-json-object"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Map%
</td>
<td>
`Map`
</td>
<td>
The Map constructor (<emu-xref href="#sec-map-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%MapIteratorPrototype%
</td>
<td>
</td>
<td>
The prototype of Map iterator objects (<emu-xref href="#sec-map-iterator-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Math%
</td>
<td>
`Math`
</td>
<td>
The `Math` object (<emu-xref href="#sec-math-object"></emu-xref>)
</td>
</tr>
<tr>
<td>
<ins>%ModuleSource%</ins>
</td>
<td>
<ins>`ModuleSource`</ins>
</td>
<td>
<ins>A `ModuleSource` object (<emu-xref href="#sec-module-source-object"></emu-xref>)</ins>
</td>
</tr>
<tr>
<td>
%Number%
</td>
<td>
`Number`
</td>
<td>
The Number constructor (<emu-xref href="#sec-number-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Object%
</td>
<td>
`Object`
</td>
<td>
The Object constructor (<emu-xref href="#sec-object-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%parseFloat%
</td>
<td>
`parseFloat`
</td>
<td>
The `parseFloat` function (<emu-xref href="#sec-parsefloat-string"></emu-xref>)
</td>
</tr>
<tr>
<td>
%parseInt%
</td>
<td>
`parseInt`
</td>
<td>
The `parseInt` function (<emu-xref href="#sec-parseint-string-radix"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Promise%
</td>
<td>
`Promise`
</td>
<td>
The Promise constructor (<emu-xref href="#sec-promise-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Proxy%
</td>
<td>
`Proxy`
</td>
<td>
The Proxy constructor (<emu-xref href="#sec-proxy-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%RangeError%
</td>
<td>
`RangeError`
</td>
<td>
The RangeError constructor (<emu-xref href="#sec-native-error-types-used-in-this-standard-rangeerror"></emu-xref>)
</td>
</tr>
<tr>
<td>
%ReferenceError%
</td>
<td>
`ReferenceError`
</td>
<td>
The ReferenceError constructor (<emu-xref href="#sec-native-error-types-used-in-this-standard-referenceerror"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Reflect%
</td>
<td>
`Reflect`
</td>
<td>
The `Reflect` object (<emu-xref href="#sec-reflect-object"></emu-xref>)
</td>
</tr>
<tr>
<td>
%RegExp%
</td>
<td>
`RegExp`
</td>
<td>
The RegExp constructor (<emu-xref href="#sec-regexp-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%RegExpStringIteratorPrototype%
</td>
<td>
</td>
<td>
The prototype of RegExp String Iterator objects (<emu-xref href="#sec-regexp-string-iterator-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Set%
</td>
<td>
`Set`
</td>
<td>
The Set constructor (<emu-xref href="#sec-set-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%SetIteratorPrototype%
</td>
<td>
</td>
<td>
The prototype of Set iterator objects (<emu-xref href="#sec-set-iterator-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%SharedArrayBuffer%
</td>
<td>
`SharedArrayBuffer`
</td>
<td>
The SharedArrayBuffer constructor (<emu-xref href="#sec-sharedarraybuffer-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%String%
</td>
<td>
`String`
</td>
<td>
The String constructor (<emu-xref href="#sec-string-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%StringIteratorPrototype%
</td>
<td>
</td>
<td>
The prototype of String iterator objects (<emu-xref href="#sec-string-iterator-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Symbol%
</td>
<td>
`Symbol`
</td>
<td>
The Symbol constructor (<emu-xref href="#sec-symbol-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%SyntaxError%
</td>
<td>
`SyntaxError`
</td>
<td>
The SyntaxError constructor (<emu-xref href="#sec-native-error-types-used-in-this-standard-syntaxerror"></emu-xref>)
</td>
</tr>
<tr>
<td>
%ThrowTypeError%
</td>
<td>
</td>
<td>
A function object that unconditionally throws a new instance of %TypeError%
</td>
</tr>
<tr>
<td>
%TypedArray%
</td>
<td>
</td>
<td>
The super class of all typed Array constructors (<emu-xref href="#sec-%typedarray%-intrinsic-object"></emu-xref>)
</td>
</tr>
<tr>
<td>
%TypeError%
</td>
<td>
`TypeError`
</td>
<td>
The TypeError constructor (<emu-xref href="#sec-native-error-types-used-in-this-standard-typeerror"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Uint8Array%
</td>
<td>
`Uint8Array`
</td>
<td>
The Uint8Array constructor (<emu-xref href="#sec-typedarray-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Uint8ClampedArray%
</td>
<td>
`Uint8ClampedArray`
</td>
<td>
The Uint8ClampedArray constructor (<emu-xref href="#sec-typedarray-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Uint16Array%
</td>
<td>
`Uint16Array`
</td>
<td>
The Uint16Array constructor (<emu-xref href="#sec-typedarray-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%Uint32Array%
</td>
<td>
`Uint32Array`
</td>
<td>
The Uint32Array constructor (<emu-xref href="#sec-typedarray-objects"></emu-xref>)
</td>
</tr>
<tr>
<td>
%URIError%
</td>
<td>
`URIError`
</td>
<td>
The URIError constructor (<emu-xref href="#sec-native-error-types-used-in-this-standard-urierror"></emu-xref>)
</td>
</tr>
<tr>
<td>
%WeakMap%
</td>
<td>
`WeakMap`
</td>
<td>
The WeakMap constructor (<emu-xref href="#sec-weakmap-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%WeakRef%
</td>
<td>
`WeakRef`
</td>
<td>
The WeakRef constructor (<emu-xref href="#sec-weak-ref-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%WeakSet%
</td>
<td>
`WeakSet`
</td>
<td>
The WeakSet constructor (<emu-xref href="#sec-weakset-constructor"></emu-xref>)
</td>
</tr>
</table>
</emu-table>
<emu-note>
<p>Additional entries in <emu-xref href="#table-additional-well-known-intrinsic-objects"></emu-xref>.</p>
</emu-note>
</emu-clause>
</emu-clause>
</emu-clause>
</emu-clause>
<emu-clause id="sec-ecmascript-language-expressions" number="13">
<h1>ECMAScript Language: Expressions</h1>
<emu-clause id="sec-left-hand-side-expressions" number="3">
<h1>Left-Hand-Side Expressions</h1>
<h2>Syntax</h2>
<emu-clause id="sec-import-calls" number="10">
<h1>Import Calls</h1>
<emu-clause id="sec-evaluate-import-call" type="abstract operation">
<h1>
EvaluateImportCall (
_specifierExpression_: a Parse Node,
_phase_: ~source~ or ~evaluation~,
optional _optionsExpression_: a Parse Node,
): either a normal completion containing a Promise or a throw completion
</h1>
<dl class="header">
</dl>
<emu-alg>
1. Let _referrer_ be GetActiveScriptOrModule().
1. If _referrer_ is *null*, set _referrer_ to the current Realm Record.
1. Let _specifierRef_ be ? Evaluation of _specifierExpression_.
1. Let _specifier_ be ? GetValue(_specifierRef_).
1. If _optionsExpression_ is present, then
1. Let _optionsRef_ be ? Evaluation of _optionsExpression_.
1. Let _options_ be ? GetValue(_optionsRef_).
1. Else,
1. Let _options_ be *undefined*.
1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%).
1. <ins>Let _moduleRequest_ be *undefined*.</ins>
1. <ins>If _specifier_ is an Object, then</ins>
1. <ins>Let _moduleSource_ be GetModuleSourceModuleRecord(_specifier_).</ins>
1. <ins>If _moduleSource_ is not ~not-a-source~, then</ins>
1. <ins>If _moduleSource_.[[Realm]] is not the current Realm Record, then</ins>
1. <ins>Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a newly created *TypeError* object »).</ins>
1. <ins>Return _promiseCapability_.[[Promise]].</ins>
1. <ins>Let _attributesObj_ be Completion(Get(_options_, *"with"*)).</ins>
1. <ins>IfAbruptRejectPromise(_attributesObj_, _promiseCapability_).</ins>
1. <ins>If _attributesObj_ is not *undefined*, then</ins>
1. <ins>Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a newly created *TypeError* object »).</ins>
1. <ins>Return _promiseCapability_.[[Promise]].</ins>
1. <ins>Set _moduleRequest_ to _moduleSource_.</ins>
1. <ins>If _moduleRequest_ is *undefined*, then</ins>
1. Let _specifierString_ be Completion(ToString(_specifier_)).
1. IfAbruptRejectPromise(_specifierString_, _promiseCapability_).
1. Let _attributes_ be a new empty List.
1. If _options_ is not *undefined*, then
1. If _options_ is not an Object, then
1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a newly created *TypeError* object »).
1. Return _promiseCapability_.[[Promise]].
1. Let _attributesObj_ be Completion(Get(_options_, *"with"*)).
1. IfAbruptRejectPromise(_attributesObj_, _promiseCapability_).
1. If _attributesObj_ is not *undefined*, then
1. If _attributesObj_ is not an Object, then
1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a newly created *TypeError* object »).
1. Return _promiseCapability_.[[Promise]].
1. Let _entries_ be Completion(EnumerableOwnProperties(_attributesObj_, ~key+value~)).
1. IfAbruptRejectPromise(_entries_, _promiseCapability_).
1. For each element _entry_ of _entries_, do
1. Let _key_ be ! Get(_entry_, *"0"*).
1. Let _value_ be ! Get(_entry_, *"1"*).
1. If _key_ is a String, then
1. If _value_ is not a String, then
1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a newly created *TypeError* object »).
1. Return _promiseCapability_.[[Promise]].
1. Append the ImportAttribute Record { [[Key]]: _key_, [[Value]]: _value_ } to _attributes_.
1. If AllImportAttributesSupported(_attributes_) is *false*, then
1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a newly created *TypeError* object »).
1. Return _promiseCapability_.[[Promise]].
1. Sort _attributes_ according to the lexicographic order of their [[Key]] fields, treating the value of each such field as a sequence of UTF-16 code unit values. NOTE: This sorting is observable only in that hosts are prohibited from changing behaviour based on the order in which attributes are enumerated.
1. <del>Let _moduleRequest_ be</del><ins>Set _moduleRequest_ to</ins> a new ModuleRequest Record { [[Specifier]]: _specifierString_, [[Phase]]: _phase_, [[Attributes]]: _attributes_ }.
1. Perform HostLoadImportedModule(_referrer_, _moduleRequest_, ~empty~, _promiseCapability_).
1. Return _promiseCapability_.[[Promise]].
</emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>
</emu-clause>
<emu-clause id="sec-ecmascript-language-scripts-and-modules" number="16">
<h1>ECMAScript Language: Scripts and Modules</h1>
<emu-clause id="sec-modules">
<h1>Modules</h1>
<emu-clause id="sec-module-semantics">
<h1>Module Semantics</h1>
<emu-clause id="sec-abstract-module-records">
<h1>Abstract Module Records</h1>
<emu-table id="table-abstract-methods-of-module-records" caption="Abstract Methods of Module Records" oldids="table-37">
<table>
<thead>
<tr>
<th>
Method
</th>
<th>
Purpose
</th>
</tr>
</thead>
<tr>
<td>
LoadRequestedModules( [ _hostDefined_ ] )
</td>
<td>
<p>Prepares the module for linking by recursively loading all its dependencies, and returns a promise.</p>
</td>
</tr>
<tr>
<td>
GetExportedNames([_exportStarSet_])
</td>
<td>
<p>Return a list of all names that are either directly or indirectly exported from this module.</p>
<p>LoadRequestedModules must have completed successfully prior to invoking this method.</p>
</td>
</tr>
<tr>
<td>
ResolveExport(_exportName_ [, _resolveSet_])
</td>
<td>
<p>Return the binding of a name exported by this module. Bindings are represented by a <dfn id="resolvedbinding-record" variants="ResolvedBinding Records">ResolvedBinding Record</dfn>, of the form { [[Module]]: Module Record, [[BindingName]]: String | ~namespace~ }. If the export is a Module Namespace Object without a direct binding in any module, [[BindingName]] will be set to ~namespace~. Return *null* if the name cannot be resolved, or ~ambiguous~ if multiple bindings were found.</p>
<p>Each time this operation is called with a specific _exportName_, _resolveSet_ pair as arguments it must return the same result.</p>
<p>LoadRequestedModules must have completed successfully prior to invoking this method.</p>
</td>
</tr>
<tr>
<td>
Link()
</td>
<td>
<p>Prepare the module for evaluation by transitively resolving all module dependencies and creating a Module Environment Record.</p>
<p>LoadRequestedModules must have completed successfully prior to invoking this method.</p>
</td>
</tr>
<tr>
<td>
Evaluate()
</td>
<td>
<p>Returns a promise for the evaluation of this module and its dependencies, resolving on successful evaluation or if it has already been evaluated successfully, and rejecting for an evaluation error or if it has already been evaluated unsuccessfully. If the promise is rejected, hosts are expected to handle the promise rejection and rethrow the evaluation error.</p>
<p>Link must have completed successfully prior to invoking this method.</p>
</td>
</tr>
<tr>
<td>
GetModuleSource()
</td>
<td>
<p>It returns either a normal completion containing the Module Source Object corresponding to this source Module Record's source phase (<emu-xref href="#sec-module-source-objects"></emu-xref>), or a throw completion.</p>
<p>When called multiple times on the same Module Record, if GetModuleSource() returns a normal completion it must always return a normal completion containing the same object.</p>
<p>The returned object should have a [[Prototype]] internal slot whose value is %AbstractModuleSource.prototype%.</p>
<p>For Module Records that do not have a source representation, GetModuleSource() must always return a throw completion whose [[Value]] is a *SyntaxError*.</p>
</td>
</tr>
<tr>
<td>
<ins>ModuleSourcesEqual(_otherModuleRecord_)</ins>
</td>
<td>
<p><ins>For Module Records that return a normal completion for GetModuleSource(), allows defining a source equality operation for host registry checks.</ins></p>
<p><ins>For Module Records that do not have a source representation, ModuleSourcesEqual() is never called.</ins></p>
</td>
</tr>
<tr>
<td>
<ins>GetModuleSourceName()</ins>
</td>
<td>
<p><ins>For Module Records that return a normal completion for GetModuleSource(), returns a constant String for each concrete module record that exposes a source representation through `GetModuleSource()`, to be provided in the strongly branded return value of the @@toStringTag getter on %AbstractModuleSource%.</ins></p>
<p><ins>For Module Records that do not have a source representation, GetModuleSourceName() is never called.</ins></p>
</td>
</tr>
</table>
</emu-table>
</emu-clause>
<emu-clause id="sec-source-text-module-records">
<h1>Source Text Module Records</h1>
<emu-table id="table-additional-fields-of-source-text-module-records" caption="Additional Fields of Source Text Module Records" oldids="table-38">
<table>
<thead>
<tr>