aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/parse.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/go/gofrontend/parse.cc')
-rw-r--r--gcc/go/gofrontend/parse.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc
index e68f175..498125b 100644
--- a/gcc/go/gofrontend/parse.cc
+++ b/gcc/go/gofrontend/parse.cc
@@ -2690,15 +2690,17 @@ Parse::composite_lit(Type* type, int depth, Location location)
{
this->advance_token();
return Expression::make_composite_literal(type, depth, false, NULL,
- location);
+ false, location);
}
bool has_keys = false;
+ bool all_are_names = true;
Expression_list* vals = new Expression_list;
while (true)
{
Expression* val;
bool is_type_omitted = false;
+ bool is_name = false;
const Token* token = this->peek_token();
@@ -2719,6 +2721,7 @@ Parse::composite_lit(Type* type, int depth, Location location)
val = this->id_to_expression(gogo->pack_hidden_name(identifier,
is_exported),
location);
+ is_name = true;
}
else
{
@@ -2744,6 +2747,7 @@ Parse::composite_lit(Type* type, int depth, Location location)
{
if (has_keys)
vals->push_back(NULL);
+ is_name = false;
}
else
{
@@ -2790,6 +2794,9 @@ Parse::composite_lit(Type* type, int depth, Location location)
vals->push_back(val);
+ if (!is_name)
+ all_are_names = false;
+
if (token->is_op(OPERATOR_COMMA))
{
if (this->advance_token()->is_op(OPERATOR_RCURLY))
@@ -2830,7 +2837,7 @@ Parse::composite_lit(Type* type, int depth, Location location)
}
return Expression::make_composite_literal(type, depth, has_keys, vals,
- location);
+ all_are_names, location);
}
// FunctionLit = "func" Signature Block .