From d15ba987d1a40ea5bd591c550e078e98c0a7778d Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 24 Mar 2021 11:19:38 +0100 Subject: [PATCH] Fix AST output if modifier invocation is base constructor call. --- Changelog.md | 1 + libsolidity/ast/ASTJsonConverter.cpp | 5 ++--- test/libsolidity/ASTJSON/base_constructor_call.json | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index 9bb2bb46d..024d3ddf3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,6 +7,7 @@ Compiler Features: Bugfixes: + * AST Output: Fix ``kind`` field of ``ModifierInvocation`` for base constructor calls. AST Changes: diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index f4c3bf7fe..d62445081 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -461,9 +461,8 @@ bool ASTJsonConverter::visit(ModifierInvocation const& _node) { if (dynamic_cast(declaration)) attributes.emplace_back("kind", "modifierInvocation"); - else if (FunctionDefinition const* function = dynamic_cast(declaration)) - if (function->isConstructor()) - attributes.emplace_back("kind", "baseConstructorSpecifier"); + else if (dynamic_cast(declaration)) + attributes.emplace_back("kind", "baseConstructorSpecifier"); } setJsonNode(_node, "ModifierInvocation", move(attributes)); return false; diff --git a/test/libsolidity/ASTJSON/base_constructor_call.json b/test/libsolidity/ASTJSON/base_constructor_call.json index fd11b622f..b67fa4e3e 100644 --- a/test/libsolidity/ASTJSON/base_constructor_call.json +++ b/test/libsolidity/ASTJSON/base_constructor_call.json @@ -172,6 +172,7 @@ } ], "id": 13, + "kind": "baseConstructorSpecifier", "modifierName": { "id": 11,