diff --git a/source/compiler/sc.h b/source/compiler/sc.h index 4b9ed03..0b0cbd5 100644 --- a/source/compiler/sc.h +++ b/source/compiler/sc.h @@ -521,15 +521,24 @@ enum { /* identifier types */ estAUTOMATON, estSTATE }; -enum { /* symbol type flags */ - esfLABEL = 1 << 0, +enum { /* search types for error_suggest() when the identifier type is "estSYMBOL" */ +/* symbol type flags */ + esfLABEL = 1 << 0, /* label */ esfCONST = 1 << 1, /* named constant */ esfVARIABLE = 1 << 2, /* single variable */ esfARRAY = 1 << 3, /* array */ - esfFUNCTION = 1 << 4, /* Pawn or native function */ + esfPAWNFUNC = 1 << 4, /* Pawn function */ + esfNATIVE = 1 << 5, /* native function */ + +/* composite search types */ + /* find symbols of any type (used only to define other search types) */ + esfANY = esfLABEL | esfCONST | esfVARIABLE | esfARRAY | esfPAWNFUNC | esfNATIVE, + + /* any function */ + esfFUNCTION = esfPAWNFUNC | esfNATIVE, /* find symbols of any type but labels */ - esfNONLABEL = esfCONST | esfVARIABLE | esfARRAY | esfFUNCTION, + esfNONLABEL = esfANY & ~esfLABEL, /* find an array, a single variable, or a named constant */ esfVARCONST = esfCONST | esfVARIABLE | esfARRAY diff --git a/source/compiler/sc5.c b/source/compiler/sc5.c index c6c25bb..d528bde 100644 --- a/source/compiler/sc5.c +++ b/source/compiler/sc5.c @@ -534,7 +534,7 @@ static int find_closest_symbol_table(const char *name,const symbol *root,int sym break; case iFUNCTN: case iREFFUNC: - if ((symboltype & esfFUNCTION)==0) + if ((symboltype & (((sym->usage & uNATIVE)!=0) ? esfNATIVE : esfFUNCTION))==0) continue; break; default: