# HG changeset patch # User jwe # Date 750559107 0 # Node ID abc5f0a0785f137daf3d0e2c8b07ae42b827457f # Parent 76926a2d39a69fecafb15fbca370a24b29f99465 [project @ 1993-10-14 00:38:27 by jwe] (identifier_exists): Only return non-zero if the name has a definition. diff -r 76926a2d39a6 -r abc5f0a0785f src/variables.cc --- a/src/variables.cc Wed Oct 13 20:48:27 1993 +0000 +++ b/src/variables.cc Thu Oct 14 00:38:27 1993 +0000 @@ -369,28 +369,31 @@ int identifier_exists (char *name) { - int status = 0; + symbol_record *sr = curr_sym_tab->lookup (name, 0, 0); + if (sr == (symbol_record *) NULL) + sr = global_sym_tab->lookup (name, 0, 0); - if (curr_sym_tab->lookup (name, 0, 0) != (symbol_record *) NULL - || global_sym_tab->lookup (name, 0, 0) != (symbol_record *) NULL) - status = 1; + if (sr != (symbol_record *) NULL && sr->is_variable ()) + return 1; + else if (sr != (symbol_record *) NULL && sr->is_function ()) + return 2; else { char *path = m_file_in_path (name); if (path != (char *) NULL) { delete [] path; - status = 2; + return 2; } else { struct stat buf; if (stat (name, &buf) == 0 && S_ISREG (buf.st_mode)) - status = 2; + return 2; } } - return status; + return 0; } /*