aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/AST.cpp25
-rw-r--r--libsolidity/CompilerStack.cpp4
-rw-r--r--libsolidity/NameAndTypeResolver.cpp10
-rw-r--r--libsolidity/Parser.cpp8
-rw-r--r--libsolidity/TypeChecker.cpp2
5 files changed, 26 insertions, 23 deletions
diff --git a/libsolidity/AST.cpp b/libsolidity/AST.cpp
index f184e037..062febb9 100644
--- a/libsolidity/AST.cpp
+++ b/libsolidity/AST.cpp
@@ -115,29 +115,26 @@ vector<pair<FixedHash<4>, FunctionTypePointer>> const& ContractDefinition::inter
m_interfaceFunctionList.reset(new vector<pair<FixedHash<4>, FunctionTypePointer>>());
for (ContractDefinition const* contract: annotation().linearizedBaseContracts)
{
+ vector<FunctionTypePointer> functions;
for (ASTPointer<FunctionDefinition> const& f: contract->definedFunctions())
+ if (f->isPartOfExternalInterface())
+ functions.push_back(make_shared<FunctionType>(*f, false));
+ for (ASTPointer<VariableDeclaration> const& v: contract->stateVariables())
+ if (v->isPartOfExternalInterface())
+ functions.push_back(make_shared<FunctionType>(*v));
+ for (FunctionTypePointer const& fun: functions)
{
- if (!f->isPartOfExternalInterface())
+ if (!fun->interfaceFunctionType())
+ // Fails hopefully because we already registered the error
continue;
- string functionSignature = f->externalSignature();
+ string functionSignature = fun->externalSignature();
if (signaturesSeen.count(functionSignature) == 0)
{
- functionsSeen.insert(f->name());
signaturesSeen.insert(functionSignature);
FixedHash<4> hash(dev::sha3(functionSignature));
- m_interfaceFunctionList->push_back(make_pair(hash, make_shared<FunctionType>(*f, false)));
+ m_interfaceFunctionList->push_back(make_pair(hash, fun));
}
}
-
- for (ASTPointer<VariableDeclaration> const& v: contract->stateVariables())
- if (functionsSeen.count(v->name()) == 0 && v->isPartOfExternalInterface())
- {
- FunctionType ftype(*v);
- solAssert(!!v->annotation().type.get(), "");
- functionsSeen.insert(v->name());
- FixedHash<4> hash(dev::sha3(ftype.externalSignature()));
- m_interfaceFunctionList->push_back(make_pair(hash, make_shared<FunctionType>(*v)));
- }
}
}
return *m_interfaceFunctionList;
diff --git a/libsolidity/CompilerStack.cpp b/libsolidity/CompilerStack.cpp
index 12e49b58..03120f66 100644
--- a/libsolidity/CompilerStack.cpp
+++ b/libsolidity/CompilerStack.cpp
@@ -104,7 +104,9 @@ bool CompilerStack::parse()
for (auto& sourcePair: m_sources)
{
sourcePair.second.scanner->reset();
- sourcePair.second.ast = Parser(m_errors).parse(sourcePair.second.scanner); // todo check for errors
+ sourcePair.second.ast = Parser(m_errors).parse(sourcePair.second.scanner);
+ if (!sourcePair.second.ast)
+ solAssert(!Error::containsOnlyWarnings(m_errors), "Parser returned null but did not report error.");
}
if (!Error::containsOnlyWarnings(m_errors))
// errors while parsing. sould stop before type checking
diff --git a/libsolidity/NameAndTypeResolver.cpp b/libsolidity/NameAndTypeResolver.cpp
index abf0788a..edd0704d 100644
--- a/libsolidity/NameAndTypeResolver.cpp
+++ b/libsolidity/NameAndTypeResolver.cpp
@@ -49,8 +49,10 @@ bool NameAndTypeResolver::registerDeclarations(SourceUnit& _sourceUnit)
{
DeclarationRegistrationHelper registrar(m_scopes, _sourceUnit, m_errors);
}
- catch (FatalError)
+ catch (FatalError const& _e)
{
+ if (m_errors.empty())
+ throw; // Something is weird here, rather throw again.
return false;
}
return true;
@@ -124,6 +126,8 @@ bool NameAndTypeResolver::resolveNamesAndTypes(ContractDefinition& _contract)
}
catch (FatalError const& _e)
{
+ if (m_errors.empty())
+ throw; // Something is weird here, rather throw again.
return false;
}
return true;
@@ -136,8 +140,10 @@ bool NameAndTypeResolver::updateDeclaration(Declaration const& _declaration)
m_scopes[nullptr].registerDeclaration(_declaration, false, true);
solAssert(_declaration.scope() == nullptr, "Updated declaration outside global scope.");
}
- catch(FatalError const& _error)
+ catch (FatalError const& _error)
{
+ if (m_errors.empty())
+ throw; // Something is weird here, rather throw again.
return false;
}
return true;
diff --git a/libsolidity/Parser.cpp b/libsolidity/Parser.cpp
index 1bb16b84..f7e17b42 100644
--- a/libsolidity/Parser.cpp
+++ b/libsolidity/Parser.cpp
@@ -88,12 +88,10 @@ ASTPointer<SourceUnit> Parser::parse(shared_ptr<Scanner> const& _scanner)
}
return nodeFactory.createNode<SourceUnit>(nodes);
}
- catch(FatalError const& _error)
- {
- return nullptr;
- }
- catch(Exception const& _e)
+ catch (FatalError const& _error)
{
+ if (m_errors.empty())
+ throw; // Something is weird here, rather throw again.
return nullptr;
}
}
diff --git a/libsolidity/TypeChecker.cpp b/libsolidity/TypeChecker.cpp
index dcaecdfb..5ea5825d 100644
--- a/libsolidity/TypeChecker.cpp
+++ b/libsolidity/TypeChecker.cpp
@@ -43,7 +43,7 @@ bool TypeChecker::checkTypeRequirements(const ContractDefinition& _contract)
if (m_errors.empty())
throw; // Something is weird here, rather throw again.
}
- return Error::containsOnlyWarnings(m_errors);
+ return Error::containsOnlyWarnings(m_errors);
}
TypePointer const& TypeChecker::type(Expression const& _expression) const