]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: resolve: Add ResolveExpr::funny_error
authorSergey Bugaev <bugaevc@gmail.com>
Mon, 3 Apr 2023 15:51:58 +0000 (18:51 +0300)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:34:09 +0000 (18:34 +0100)
...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 <bugaevc@gmail.com>
gcc/rust/resolve/rust-ast-resolve-expr.cc
gcc/rust/resolve/rust-ast-resolve-expr.h

index 41ce9c9d0fe19c81a056b72167ef04930c1e0b6c..e5ee976213422780b02ee90080af3466c16b710a 100644 (file)
@@ -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 &param,
 }
 
 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
index 896617cc7ff5f31f8ea5b143eff9d9a428d90dce..86ae70ffbd8414e9f51ee91765079f2151bcf168 100644 (file)
@@ -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