From d4157849c94e274569eff099ff97e51b440219a3 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 24 Jan 2012 17:22:40 +0000 Subject: compiler: Better handling of erroneous function signatures. From-SVN: r183479 --- gcc/go/gofrontend/expressions.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'gcc/go/gofrontend/expressions.h') diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h index efe54d1..6672b68 100644 --- a/gcc/go/gofrontend/expressions.h +++ b/gcc/go/gofrontend/expressions.h @@ -153,7 +153,7 @@ class Expression // Make a reference to an unknown name. In a correct program this // will always be lowered to a real const/var/func reference. - static Expression* + static Unknown_expression* make_unknown_reference(Named_object*, Location); // Make a constant bool expression. @@ -1554,7 +1554,8 @@ class Unknown_expression : public Parser_expression public: Unknown_expression(Named_object* named_object, Location location) : Parser_expression(EXPRESSION_UNKNOWN_REFERENCE, location), - named_object_(named_object), is_composite_literal_key_(false) + named_object_(named_object), no_error_message_(false), + is_composite_literal_key_(false) { } // The associated named object. @@ -1566,6 +1567,13 @@ class Unknown_expression : public Parser_expression const std::string& name() const; + // Call this to indicate that we should not give an error if this + // name is never defined. This is used to avoid knock-on errors + // during an erroneous parse. + void + set_no_error_message() + { this->no_error_message_ = true; } + // Note that this expression is being used as the key in a composite // literal, so it may be OK if it is not resolved. void @@ -1592,6 +1600,9 @@ class Unknown_expression : public Parser_expression private: // The unknown name. Named_object* named_object_; + // True if we should not give errors if this is undefined. This is + // used if there was a parse failure. + bool no_error_message_; // True if this is the key in a composite literal. bool is_composite_literal_key_; }; -- cgit v1.1