From 62492b67e783dd19c67850e2b8ae107aeeb83217 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 19 Oct 2016 16:39:16 +0200 Subject: [PATCH] Changelog entry and small fixes. --- Changelog.md | 1 + libsolidity/ast/ASTJsonConverter.cpp | 5 +++++ libsolidity/ast/Types.cpp | 8 +++----- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Changelog.md b/Changelog.md index a392ec013..ce3343d8c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,7 @@ ### 0.4.5 (unreleased) Features: + * Function types * Do-while loops: support for a C-style do{}while(); control structure * Inline assembly: support ``invalidJumpLabel`` as a jump label. * Type checker: now more eagerly searches for a common type of an inline array with mixed types diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index 717a80ee1..d6aca175a 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -228,8 +228,13 @@ bool ASTJsonConverter::visit(UserDefinedTypeName const& _node) bool ASTJsonConverter::visit(FunctionTypeName const& _node) { + string visibility = "internal"; + if (_node.visibility() == Declaration::Visibility::External) + visibility = "external"; + addJsonNode(_node, "FunctionTypeName", { make_pair("payable", _node.isPayable()), + make_pair("visibility", visibility), make_pair("constant", _node.isDeclaredConst()) }); return true; diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 3afbee138..15747a8b2 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -2077,12 +2077,10 @@ TypePointer FunctionType::encodingType() const TypePointer FunctionType::interfaceType(bool /*_inLibrary*/) const { - if (m_location != Location::External && m_location != Location::Internal) - return TypePointer(); - if (m_location != Location::External) - return TypePointer(); - else + if (m_location == Location::External) return make_shared(8 * storageBytes()); + else + return TypePointer(); } bool FunctionType::canTakeArguments(TypePointers const& _argumentTypes, TypePointer const& _selfType) const