detect type mismatches in method declarations and definitions

This commit is contained in:
Bill Currie 2003-04-22 15:48:39 +00:00
parent 2f6fc5d80c
commit 6a0b74ca10
6 changed files with 12 additions and 8 deletions

View file

@ -15,7 +15,7 @@
@implementation GameEntity @implementation GameEntity
- (BOOL) takeDamage: weapon : inflictor : attacker : damage - (BOOL) takeDamage: weapon :inflictor :attacker : (float)damage
{ {
return NO; return NO;
} }

View file

@ -64,7 +64,7 @@ integer deathmatch;
@implementation World @implementation World
- spawn: (entity)ent - (void) spawn: (entity)ent
{ {
[self initWithEntity: ent]; [self initWithEntity: ent];
bodyque = [[BodyQueue alloc] init]; bodyque = [[BodyQueue alloc] init];

View file

@ -49,9 +49,10 @@ string (inputline_t il) InputLine_GetText = #0;
InputLine_Draw (il); InputLine_Draw (il);
} }
- (void) setText: (string)text - (id) setText: (string)text
{ {
InputLine_SetText (il, text); InputLine_SetText (il, text);
return self;
} }
- (string) text - (string) text

View file

@ -33,12 +33,12 @@
return [myCopy initWithComponents: x : y]; return [myCopy initWithComponents: x : y];
} }
- (id) x - (integer) x
{ {
return x; return x;
} }
- (id) y - (integer) y
{ {
return y; return y;
} }

View file

@ -33,12 +33,12 @@
return [myCopy initWithComponents: width : height]; return [myCopy initWithComponents: width : height];
} }
- (id) width - (integer) width
{ {
return width; return width;
} }
- (id) height - (integer) height
{ {
return height; return height;
} }

View file

@ -403,8 +403,11 @@ class_find_method (class_type_t *class_type, method_t *method)
class_name = class_type->c.class->name; class_name = class_type->c.class->name;
} }
for (m = methods->head; m; m = m->next) for (m = methods->head; m; m = m->next)
if (method_compare (method, m)) if (method_compare (method, m)) {
if (m->type != method->type)
error (0, "method type mismatch");
return m; return m;
}
sel = dstring_newstr (); sel = dstring_newstr ();
selector_name (sel, (keywordarg_t *)method->selector); selector_name (sel, (keywordarg_t *)method->selector);
warning (0, "%s method %s not in %s%s", warning (0, "%s method %s not in %s%s",