Browse Source

some more style fixes

cl-refactor
Liana Husikyan 10 years ago
parent
commit
f4b836dab3
  1. 13
      libsolidity/AST.cpp
  2. 19
      libsolidity/SourceReferenceFormatter.cpp

13
libsolidity/AST.cpp

@ -95,9 +95,10 @@ void ContractDefinition::checkTypeRequirements()
{ {
FixedHash<4> const& hash = it.first; FixedHash<4> const& hash = it.first;
if (hashes.count(hash)) if (hashes.count(hash))
BOOST_THROW_EXCEPTION(createTypeError( BOOST_THROW_EXCEPTION(
std::string("Function signature hash collision for ") + createTypeError(
it.second->externalSignature())); string("Function signature hash collision for ") + it.second->externalSignature())
);
hashes.insert(hash); hashes.insert(hash);
} }
} }
@ -311,12 +312,12 @@ void ContractDefinition::checkExternalTypeClashes() const
)); ));
} }
std::vector<ASTPointer<EventDefinition>> const& ContractDefinition::getInterfaceEvents() const vector<ASTPointer<EventDefinition>> const& ContractDefinition::getInterfaceEvents() const
{ {
if (!m_interfaceEvents) if (!m_interfaceEvents)
{ {
set<string> eventsSeen; set<string> eventsSeen;
m_interfaceEvents.reset(new std::vector<ASTPointer<EventDefinition>>()); m_interfaceEvents.reset(new vector<ASTPointer<EventDefinition>>());
for (ContractDefinition const* contract: getLinearizedBaseContracts()) for (ContractDefinition const* contract: getLinearizedBaseContracts())
for (ASTPointer<EventDefinition> const& e: contract->getEvents()) for (ASTPointer<EventDefinition> const& e: contract->getEvents())
if (eventsSeen.count(e->getName()) == 0) if (eventsSeen.count(e->getName()) == 0)
@ -956,7 +957,7 @@ void Identifier::overloadResolution(TypePointers const& _argumentTypes)
solAssert(!m_referencedDeclaration, "Referenced declaration should be null before overload resolution."); solAssert(!m_referencedDeclaration, "Referenced declaration should be null before overload resolution.");
solAssert(!m_overloadedDeclarations.empty(), "No candidates for overload resolution found."); solAssert(!m_overloadedDeclarations.empty(), "No candidates for overload resolution found.");
std::vector<Declaration const*> possibles; vector<Declaration const*> possibles;
if (m_overloadedDeclarations.size() == 1) if (m_overloadedDeclarations.size() == 1)
m_referencedDeclaration = *m_overloadedDeclarations.begin(); m_referencedDeclaration = *m_overloadedDeclarations.begin();

19
libsolidity/SourceReferenceFormatter.cpp

@ -48,11 +48,11 @@ void SourceReferenceFormatter::printSourceLocation(
{ {
string line = _scanner.getLineAtPosition(_location.start); string line = _scanner.getLineAtPosition(_location.start);
_stream << line << endl; _stream << line << endl;
std::for_each(line.cbegin(), line.cbegin() + startColumn, for_each(
[&_stream](char const& ch) line.cbegin(),
{ line.cbegin() + startColumn,
_stream << (ch == '\t' ? '\t' : ' '); [&_stream](char const& ch) { _stream << (ch == '\t' ? '\t' : ' '); }
}); );
_stream << "^"; _stream << "^";
if (endColumn > startColumn + 2) if (endColumn > startColumn + 2)
_stream << string(endColumn - startColumn - 2, '-'); _stream << string(endColumn - startColumn - 2, '-');
@ -61,9 +61,12 @@ void SourceReferenceFormatter::printSourceLocation(
_stream << endl; _stream << endl;
} }
else else
_stream << _scanner.getLineAtPosition(_location.start) << endl _stream <<
<< string(startColumn, ' ') << "^\n" _scanner.getLineAtPosition(_location.start) <<
<< "Spanning multiple lines.\n"; endl <<
string(startColumn, ' ') <<
"^\n" <<
"Spanning multiple lines.\n";
} }
void SourceReferenceFormatter::printSourceName( void SourceReferenceFormatter::printSourceName(

Loading…
Cancel
Save