diff options
Diffstat (limited to 'gdb/f-exp.y')
-rw-r--r-- | gdb/f-exp.y | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/gdb/f-exp.y b/gdb/f-exp.y index 567cd005acb..a7e59df7aea 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -1175,21 +1175,30 @@ yylex (void) char *tmp = copy_name (yylval.sval); struct symbol *sym; struct field_of_this_result is_a_field_of_this; + enum domain_enum_tag lookup_domains[] = {STRUCT_DOMAIN, VAR_DOMAIN}; + int i; int hextype; - - /* Initialize this in case we *don't* use it in this call; that - way we can refer to it unconditionally below. */ - memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this)); - - sym = lookup_symbol (tmp, expression_context_block, - VAR_DOMAIN, - parse_language->la_language == language_cplus - ? &is_a_field_of_this : NULL); - if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF) + + for (i = 0; i < ARRAY_SIZE (lookup_domains); ++i) { - yylval.tsym.type = SYMBOL_TYPE (sym); - return TYPENAME; + /* Initialize this in case we *don't* use it in this call; that + way we can refer to it unconditionally below. */ + memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this)); + + sym = lookup_symbol (tmp, expression_context_block, + lookup_domains[i], + parse_language->la_language == language_cplus + ? &is_a_field_of_this : NULL); + if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF) + { + yylval.tsym.type = SYMBOL_TYPE (sym); + return TYPENAME; + } + + if (sym) + break; } + yylval.tsym.type = language_lookup_primitive_type_by_name (parse_language, parse_gdbarch, tmp); |