summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ir.c42
-rw-r--r--src/ir.h18
2 files changed, 43 insertions, 17 deletions
diff --git a/src/ir.c b/src/ir.c
index 2260d4f..566ac17 100644
--- a/src/ir.c
+++ b/src/ir.c
@@ -427,6 +427,9 @@ get_extended_value(struct webidl_node *node, const char *key)
return NULL;
}
+/**
+ * Create a new ir entry for an attribute
+ */
static int
attribute_map_new(struct webidl_node *interface,
struct genbind_node *class,
@@ -469,9 +472,13 @@ attribute_map_new(struct webidl_node *interface,
WEBIDL_NODE_TYPE_ATTRIBUTE);
while (at_node != NULL) {
- enum webidl_type *base_type;
+ struct webidl_node *type_node; /* type of attribute */
+ enum webidl_type *type_base;
+
enum webidl_type_modifier *modifier;
+ /* process attribute node into an entry */
+
cure->node = at_node;
cure->name = webidl_node_gettext(
@@ -486,22 +493,35 @@ 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(
+ /* find attributes first base type */
+ type_node = webidl_node_find_type(
+ webidl_node_getnode(at_node),
+ NULL,
+ WEBIDL_NODE_TYPE_TYPE);
+ type_base = (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)),
+ webidl_node_getnode(type_node),
NULL,
WEBIDL_NODE_TYPE_TYPE_BASE));
- if (base_type != NULL) {
- cure->base_type = *base_type;
+ if (type_base != NULL) {
+ enum webidl_type_modifier *type_modifier;
+
+ cure->base_type = *type_base;
+
+ type_modifier = (enum webidl_type_modifier *)webidl_node_getint(
+ webidl_node_find_type(
+ webidl_node_getnode(type_node),
+ NULL,
+ WEBIDL_NODE_TYPE_MODIFIER));
+ if (type_modifier != NULL) {
+ cure->type_modifier = *type_modifier;
+ } else {
+ cure->type_modifier = WEBIDL_TYPE_MODIFIER_NONE;
+ }
}
- /* check for readonly attributes */
+ /* get binding node for read/write attributes */
modifier = (enum webidl_type_modifier *)webidl_node_getint(
webidl_node_find_type(
webidl_node_getnode(at_node),
diff --git a/src/ir.h b/src/ir.h
index 12f1e79..87c72c3 100644
--- a/src/ir.h
+++ b/src/ir.h
@@ -47,14 +47,18 @@ struct ir_operation_entry {
struct ir_operation_overload_entry *overloadv;
};
-/** map entry for attributes on an interface */
+/**
+ * ir entry for attributes on an interface
+ */
struct ir_attribute_entry {
- const char *name; /** attribute name */
+ const char *name; /**< attribute name */
struct webidl_node *node; /**< AST attribute node */
- enum webidl_type base_type; /* type of attribute */
- enum webidl_type_modifier modifier; /* type modifier */
- const char *putforwards;
+ enum webidl_type base_type; /**< type of attribute */
+ enum webidl_type_modifier type_modifier; /**< modifier for the type */
+
+ enum webidl_type_modifier modifier; /**< modifier for the attribute intself */
+ const char *putforwards; /**< putforwards attribute */
struct genbind_node *getter; /**< getter from binding */
struct genbind_node *setter; /**< getter from binding */
@@ -66,7 +70,9 @@ struct ir_attribute_entry {
*/
};
-/** map entry for constants on an interface */
+/**
+ * map entry for constants on an interface
+ */
struct ir_constant_entry {
const char *name; /** attribute name */
struct webidl_node *node; /**< AST constant node */