Change parameters to language_defn::post_parser

In the expression rewrite, Ada type resolution will be done at parse
time rather than in a post-parse pass.  At this point,
language_defn::post_parser will be removed.  However, for this to
work, the information available to post_parser must be made available
during the actual parse.

This patch refactors this code slightly to make this possible.  In
particular, "void_context_p" is passed to the parser_state
constructor, and the parser state is then passed to the post_parser
method.

gdb/ChangeLog
2020-12-16  Tom Tromey  <tom@tromey.com>

	* rust-exp.y (rust_lex_tests): Update.
	* parser-defs.h (parser_state): Add void_p parameter.
	<void_context_p>: New member.
	* parse.c (parse_exp_in_context): Update.
	* language.h (language_defn::post_parser): Remove void_context_p,
	completing, tracker parameters.  Add parser state.
	* ada-lang.c (ada_language::post_parser): Update.
This commit is contained in:
Tom Tromey
2020-12-16 15:49:40 -07:00
parent f81baa0863
commit c5c412054e
6 changed files with 28 additions and 16 deletions

View File

@ -14124,16 +14124,17 @@ public:
A null CONTEXT_TYPE indicates that a non-void return type is
preferred. May change (expand) *EXP. */
void post_parser (expression_up *expp, bool void_context_p, int completing,
innermost_block_tracker *tracker) const override
void post_parser (expression_up *expp, struct parser_state *ps)
const override
{
struct type *context_type = NULL;
int pc = 0;
if (void_context_p)
if (ps->void_context_p)
context_type = builtin_type ((*expp)->gdbarch)->builtin_void;
resolve_subexp (expp, &pc, 1, context_type, completing, tracker);
resolve_subexp (expp, &pc, 1, context_type, ps->parse_completion,
ps->block_tracker);
}
/* See language.h. */