diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-03-28 21:50:53 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-03-28 21:50:53 +0000 |
commit | f9fc495911f333c79db7c2cfefe575e9fee920ad (patch) | |
tree | 6484f306c67c9b1a666fa34e6b2451a3c076d657 /gcc | |
parent | e45f44f3cf34d67b97e6a4240a912109d4a7038c (diff) | |
download | gcc-f9fc495911f333c79db7c2cfefe575e9fee920ad.zip gcc-f9fc495911f333c79db7c2cfefe575e9fee920ad.tar.gz gcc-f9fc495911f333c79db7c2cfefe575e9fee920ad.tar.bz2 |
Better error messages for missing channel element type.
From-SVN: r171634
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/go/gofrontend/parse.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index 76dd9d0..3f783b1 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -656,6 +656,23 @@ Parse::channel_type() this->advance_token(); } } + + // Better error messages for the common error of omitting the + // channel element type. + if (!this->type_may_start_here()) + { + token = this->peek_token(); + if (token->is_op(OPERATOR_RCURLY)) + error_at(this->location(), "unexpected %<}%> in channel type"); + else if (token->is_op(OPERATOR_RPAREN)) + error_at(this->location(), "unexpected %<)%> in channel type"); + else if (token->is_op(OPERATOR_COMMA)) + error_at(this->location(), "unexpected comma in channel type"); + else + error_at(this->location(), "expected channel element type"); + return Type::make_error_type(); + } + Type* element_type = this->type(); return Type::make_channel_type(send, receive, element_type); } |