libsolidity: Introducing TypeProvider API, for clear type system ownership.

This commit is contained in:
Christian Parpart
2019-04-16 18:26:45 +02:00
committed by chriseth
parent 862d798047
commit bf43eebea9
38 changed files with 1489 additions and 837 deletions
+5 -4
View File
@@ -848,8 +848,9 @@ private:
class MagicVariableDeclaration: public Declaration
{
public:
MagicVariableDeclaration(ASTString const& _name, std::shared_ptr<Type const> const& _type):
MagicVariableDeclaration(ASTString const& _name, Type const* _type):
Declaration(SourceLocation(), std::make_shared<ASTString>(_name)), m_type(_type) {}
void accept(ASTVisitor&) override
{
solAssert(false, "MagicVariableDeclaration used inside real AST.");
@@ -859,15 +860,15 @@ public:
solAssert(false, "MagicVariableDeclaration used inside real AST.");
}
FunctionTypePointer functionType(bool) const override
FunctionType const* functionType(bool) const override
{
solAssert(m_type->category() == Type::Category::Function, "");
return std::dynamic_pointer_cast<FunctionType const>(m_type);
return dynamic_cast<FunctionType const*>(m_type);
}
TypePointer type() const override { return m_type; }
private:
std::shared_ptr<Type const> m_type;
Type const* m_type;
};
/// Types