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) | ||||
| 
 | ||||
| typedef struct { | ||||
|   char type[sNAMEMAX + 1]; | ||||
| 
 | ||||
|   // Array information.
 | ||||
|   int numdim; | ||||
|   int dim[sDIMEN_MAX]; | ||||
| @ -540,6 +538,7 @@ constvalue *pc_tagptr(const char *name); | ||||
| int pc_enablewarning(int number,int enable); | ||||
| const char *pc_tagname(int tag); | ||||
| 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) | ||||
|  | ||||
| @ -1262,7 +1262,7 @@ static void setconfig(char *root) | ||||
| static void setcaption(void) | ||||
| { | ||||
|   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) | ||||
| @ -3281,27 +3281,22 @@ static int parse_new_typeexpr(typeinfo_t *type, const token_t *first, int flags) | ||||
| 
 | ||||
|   switch (tok.id) { | ||||
|     case tINT: | ||||
|       strcpy(type->type, "int"); | ||||
|       type->tag = 0; | ||||
|       break; | ||||
|     case tCHAR: | ||||
|       strcpy(type->type, "char"); | ||||
|       type->tag = pc_tag_string; | ||||
|       break; | ||||
|     case tVOID: | ||||
|       strcpy(type->type, "void"); | ||||
|       type->tag = pc_tag_void; | ||||
|       break; | ||||
|     case tOBJECT: | ||||
|       strcpy(type->type, "object"); | ||||
|       type->tag = pc_tag_object; | ||||
|       break; | ||||
|     case tSYMBOL: | ||||
|       strcpy(type->type, tok.str); | ||||
|       if (strcmp(type->type, "float") == 0) { | ||||
|       if (strcmp(tok.str, "float") == 0) { | ||||
|         type->tag = sc_rationaltag; | ||||
|       } else { | ||||
|         type->tag = pc_findtag(type->type); | ||||
|         type->tag = pc_findtag(tok.str); | ||||
|         if (type->tag == sc_rationaltag) { | ||||
|           error(98, "Float", "float"); | ||||
|         } 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) { | ||||
|           error(98, "_", "int"); | ||||
|         } else if (type->tag == -1) { | ||||
|           error(139, type->type); | ||||
|           error(139, tok.str); | ||||
|           type->tag = 0; | ||||
|         } else { | ||||
|           // Perform some basic filters so we can start narrowing down what can
 | ||||
|           // be used as a type.
 | ||||
|           if (!(type->tag & TAGTYPEMASK)) | ||||
|             error(139, type->type); | ||||
|             error(139, tok.str); | ||||
|         } | ||||
|       } | ||||
|       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.
 | ||||
|   if (type->tag != target->tag) { | ||||
|     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)) { | ||||
|  | ||||
| @ -314,6 +314,24 @@ SC_FUNC int checktag_string(value *sym1, value *sym2) | ||||
|   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) | ||||
| { | ||||
|   if (ident == iARRAY || ident == iREFARRAY) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user