From: Sergey Bugaev Date: Mon, 3 Apr 2023 15:51:58 +0000 (+0300) Subject: gccrs: resolve: Add ResolveExpr::funny_error X-Git-Tag: basepoints/gcc-15~2659 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5138ddc3d652b66d3292c1543c34752e9ed78fc6;p=thirdparty%2Fgcc.git gccrs: resolve: Add ResolveExpr::funny_error ...and thread it through the constructors and the ResolveExpr::go () method. This will be used for implementing the "break rust" Easter egg. gcc/rust/ChangeLog: * resolve/rust-ast-resolve-expr.h, resolve/rust-ast-resolve-expr.cc: Add ResolveExpr::funny_error Signed-off-by: Sergey Bugaev --- diff --git a/gcc/rust/resolve/rust-ast-resolve-expr.cc b/gcc/rust/resolve/rust-ast-resolve-expr.cc index 41ce9c9d0fe1..e5ee97621342 100644 --- a/gcc/rust/resolve/rust-ast-resolve-expr.cc +++ b/gcc/rust/resolve/rust-ast-resolve-expr.cc @@ -29,9 +29,9 @@ namespace Resolver { void ResolveExpr::go (AST::Expr *expr, const CanonicalPath &prefix, - const CanonicalPath &canonical_prefix) + const CanonicalPath &canonical_prefix, bool funny_error) { - ResolveExpr resolver (prefix, canonical_prefix); + ResolveExpr resolver (prefix, canonical_prefix, funny_error); expr->accept_vis (resolver); } @@ -674,8 +674,10 @@ ResolveExpr::resolve_closure_param (AST::ClosureParam ¶m, } ResolveExpr::ResolveExpr (const CanonicalPath &prefix, - const CanonicalPath &canonical_prefix) - : ResolverBase (), prefix (prefix), canonical_prefix (canonical_prefix) + const CanonicalPath &canonical_prefix, + bool funny_error) + : ResolverBase (), prefix (prefix), canonical_prefix (canonical_prefix), + funny_error (funny_error) {} } // namespace Resolver diff --git a/gcc/rust/resolve/rust-ast-resolve-expr.h b/gcc/rust/resolve/rust-ast-resolve-expr.h index 896617cc7ff5..86ae70ffbd84 100644 --- a/gcc/rust/resolve/rust-ast-resolve-expr.h +++ b/gcc/rust/resolve/rust-ast-resolve-expr.h @@ -31,7 +31,8 @@ class ResolveExpr : public ResolverBase public: static void go (AST::Expr *expr, const CanonicalPath &prefix, - const CanonicalPath &canonical_prefix); + const CanonicalPath &canonical_prefix, + bool funny_error = false); void visit (AST::TupleIndexExpr &expr) override; void visit (AST::TupleExpr &expr) override; @@ -84,10 +85,11 @@ protected: private: ResolveExpr (const CanonicalPath &prefix, - const CanonicalPath &canonical_prefix); + const CanonicalPath &canonical_prefix, bool funny_error); const CanonicalPath &prefix; const CanonicalPath &canonical_prefix; + bool funny_error; }; } // namespace Resolver