[heycam/webidl] Allow dictionary default values to reference type members (#717)

Hello. Long time reader, first time issue raiser. Love your work.

In WebGPU, we have a lot of cases where we want to do something like this:

```
typedef unsigned long u32;
typedef u32 GPUColorWriteFlags;

interface GPUColorWriteBits {
    const u32 NONE = 0;
    const u32 RED = 1;
    const u32 GREEN = 2;
    const u32 BLUE = 4;
    const u32 ALPHA = 8;
    const u32 ALL = 15;
};

dictionary GPUColorStateDescriptor {
    GPUColorWriteFlags writeMask = GPUColorWriteBits.ALL;
};
```

Note the default value on the `GPUColorStateDescriptor`'s `writeMask`. This is currently forbidden in WebIDL because:

```
DefaultValue ::
    ConstValue
    string
    [ ]
    null
```

I realise this isn't terribly common in Web APIs - most of the time your default value will be a constant value or a string from an enum. But it would be really nice to allow this type of dereferencing for WebGPU - saves you having to look up the constant value in the related interface.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/717

Received on Monday, 22 April 2019 18:15:55 UTC