This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Go patch committed: Fix invalid signature in function literal


This patch to the Go frontend fixes the way we handle an invalid
signature for a function literal.  Rather than trying to parse the block
without creating a function, which fails if there is a return statement,
we instead just create a dummy function type.  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 70dbc32f9149 go/parse.cc
--- a/go/parse.cc	Wed Dec 15 14:30:06 2010 -0800
+++ b/go/parse.cc	Wed Dec 15 14:38:25 2010 -0800
@@ -2513,10 +2513,7 @@
 
   Function_type* type = this->signature(NULL, location);
   if (type == NULL)
-    {
-      this->block();
-      return Expression::make_error(location);
-    }
+    type = Type::make_function_type(NULL, NULL, NULL, location);
 
   // For a function literal, the next token must be a '{'.  If we
   // don't see that, then we may have a type expression.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]