diff options
author | Vincent Sanders <vince@kyllikki.org> | 2015-10-08 16:06:56 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2015-10-08 16:06:56 +0100 |
commit | f9e20153b0c162662f95c821a6f4b27e5d2d9aec (patch) | |
tree | eba16317897a2ace9e073c68a69c489634f839cd /src/ir.c | |
parent | e170ee146791061f4fcc9523a901cdc1c6c8525b (diff) | |
download | nsgenbind-f9e20153b0c162662f95c821a6f4b27e5d2d9aec.tar.gz nsgenbind-f9e20153b0c162662f95c821a6f4b27e5d2d9aec.tar.bz2 |
Add automatic generation of property getters and setters
This allows the binding to omit specifying code for class property
getters and setters. The omitted code will be generated by genbind to
directly call suitable libdom accessors.
The type of the property (string, boolean etc.) is derived from the
IDL. If this type is incorrect, or is a type the generator cannot
automatically produce, then the property will be treated like it has no
binding implementation and generate unimplemented warnings.
Diffstat (limited to 'src/ir.c')
-rw-r--r-- | src/ir.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -469,6 +469,7 @@ attribute_map_new(struct webidl_node *interface, WEBIDL_NODE_TYPE_ATTRIBUTE); while (at_node != NULL) { + enum webidl_type *base_type; enum webidl_type_modifier *modifier; cure->node = at_node; @@ -485,6 +486,21 @@ attribute_map_new(struct webidl_node *interface, GENBIND_METHOD_TYPE_GETTER, cure->name); + /* find attributes base type */ + base_type = (enum webidl_type *)webidl_node_getint( + webidl_node_find_type( + webidl_node_getnode( + webidl_node_find_type( + webidl_node_getnode(at_node), + NULL, + WEBIDL_NODE_TYPE_TYPE)), + NULL, + WEBIDL_NODE_TYPE_TYPE_BASE)); + if (base_type != NULL) { + cure->base_type = *base_type; + } + + /* check for readonly attributes */ modifier = (enum webidl_type_modifier *)webidl_node_getint( webidl_node_find_type( |