The new setup is:
* Consequential interfaces with no explicit descriptor are still skipped.
* If no information is provided about an interface, an empty descriptor is
assumed.
* If a list is provided and the only entry is a worker descriptor, an empty
main-thread descriptor is assumed.
There are several parts here:
1) Enforce the requirement that dictionary arguments not followed by a required argument are optional.
2) Make dictionaries no longer be distinguishable from nullable types.
3) Disallow dictionaries or unions containing dictionaries inside a nullable type.
4) Force optional dictionaries to have a default value of null so that codegen doesn't have to worry about dealing with
optional arguments that have no default value in the IDL but need to be treated as if they were null.
There are several parts here:
1) Enforce the requirement that dictionary arguments not followed by a required argument are optional.
2) Make dictionaries no longer be distinguishable from nullable types.
3) Disallow dictionaries or unions containing dictionaries inside a nullable type.
4) Force optional dictionaries to have a default value of null so that codegen doesn't have to worry about dealing with
optional arguments that have no default value in the IDL but need to be treated as if they were null.
In this new setup, there are three new extended attributes: Infallible,
GetterInfallible, SetterInfallible. The first one applies to both methods and
attributes, while the last two apply only to attributes. Each one can be
either set with no value specified (in which case it applies both on main
thread and in workers) or can be set to MainThread or Workers to limit where it
applies.
If Infallible is set on an attribute, then GetterInfallible and
SetterInfallible will be ignored. So if you want to specify, for example, an
attribute that's infallible on the main thread and has an infallible getter in
workers, the right way to do that is [GetterInfallible,
SetterInfallible=MainThread].
Another implementation option would be to put all the dictionaries in a single
file and have a static global set of ids which works across all dictionaries
and is initialized once at startup or so. That would also handle cross-file
dictionary inheritance better.
One problem that remains is the fake descriptor business. At the moment this
does not allow interface types inside dictionaries. We could probably work
around this by either refactoring code to make it possible to get the declType
independently of the actual conversion template (whether because it lives in a
separate function or because the conversion template generator knows to just
return an empty string when the fake descriptor provirder is passed) or by
figuring out a way to pass an actual descriptor provider to dictionary codegen.
There are two changes here. One is to pass tracking=True to our parser. This makes it properly track positions
of all productions, not just of lexer tokens. The second is to properly count up our newlines in the lex data,
since the lexer seems to report the line number of the start of the lex data, which is always 1 in our case.