aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-11-23 03:39:10 +0800
committerchriseth <c@ethdev.com>2015-11-27 00:49:39 +0800
commitd71cd3aa2b235f877b7928b57c94159e2c16865c (patch)
treeb24bc90e27cdc7e8cf2a5674aa9376bef72db2aa /libsolidity/analysis
parent09b2f9acb7f5f47f53c4b56fdf0f86946551bf12 (diff)
downloaddexon-solidity-d71cd3aa2b235f877b7928b57c94159e2c16865c.tar.gz
dexon-solidity-d71cd3aa2b235f877b7928b57c94159e2c16865c.tar.zst
dexon-solidity-d71cd3aa2b235f877b7928b57c94159e2c16865c.zip
Added the `using x for y` directive.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/NameAndTypeResolver.h4
-rw-r--r--libsolidity/analysis/TypeChecker.cpp11
-rw-r--r--libsolidity/analysis/TypeChecker.h1
3 files changed, 13 insertions, 3 deletions
diff --git a/libsolidity/analysis/NameAndTypeResolver.h b/libsolidity/analysis/NameAndTypeResolver.h
index 0d9b2477..1547a274 100644
--- a/libsolidity/analysis/NameAndTypeResolver.h
+++ b/libsolidity/analysis/NameAndTypeResolver.h
@@ -160,8 +160,8 @@ private:
void fatalDeclarationError(SourceLocation _sourceLocation, std::string const& _description);
std::map<ASTNode const*, DeclarationContainer>& m_scopes;
- Declaration const* m_currentScope;
- VariableScope* m_currentFunction;
+ Declaration const* m_currentScope = nullptr;
+ VariableScope* m_currentFunction = nullptr;
ErrorList& m_errors;
};
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 1d2d0258..22fb1e96 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -356,7 +356,16 @@ void TypeChecker::endVisit(InheritanceSpecifier const& _inheritance)
" to " +
parameterTypes[i]->toString() +
" requested."
- );
+ );
+}
+
+void TypeChecker::endVisit(UsingForDirective const& _usingFor)
+{
+ ContractDefinition const* library = dynamic_cast<ContractDefinition const*>(
+ _usingFor.libraryName().annotation().referencedDeclaration
+ );
+ if (!library || !library->isLibrary())
+ typeError(_usingFor.libraryName().location(), "Library name expected.");
}
bool TypeChecker::visit(StructDefinition const& _struct)
diff --git a/libsolidity/analysis/TypeChecker.h b/libsolidity/analysis/TypeChecker.h
index 9563d4a9..7829a23d 100644
--- a/libsolidity/analysis/TypeChecker.h
+++ b/libsolidity/analysis/TypeChecker.h
@@ -76,6 +76,7 @@ private:
void checkLibraryRequirements(ContractDefinition const& _contract);
virtual void endVisit(InheritanceSpecifier const& _inheritance) override;
+ virtual void endVisit(UsingForDirective const& _usingFor) override;
virtual bool visit(StructDefinition const& _struct) override;
virtual bool visit(FunctionDefinition const& _function) override;
virtual bool visit(VariableDeclaration const& _variable) override;