Bug 94650 - Added warning for scriptable interfaces that inherit from non-scriptable interfaces. r=jst, sr=jband

This commit is contained in:
dbradley%netscape.com 2001-11-03 00:05:57 +00:00
parent ae0e8be080
commit 9ad843118b
5 changed files with 42 additions and 0 deletions

View File

@ -241,6 +241,12 @@ verify_attribute_declaration(IDL_tree method_tree);
gboolean
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
* it's of the form native <idl-name>(<c++-name>)

View File

@ -153,6 +153,9 @@ interface(TreeState *state)
char iid_parsed[UUID_LENGTH];
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)
fprintf(state->file, "\n/* starting interface: %s */\n",

View File

@ -132,6 +132,8 @@ interface_declaration(TreeState *state)
char *interface_name = IDL_IDENT(IDL_INTERFACE(interface).ident).str;
const char *iid = NULL;
if (!verify_interface_declaration(interface))
return FALSE;
/*
* Write out JavaDoc comment
*/

View File

@ -510,6 +510,9 @@ typelib_interface(TreeState *state)
uint16 parent_id = 0;
PRUint8 interface_flags = 0;
if (!verify_interface_declaration(iface))
return FALSE;
if (IDL_tree_property_get(IDL_INTERFACE(iface).ident, "scriptable"))
interface_flags |= XPT_ID_SCRIPTABLE;

View File

@ -705,3 +705,31 @@ xpidl_list_foreach(IDL_tree p, IDL_tree_func foreach, gpointer user_data)
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;
}