diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-02-28 13:49:45 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-03-01 11:19:11 +0100 |
commit | 12d156566af84ec834abb7e18feac6e8f5884451 (patch) | |
tree | 53dc6f2d0af871c54c32ff851a3005c7ae1cecf5 /gcc/rust/resolve/rust-ast-resolve-base.h | |
parent | bf92a1012264f2544e73a7a8dd0ac1e473c7f658 (diff) | |
download | gcc-12d156566af84ec834abb7e18feac6e8f5884451.zip gcc-12d156566af84ec834abb7e18feac6e8f5884451.tar.gz gcc-12d156566af84ec834abb7e18feac6e8f5884451.tar.bz2 |
parser: Allow parsing macro invocations as statements
When parsing a macro invocation as a statement, the parser would parse
an expression and then try parsing a semicolon. Since no actual
lookahead was done (which is a good thing), we couldn't convert a
`MacroInvocation` to a `MacroInvocationSemi` after the fact.
Since, unlike function calls, macro invocations can act differently
based on whether or not they are followed by a semicolon, we actually
need to differentiate between the two up until expansion.
This commits adds a new virtual method for ExprWithoutBlock when
converting to ExprStmtWithoutBlock so that classes inheriting
ExprWithoutBlock can specify a new behavior. In the case of our
MacroInvocation class, it simply means toggling a boolean: If we're
converting a macro from an expression to a statement, it must mean that
it should contain a semicolon.
Diffstat (limited to 'gcc/rust/resolve/rust-ast-resolve-base.h')
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve-base.h | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-base.h b/gcc/rust/resolve/rust-ast-resolve-base.h index 6ee5f3d..eca9694 100644 --- a/gcc/rust/resolve/rust-ast-resolve-base.h +++ b/gcc/rust/resolve/rust-ast-resolve-base.h @@ -38,7 +38,6 @@ public: void visit (AST::IdentifierExpr &) {} void visit (AST::Lifetime &) {} void visit (AST::LifetimeParam &) {} - void visit (AST::MacroInvocationSemi &) {} void visit (AST::PathInExpression &) {} void visit (AST::TypePathSegment &) {} void visit (AST::TypePathSegmentGeneric &) {} |