Files
sdk/tests/compiler
Mark Zhou b4582d25d9 [dart2js] Adding support for required named parameters.
Supercedes previous work here: https://dart-review.googlesource.com/c/sdk/+/128849

Change overview:

* In legacy mode, the isRequired flag for parameters in the kernel IR is treated as false (though this bool is still processed during serialization).

* Adds a Set<String> to the element model to represent required-ness. All named parameters are still stored in a single "bag".

* ParameterStructure objects additionally emit/ingest all required named parameters as well during serialization.

* A bool indicating whether or not a parameter is required is emitted after each named parameter when serializing FunctionTypes.

* JS identifiers for functions with required named parameters now emit '$req' before each required named parameter. E.g., dynamic_Function_String_$named_p0_int_$req_p1_int for dynamic Function({int p0, required int p1}).

* Recipes now indicate required named parameters with '!' instead of ':'. E.g., @(int,{p0:int,p1!int}) if p1 is required and p0 is optional.

* A requiredNamedSeparator was added to the shared recipes to accommodate the above.

* The RTI now represents named function parameters as a repeating list of triplets (name/bool/type). This adds a bit of overhead to our parser but makes subtype checks simpler.

* Does NOT include changes to Function.apply + auxiliary information attached to closures. These will be added in a later patch.

Fixes #39730
Change-Id: I9c9eaac28da0d63bb16bdb439f021f1470539563
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141204
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-04-30 16:53:32 +00:00
..