Remove typeinfo_t::type.
This commit is contained in:
parent
153bbba641
commit
86cd906371
@ -267,8 +267,6 @@ typedef struct svalue_s {
|
|||||||
#define TYPEMASK_NAMED_DECL (TYPEFLAG_ARGUMENT | TYPEFLAG_VARIABLE)
|
#define TYPEMASK_NAMED_DECL (TYPEFLAG_ARGUMENT | TYPEFLAG_VARIABLE)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char type[sNAMEMAX + 1];
|
|
||||||
|
|
||||||
// Array information.
|
// Array information.
|
||||||
int numdim;
|
int numdim;
|
||||||
int dim[sDIMEN_MAX];
|
int dim[sDIMEN_MAX];
|
||||||
@ -540,6 +538,7 @@ constvalue *pc_tagptr(const char *name);
|
|||||||
int pc_enablewarning(int number,int enable);
|
int pc_enablewarning(int number,int enable);
|
||||||
const char *pc_tagname(int tag);
|
const char *pc_tagname(int tag);
|
||||||
int parse_decl(declinfo_t *decl, int flags);
|
int parse_decl(declinfo_t *decl, int flags);
|
||||||
|
const char *type_to_name(int tag);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Functions called from the compiler (to be implemented by you)
|
* Functions called from the compiler (to be implemented by you)
|
||||||
|
@ -1262,7 +1262,7 @@ static void setconfig(char *root)
|
|||||||
static void setcaption(void)
|
static void setcaption(void)
|
||||||
{
|
{
|
||||||
pc_printf("SourcePawn Compiler %s\n", SOURCEMOD_VERSION);
|
pc_printf("SourcePawn Compiler %s\n", SOURCEMOD_VERSION);
|
||||||
pc_printf("Copyright (c) 1997-2006, ITB CompuPhase, (C)2004-2008 AlliedModders, LLC\n\n");
|
pc_printf("Copyright (c) 1997-2006, ITB CompuPhase, (C)2004-2014 AlliedModders, LLC\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void about(void)
|
static void about(void)
|
||||||
@ -3281,27 +3281,22 @@ static int parse_new_typeexpr(typeinfo_t *type, const token_t *first, int flags)
|
|||||||
|
|
||||||
switch (tok.id) {
|
switch (tok.id) {
|
||||||
case tINT:
|
case tINT:
|
||||||
strcpy(type->type, "int");
|
|
||||||
type->tag = 0;
|
type->tag = 0;
|
||||||
break;
|
break;
|
||||||
case tCHAR:
|
case tCHAR:
|
||||||
strcpy(type->type, "char");
|
|
||||||
type->tag = pc_tag_string;
|
type->tag = pc_tag_string;
|
||||||
break;
|
break;
|
||||||
case tVOID:
|
case tVOID:
|
||||||
strcpy(type->type, "void");
|
|
||||||
type->tag = pc_tag_void;
|
type->tag = pc_tag_void;
|
||||||
break;
|
break;
|
||||||
case tOBJECT:
|
case tOBJECT:
|
||||||
strcpy(type->type, "object");
|
|
||||||
type->tag = pc_tag_object;
|
type->tag = pc_tag_object;
|
||||||
break;
|
break;
|
||||||
case tSYMBOL:
|
case tSYMBOL:
|
||||||
strcpy(type->type, tok.str);
|
if (strcmp(tok.str, "float") == 0) {
|
||||||
if (strcmp(type->type, "float") == 0) {
|
|
||||||
type->tag = sc_rationaltag;
|
type->tag = sc_rationaltag;
|
||||||
} else {
|
} else {
|
||||||
type->tag = pc_findtag(type->type);
|
type->tag = pc_findtag(tok.str);
|
||||||
if (type->tag == sc_rationaltag) {
|
if (type->tag == sc_rationaltag) {
|
||||||
error(98, "Float", "float");
|
error(98, "Float", "float");
|
||||||
} else if (type->tag == pc_tag_string) {
|
} else if (type->tag == pc_tag_string) {
|
||||||
@ -3309,13 +3304,13 @@ static int parse_new_typeexpr(typeinfo_t *type, const token_t *first, int flags)
|
|||||||
} else if (type->tag == 0) {
|
} else if (type->tag == 0) {
|
||||||
error(98, "_", "int");
|
error(98, "_", "int");
|
||||||
} else if (type->tag == -1) {
|
} else if (type->tag == -1) {
|
||||||
error(139, type->type);
|
error(139, tok.str);
|
||||||
type->tag = 0;
|
type->tag = 0;
|
||||||
} else {
|
} else {
|
||||||
// Perform some basic filters so we can start narrowing down what can
|
// Perform some basic filters so we can start narrowing down what can
|
||||||
// be used as a type.
|
// be used as a type.
|
||||||
if (!(type->tag & TAGTYPEMASK))
|
if (!(type->tag & TAGTYPEMASK))
|
||||||
error(139, type->type);
|
error(139, tok.str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3763,7 +3758,7 @@ int parse_property_accessor(const typeinfo_t *type, methodmap_t *map, methodmap_
|
|||||||
// Must return the same tag as the property.
|
// Must return the same tag as the property.
|
||||||
if (type->tag != target->tag) {
|
if (type->tag != target->tag) {
|
||||||
const char *kind = getter ? "getter" : "setter";
|
const char *kind = getter ? "getter" : "setter";
|
||||||
error(128, "getter", map->name, type->type);
|
error(128, "getter", map->name, type_to_name(type->tag));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!check_this_tag(map, target)) {
|
if (!check_this_tag(map, target)) {
|
||||||
|
@ -314,6 +314,24 @@ SC_FUNC int checktag_string(value *sym1, value *sym2)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SC_FUNC const char *type_to_name(int tag)
|
||||||
|
{
|
||||||
|
if (tag == 0)
|
||||||
|
return "int";
|
||||||
|
if (tag == sc_rationaltag)
|
||||||
|
return "float";
|
||||||
|
if (tag == pc_tag_string)
|
||||||
|
return "char";
|
||||||
|
|
||||||
|
const char *name = pc_tagname(tag);
|
||||||
|
if (name)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (tag & FUNCTAG)
|
||||||
|
return "function";
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
|
||||||
SC_FUNC int matchtag_string(int ident, int tag)
|
SC_FUNC int matchtag_string(int ident, int tag)
|
||||||
{
|
{
|
||||||
if (ident == iARRAY || ident == iREFARRAY)
|
if (ident == iARRAY || ident == iREFARRAY)
|
||||||
|
Loading…
Reference in New Issue
Block a user