From 613b06f6c04cc8cb3ede6e245b13a8cf8558b17c Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 30 Oct 2014 21:15:48 -0700 Subject: [PATCH] Improve error messages when we can't find a typeexpr on a method. --- sourcepawn/compiler/sc1.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sourcepawn/compiler/sc1.cpp b/sourcepawn/compiler/sc1.cpp index 5d5d8132..5f22db42 100644 --- a/sourcepawn/compiler/sc1.cpp +++ b/sourcepawn/compiler/sc1.cpp @@ -3742,6 +3742,7 @@ methodmap_method_t *parse_property(methodmap_t *map) methodmap_method_t *parse_method(methodmap_t *map) { + int maybe_ctor = 0; int is_ctor = 0; int is_dtor = 0; int is_bind = 0; @@ -3803,7 +3804,7 @@ methodmap_method_t *parse_method(methodmap_t *map) // ::= ident '(' // Push the '(' token back for declargs(). - is_ctor = TRUE; + maybe_ctor = TRUE; lexpush(); } else { // The first token of the type expression is either the symbol we @@ -3839,8 +3840,10 @@ methodmap_method_t *parse_method(methodmap_t *map) strcpy(ident.name, "~"); strcat(ident.name, map->name); check_name_length(ident.name); - } else if (is_ctor) { - if (strcmp(ident.name, map->name) != 0) + } else if (maybe_ctor) { + if (strcmp(ident.name, map->name) == 0) + is_ctor = TRUE; + else error(114, "constructor", spectype, map->name); }