aboutsummaryrefslogtreecommitdiff
path: root/gdb/rust-parse.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-01-24 18:02:38 -0700
committerTom Tromey <tom@tromey.com>2022-02-06 13:13:31 -0700
commitc1f5e54825e4ac2d64b267578fd87409e0ea901c (patch)
tree01213bc6d20465dfc76a90363288a6fc8e86f278 /gdb/rust-parse.c
parenta92613915ec2f38e1ab62ab254dde2a1ad4ad408 (diff)
downloadfsf-binutils-gdb-c1f5e54825e4ac2d64b267578fd87409e0ea901c.zip
fsf-binutils-gdb-c1f5e54825e4ac2d64b267578fd87409e0ea901c.tar.gz
fsf-binutils-gdb-c1f5e54825e4ac2d64b267578fd87409e0ea901c.tar.bz2
Fix Rust parser bug with function fields
In Rust, 'obj.f()' is a method call -- but '(obj.f)()' is a call of a function-valued field 'f' in 'obj'. The Rust parser in gdb currently gets this wrong. This is PR rust/24082. The expression and Rust parser rewrites made this simple to fix -- simply wrapping a parenthesized expression in a new operation handles it. This patch has a slight hack because I didn't want to introduce a new exp_opcode enumeration constant just for this. IMO this doesn't matter, since we should work toward removing dependencies on these opcodes anyway; but let me know what you think of this. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24082
Diffstat (limited to 'gdb/rust-parse.c')
-rw-r--r--gdb/rust-parse.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/rust-parse.c b/gdb/rust-parse.c
index 31a1ee3..894f2e7 100644
--- a/gdb/rust-parse.c
+++ b/gdb/rust-parse.c
@@ -1105,7 +1105,7 @@ rust_parser::parse_tuple ()
{
/* Parenthesized expression. */
lex ();
- return expr;
+ return make_operation<rust_parenthesized_operation> (std::move (expr));
}
std::vector<operation_up> ops;