From 6a0b74ca101c5cdfacf0cf78c101f5418124b918 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 22 Apr 2003 15:48:39 +0000 Subject: [PATCH] detect type mismatches in method declarations and definitions --- ruamoko/game/GameEntity.r | 2 +- ruamoko/game/World.r | 2 +- ruamoko/lib/InputLine.r | 3 ++- ruamoko/lib/Point.r | 4 ++-- ruamoko/lib/Size.r | 4 ++-- tools/qfcc/source/class.c | 5 ++++- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ruamoko/game/GameEntity.r b/ruamoko/game/GameEntity.r index 9fe698f45..b1923a5d9 100644 --- a/ruamoko/game/GameEntity.r +++ b/ruamoko/game/GameEntity.r @@ -15,7 +15,7 @@ @implementation GameEntity -- (BOOL) takeDamage: weapon : inflictor : attacker : damage +- (BOOL) takeDamage: weapon :inflictor :attacker : (float)damage { return NO; } diff --git a/ruamoko/game/World.r b/ruamoko/game/World.r index 150e95fff..eb2083842 100644 --- a/ruamoko/game/World.r +++ b/ruamoko/game/World.r @@ -64,7 +64,7 @@ integer deathmatch; @implementation World -- spawn: (entity)ent +- (void) spawn: (entity)ent { [self initWithEntity: ent]; bodyque = [[BodyQueue alloc] init]; diff --git a/ruamoko/lib/InputLine.r b/ruamoko/lib/InputLine.r index ba94fbf0e..85d689499 100644 --- a/ruamoko/lib/InputLine.r +++ b/ruamoko/lib/InputLine.r @@ -49,9 +49,10 @@ string (inputline_t il) InputLine_GetText = #0; InputLine_Draw (il); } -- (void) setText: (string)text +- (id) setText: (string)text { InputLine_SetText (il, text); + return self; } - (string) text diff --git a/ruamoko/lib/Point.r b/ruamoko/lib/Point.r index 1818eda1c..0a43333af 100644 --- a/ruamoko/lib/Point.r +++ b/ruamoko/lib/Point.r @@ -33,12 +33,12 @@ return [myCopy initWithComponents: x : y]; } -- (id) x +- (integer) x { return x; } -- (id) y +- (integer) y { return y; } diff --git a/ruamoko/lib/Size.r b/ruamoko/lib/Size.r index e76b26fef..e8d1da2f7 100644 --- a/ruamoko/lib/Size.r +++ b/ruamoko/lib/Size.r @@ -33,12 +33,12 @@ return [myCopy initWithComponents: width : height]; } -- (id) width +- (integer) width { return width; } -- (id) height +- (integer) height { return height; } diff --git a/tools/qfcc/source/class.c b/tools/qfcc/source/class.c index 185f867c5..274d7a514 100644 --- a/tools/qfcc/source/class.c +++ b/tools/qfcc/source/class.c @@ -403,8 +403,11 @@ class_find_method (class_type_t *class_type, method_t *method) class_name = class_type->c.class->name; } 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; + } sel = dstring_newstr (); selector_name (sel, (keywordarg_t *)method->selector); warning (0, "%s method %s not in %s%s",