Refactor isConstant to add "immutable".

This commit is contained in:
chriseth
2020-03-02 14:20:17 +01:00
committed by Daniel Kirchner
parent f10c6500b2
commit 1488a1ceb8
4 changed files with 17 additions and 9 deletions
+7 -1
View File
@@ -411,6 +411,12 @@ ASTPointer<VariableDeclaration> ASTJsonImporter::createVariableDeclaration(Json:
{
astAssert(_node["name"].isString(), "Expected 'name' to be a string!");
VariableDeclaration::Constantness constantness{};
if (memberAsBool(_node, "constant"))
constantness = VariableDeclaration::Constantness::Constant;
else
constantness = VariableDeclaration::Constantness::Mutable;
return createASTNode<VariableDeclaration>(
_node,
nullOrCast<TypeName>(member(_node, "typeName")),
@@ -419,7 +425,7 @@ ASTPointer<VariableDeclaration> ASTJsonImporter::createVariableDeclaration(Json:
visibility(_node),
memberAsBool(_node, "stateVariable"),
_node.isMember("indexed") ? memberAsBool(_node, "indexed") : false,
memberAsBool(_node, "constant"),
constantness,
_node["overrides"].isNull() ? nullptr : createOverrideSpecifier(member(_node, "overrides")),
location(_node)
);