X-Git-Url: https://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/853c670e4b839fd435507201f04d16080590a894..7c9125f3e75c250e51d5bb9658f730519f103c10:/src/checks.c diff --git a/src/checks.c b/src/checks.c index 9283309..376e45b 100644 --- a/src/checks.c +++ b/src/checks.c @@ -32,13 +32,13 @@ #include "checks.h" static void -check_duplicate(Class *c, Node *node, char *id, int line_no, +check_duplicate(Class *c, Node *node, const char *id, int line_no, gboolean underscore) { GList *l; for(l = c->nodes; l != NULL; l = g_list_next(l)) { Node *n = l->data; - char *nid; + const char *nid; int nline_no; gboolean here_underscore = FALSE; if(n->type == METHOD_NODE) { @@ -152,7 +152,8 @@ check_bad_symbols(Class *c) if((m->method == SIGNAL_LAST_METHOD || m->method == SIGNAL_FIRST_METHOD || m->method == VIRTUAL_METHOD) && - (strcmp(m->id, "__parent__")==0 || + (strcmp(m->id, "_epv")==0 || + strcmp(m->id, "__parent__")==0 || strcmp(m->id, "___parent__")==0)) { error_printf(GOB_ERROR, m->line_no, "'%s' not allowed as an " @@ -183,12 +184,12 @@ check_bad_symbols(Class *c) } static void -check_duplicate_named(Class *c, Node *node, char *id, int line_no) +check_duplicate_named(Class *c, Node *node, const char *id, int line_no) { GList *l; for(l = c->nodes; l != NULL; l = g_list_next(l)) { Node *n = l->data; - char *nid; + const char *nid; int nline_no; if(n->type == METHOD_NODE) { Method *m = (Method *)n; @@ -582,3 +583,27 @@ count_initializers(Class *c) } return num; } + +gboolean +find_get_type (Class *c) +{ + GList *l; + for(l = c->nodes; l != NULL; l = g_list_next(l)) { + Node *n = l->data; + Method *m = (Method *)n; + if(n->type == METHOD_NODE && + strcmp (m->id, "get_type") == 0) { + if (m->method != REGULAR_METHOD || + m->scope != PUBLIC_SCOPE || + m->args != NULL) { + error_printf (GOB_ERROR, m->line_no, + "get_type method must be a " + "regular public method with " + "no arguments"); + } + return TRUE; + } + } + + return FALSE; +}