servo/components/script/dom/bindings/codegen
Manish Goregaokar ad198993b1 Assert that DOM structs have the correct first field
DOM structs embed their parent type as their first field. This
introduces a `.parent()` method to the DOM struct that returns its first
field, and codegens a type assert that ensures that `.parent()` returns
the parent struct.

This generates:

On `#[dom_struct]`:

```rust
impl HasParent for Type {
    type Parent = ParentType;
    fn as_parent(&self) -> ParentType {
        &self.first_field
    }
}
```

In the codegen files:

```rust
impl Type {
    fn __assert_parent_type(&self) {
        let _: &ParentType = self.as_parent();
    }
}
````
2018-07-03 09:39:29 -07:00
..
parser Update the WebIDL parser 2018-04-03 14:06:07 +02:00
ply
api.html.template Generate a list of supported DOM APIs from parsed WebIDLs. 2016-07-15 18:13:09 -04:00
apis.html.template Generate a list of supported DOM APIs from parsed WebIDLs. 2016-07-15 18:13:09 -04:00
BindingGen.py Remove unused command-line Python codegen arguments 2016-01-07 08:51:06 -05:00
Bindings.conf Renamed BrowsingContext to WindowProxy in script. 2017-05-12 15:02:35 -05:00
CodegenRust.py Assert that DOM structs have the correct first field 2018-07-03 09:39:29 -07:00
Configuration.py Update the WebIDL parser 2018-04-03 14:06:07 +02:00
GlobalGen.py script codegen: Avoid modifying in-place a generated file. 2017-01-19 17:13:35 +01:00
interface.html.template Generate a list of supported DOM APIs from parsed WebIDLs. 2016-07-15 18:13:09 -04:00
property.html.template Generate a list of supported DOM APIs from parsed WebIDLs. 2016-07-15 18:13:09 -04:00
pythonpath.py Native MSVC windows build, convert to cmake 2016-08-17 09:50:51 -04:00