Skip to content

Commit 86e31f9

Browse files
osa1Commit Queue
authored andcommitted
[dart2wasm] Document InteropSpecializerFactory._jsObjectLiteralMethods
Change-Id: Ib29757f95c2ed5964d796c7f481e27aaba8848ea Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/422500 Reviewed-by: Nate Biggs <[email protected]> Commit-Queue: Ömer Ağacan <[email protected]>
1 parent 2a388bd commit 86e31f9

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pkg/dart2wasm/lib/js/interop_specializer.dart

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,26 @@ class InteropSpecializerFactory {
351351
/// should be called with `numberOfArgs` arguments.
352352
final Map<Procedure, Map<int, Procedure>> _overloadedProcedures = {};
353353

354+
/// Maps an interop procedure for a JS object literal to trampolines based on
355+
/// named arguments that are passed at invocation sites. For example:
356+
///
357+
/// ```
358+
/// extension type Literal._(JSObject _) implements JSObject {
359+
/// external factory Literal.fact({double a, String b, bool c});
360+
/// }
361+
///
362+
/// Literal.fact(a: 1.2);
363+
/// Literal.fact(a: 3.4, b: 'a');
364+
/// Literal.fact(a: 5.6, b: 'b');
365+
/// ```
366+
///
367+
/// Here we map the procedure for `Literal.fact` to interop procedures, based
368+
/// on the named arguments passed.
369+
///
370+
/// The `String` keys are named arguments passed in the call sites, joined by
371+
/// `|`. E.g. `"a|b"` in the second and third calls above.
354372
final Map<Procedure, Map<String, Procedure>> _jsObjectLiteralMethods = {};
373+
355374
late final ExtensionIndex _extensionIndex;
356375

357376
InteropSpecializerFactory(this._staticTypeContext, this._util,

0 commit comments

Comments
 (0)