summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
10e77e3)
Fixes issue 8436.
From-SVN: r216420
Typed_identifier_list til;
til.push_back(Typed_identifier(name, NULL, location));
Typed_identifier_list til;
til.push_back(Typed_identifier(name, NULL, location));
+ std::set<std::string> uniq_idents;
+ uniq_idents.insert(name);
+
// We've seen one identifier. If we see a comma now, this could be
// "a, *p = 1, 2".
if (this->peek_token()->is_op(OPERATOR_COMMA))
// We've seen one identifier. If we see a comma now, this could be
// "a, *p = 1, 2".
if (this->peek_token()->is_op(OPERATOR_COMMA))
std::string id = token->identifier();
bool is_id_exported = token->is_identifier_exported();
Location id_location = token->location();
std::string id = token->identifier();
bool is_id_exported = token->is_identifier_exported();
Location id_location = token->location();
+ std::pair<std::set<std::string>::iterator, bool> ins;
token = this->advance_token();
if (!token->is_op(OPERATOR_COMMA))
token = this->advance_token();
if (!token->is_op(OPERATOR_COMMA))
if (token->is_op(OPERATOR_COLONEQ))
{
id = this->gogo_->pack_hidden_name(id, is_id_exported);
if (token->is_op(OPERATOR_COLONEQ))
{
id = this->gogo_->pack_hidden_name(id, is_id_exported);
+ ins = uniq_idents.insert(id);
+ if (!ins.second && !Gogo::is_sink_name(id))
+ error_at(id_location, "multiple assignments to %s",
+ Gogo::message_name(id).c_str());
til.push_back(Typed_identifier(id, NULL, location));
}
else
til.push_back(Typed_identifier(id, NULL, location));
}
else
}
id = this->gogo_->pack_hidden_name(id, is_id_exported);
}
id = this->gogo_->pack_hidden_name(id, is_id_exported);
+ ins = uniq_idents.insert(id);
+ if (!ins.second && !Gogo::is_sink_name(id))
+ error_at(id_location, "multiple assignments to %s",
+ Gogo::message_name(id).c_str());
til.push_back(Typed_identifier(id, NULL, location));
}
til.push_back(Typed_identifier(id, NULL, location));
}