mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Bug 94650 - Added warning for scriptable interfaces that inherit from non-scriptable interfaces. r=jst, sr=jband
This commit is contained in:
parent
ae0e8be080
commit
9ad843118b
@ -241,6 +241,12 @@ verify_attribute_declaration(IDL_tree method_tree);
|
|||||||
gboolean
|
gboolean
|
||||||
verify_method_declaration(IDL_tree method_tree);
|
verify_method_declaration(IDL_tree method_tree);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Verifies the interface declaration
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
verify_interface_declaration(IDL_tree method_tree);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Verify that a native declaration has an associated C++ expression, i.e. that
|
* Verify that a native declaration has an associated C++ expression, i.e. that
|
||||||
* it's of the form native <idl-name>(<c++-name>)
|
* it's of the form native <idl-name>(<c++-name>)
|
||||||
|
@ -153,6 +153,9 @@ interface(TreeState *state)
|
|||||||
char iid_parsed[UUID_LENGTH];
|
char iid_parsed[UUID_LENGTH];
|
||||||
GSList *doc_comments = IDL_IDENT(IDL_INTERFACE(iface).ident).comments;
|
GSList *doc_comments = IDL_IDENT(IDL_INTERFACE(iface).ident).comments;
|
||||||
|
|
||||||
|
if (!verify_interface_declaration(iface))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
#define FAIL do {ok = FALSE; goto out;} while(0)
|
#define FAIL do {ok = FALSE; goto out;} while(0)
|
||||||
|
|
||||||
fprintf(state->file, "\n/* starting interface: %s */\n",
|
fprintf(state->file, "\n/* starting interface: %s */\n",
|
||||||
|
@ -132,6 +132,8 @@ interface_declaration(TreeState *state)
|
|||||||
char *interface_name = IDL_IDENT(IDL_INTERFACE(interface).ident).str;
|
char *interface_name = IDL_IDENT(IDL_INTERFACE(interface).ident).str;
|
||||||
const char *iid = NULL;
|
const char *iid = NULL;
|
||||||
|
|
||||||
|
if (!verify_interface_declaration(interface))
|
||||||
|
return FALSE;
|
||||||
/*
|
/*
|
||||||
* Write out JavaDoc comment
|
* Write out JavaDoc comment
|
||||||
*/
|
*/
|
||||||
|
@ -510,6 +510,9 @@ typelib_interface(TreeState *state)
|
|||||||
uint16 parent_id = 0;
|
uint16 parent_id = 0;
|
||||||
PRUint8 interface_flags = 0;
|
PRUint8 interface_flags = 0;
|
||||||
|
|
||||||
|
if (!verify_interface_declaration(iface))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (IDL_tree_property_get(IDL_INTERFACE(iface).ident, "scriptable"))
|
if (IDL_tree_property_get(IDL_INTERFACE(iface).ident, "scriptable"))
|
||||||
interface_flags |= XPT_ID_SCRIPTABLE;
|
interface_flags |= XPT_ID_SCRIPTABLE;
|
||||||
|
|
||||||
|
@ -705,3 +705,31 @@ xpidl_list_foreach(IDL_tree p, IDL_tree_func foreach, gpointer user_data)
|
|||||||
p = list->next;
|
p = list->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Verify that the interface declaration is correct
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
verify_interface_declaration(IDL_tree interface_tree)
|
||||||
|
{
|
||||||
|
IDL_tree iter;
|
||||||
|
/*
|
||||||
|
* If we have the scriptable attribute then make sure all of our direct
|
||||||
|
* parents have it as well.
|
||||||
|
* NOTE: We don't recurse since all interfaces will fall through here
|
||||||
|
*/
|
||||||
|
if (IDL_tree_property_get(IDL_INTERFACE(interface_tree).ident,
|
||||||
|
"scriptable")) {
|
||||||
|
for (iter = IDL_INTERFACE(interface_tree).inheritance_spec; iter;
|
||||||
|
iter = IDL_LIST(iter).next) {
|
||||||
|
if (IDL_tree_property_get(
|
||||||
|
IDL_INTERFACE(iter).ident, "scriptable") == 0) {
|
||||||
|
XPIDL_WARNING((interface_tree,IDL_WARNING1,
|
||||||
|
"%s is scriptable but inherits from the non-scriptable interface %s\n",
|
||||||
|
IDL_IDENT(IDL_INTERFACE(interface_tree).ident).str,
|
||||||
|
IDL_IDENT(IDL_INTERFACE(iter).ident).str));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user