mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Make FunctionCallAnnotation::kind a SetOnce
This commit is contained in:
@@ -27,6 +27,8 @@
|
||||
#include <libsolidity/ast/ASTEnums.h>
|
||||
#include <libsolidity/ast/ExperimentalFeatures.h>
|
||||
|
||||
#include <libsolutil/SetOnce.h>
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
@@ -285,7 +287,6 @@ struct BinaryOperationAnnotation: ExpressionAnnotation
|
||||
|
||||
enum class FunctionCallKind
|
||||
{
|
||||
Unset,
|
||||
FunctionCall,
|
||||
TypeConversion,
|
||||
StructConstructorCall
|
||||
@@ -293,7 +294,7 @@ enum class FunctionCallKind
|
||||
|
||||
struct FunctionCallAnnotation: ExpressionAnnotation
|
||||
{
|
||||
FunctionCallKind kind = FunctionCallKind::Unset;
|
||||
util::SetOnce<FunctionCallKind> kind;
|
||||
/// If true, this is the external call of a try statement.
|
||||
bool tryCall = false;
|
||||
};
|
||||
|
||||
@@ -726,13 +726,16 @@ bool ASTJsonConverter::visit(FunctionCall const& _node)
|
||||
make_pair("arguments", toJson(_node.arguments())),
|
||||
make_pair("tryCall", _node.annotation().tryCall)
|
||||
};
|
||||
|
||||
FunctionCallKind nodeKind = *_node.annotation().kind;
|
||||
|
||||
if (m_legacy)
|
||||
{
|
||||
attributes.emplace_back("isStructConstructorCall", _node.annotation().kind == FunctionCallKind::StructConstructorCall);
|
||||
attributes.emplace_back("type_conversion", _node.annotation().kind == FunctionCallKind::TypeConversion);
|
||||
attributes.emplace_back("isStructConstructorCall", nodeKind == FunctionCallKind::StructConstructorCall);
|
||||
attributes.emplace_back("type_conversion", nodeKind == FunctionCallKind::TypeConversion);
|
||||
}
|
||||
else
|
||||
attributes.emplace_back("kind", functionCallKind(_node.annotation().kind));
|
||||
attributes.emplace_back("kind", functionCallKind(nodeKind));
|
||||
appendExpressionAttributes(attributes, _node.annotation());
|
||||
setJsonNode(_node, "FunctionCall", std::move(attributes));
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user