From 7700f4033ec9f1f14fc798ab4f030d850c6b9db3 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 16 Aug 2017 17:03:06 +0100 Subject: [PATCH] Remove isDeclaredConst() from functions --- libsolidity/ast/AST.h | 2 -- libsolidity/ast/ASTJsonConverter.cpp | 4 ++-- libsolidity/ast/ASTPrinter.cpp | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index 8a577c0ca..53a34d32e 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -608,7 +608,6 @@ public: StateMutability stateMutability() const { return m_stateMutability; } bool isConstructor() const { return m_isConstructor; } bool isFallback() const { return name().empty(); } - bool isDeclaredConst() const { return m_stateMutability == StateMutability::View; } bool isPayable() const { return m_stateMutability == StateMutability::Payable; } std::vector> const& modifiers() const { return m_functionModifiers; } std::vector> const& returnParameters() const { return m_returnParameters->parameters(); } @@ -913,7 +912,6 @@ public: return m_visibility == Declaration::Visibility::Default ? Declaration::Visibility::Internal : m_visibility; } StateMutability stateMutability() const { return m_stateMutability; } - bool isDeclaredConst() const { return m_stateMutability == StateMutability::View; } bool isPayable() const { return m_stateMutability == StateMutability::Payable; } private: diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index ee74b1e68..3f16db232 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -323,7 +323,7 @@ bool ASTJsonConverter::visit(FunctionDefinition const& _node) { std::vector> attributes = { make_pair("name", _node.name()), - make_pair(m_legacy ? "constant" : "isDeclaredConst", _node.isDeclaredConst()), + make_pair(m_legacy ? "constant" : "isDeclaredConst", _node.stateMutability() == StateMutability::View), make_pair("payable", _node.isPayable()), make_pair("statemutability", stateMutabilityToString(_node.stateMutability())), make_pair("visibility", Declaration::visibilityToString(_node.visibility())), @@ -421,7 +421,7 @@ bool ASTJsonConverter::visit(FunctionTypeName const& _node) make_pair("payable", _node.isPayable()), make_pair("visibility", Declaration::visibilityToString(_node.visibility())), make_pair("statemutability", stateMutabilityToString(_node.stateMutability())), - make_pair(m_legacy ? "constant" : "isDeclaredConst", _node.isDeclaredConst()), + make_pair(m_legacy ? "constant" : "isDeclaredConst", _node.stateMutability() == StateMutability::View), make_pair("parameterTypes", toJson(*_node.parameterTypeList())), make_pair("returnParameterTypes", toJson(*_node.returnParameterTypeList())), make_pair("typeDescriptions", typePointerToJson(_node.annotation().type)) diff --git a/libsolidity/ast/ASTPrinter.cpp b/libsolidity/ast/ASTPrinter.cpp index 23eb3b64e..bcb5e3b9d 100644 --- a/libsolidity/ast/ASTPrinter.cpp +++ b/libsolidity/ast/ASTPrinter.cpp @@ -105,7 +105,7 @@ bool ASTPrinter::visit(FunctionDefinition const& _node) { writeLine("FunctionDefinition \"" + _node.name() + "\"" + (_node.isPublic() ? " - public" : "") + - (_node.isDeclaredConst() ? " - const" : "")); + (_node.stateMutability() == StateMutability::View ? " - const" : "")); printSourcePart(_node); return goDeeper(); }