mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Limit number of secondary source locations.
This commit is contained in:
parent
eebeb52aed
commit
2d171c25e5
@ -171,13 +171,7 @@ void TypeChecker::checkContractDuplicateFunctions(ContractDefinition const& _con
|
|||||||
ssl.append("Another declaration is here:", (*it)->location());
|
ssl.append("Another declaration is here:", (*it)->location());
|
||||||
|
|
||||||
string msg = "More than one constructor defined.";
|
string msg = "More than one constructor defined.";
|
||||||
size_t occurrences = ssl.infos.size();
|
ssl.limitSize(msg);
|
||||||
if (occurrences > 32)
|
|
||||||
{
|
|
||||||
ssl.infos.resize(32);
|
|
||||||
msg += " Truncated from " + boost::lexical_cast<string>(occurrences) + " to the first 32 occurrences.";
|
|
||||||
}
|
|
||||||
|
|
||||||
m_errorReporter.declarationError(
|
m_errorReporter.declarationError(
|
||||||
functions[_contract.name()].front()->location(),
|
functions[_contract.name()].front()->location(),
|
||||||
ssl,
|
ssl,
|
||||||
@ -219,12 +213,7 @@ void TypeChecker::findDuplicateDefinitions(map<string, vector<T>> const& _defini
|
|||||||
|
|
||||||
if (ssl.infos.size() > 0)
|
if (ssl.infos.size() > 0)
|
||||||
{
|
{
|
||||||
size_t occurrences = ssl.infos.size();
|
ssl.limitSize(_message);
|
||||||
if (occurrences > 32)
|
|
||||||
{
|
|
||||||
ssl.infos.resize(32);
|
|
||||||
_message += " Truncated from " + boost::lexical_cast<string>(occurrences) + " to the first 32 occurrences.";
|
|
||||||
}
|
|
||||||
|
|
||||||
m_errorReporter.declarationError(
|
m_errorReporter.declarationError(
|
||||||
overloads[i]->location(),
|
overloads[i]->location(),
|
||||||
@ -1679,10 +1668,12 @@ void TypeChecker::endVisit(NewExpression const& _newExpression)
|
|||||||
SecondarySourceLocation ssl;
|
SecondarySourceLocation ssl;
|
||||||
for (auto function: contract->annotation().unimplementedFunctions)
|
for (auto function: contract->annotation().unimplementedFunctions)
|
||||||
ssl.append("Missing implementation:", function->location());
|
ssl.append("Missing implementation:", function->location());
|
||||||
|
string msg = "Trying to create an instance of an abstract contract.";
|
||||||
|
ssl.limitSize(msg);
|
||||||
m_errorReporter.typeError(
|
m_errorReporter.typeError(
|
||||||
_newExpression.location(),
|
_newExpression.location(),
|
||||||
ssl,
|
ssl,
|
||||||
"Trying to create an instance of an abstract contract."
|
msg
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!contract->constructorIsPublic())
|
if (!contract->constructorIsPublic())
|
||||||
|
@ -109,6 +109,18 @@ public:
|
|||||||
infos.push_back(std::make_pair(_errMsg, _sourceLocation));
|
infos.push_back(std::make_pair(_errMsg, _sourceLocation));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
/// Limits the number of secondary source locations to 32 and appends a notice to the
|
||||||
|
/// error message.
|
||||||
|
void limitSize(std::string& _message)
|
||||||
|
{
|
||||||
|
size_t occurrences = infos.size();
|
||||||
|
if (occurrences > 32)
|
||||||
|
{
|
||||||
|
infos.resize(32);
|
||||||
|
_message += " Truncated from " + boost::lexical_cast<std::string>(occurrences) + " to the first 32 occurrences.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<errorSourceLocationInfo> infos;
|
std::vector<errorSourceLocationInfo> infos;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user