From ea7ee3d5fe824261a7c72a491736d4688ab58409 Mon Sep 17 00:00:00 2001 From: r0qs Date: Thu, 27 Jul 2023 18:41:52 +0200 Subject: [PATCH] Fix yul ast ID to 0 instead of 1. --- Changelog.md | 1 + libsolidity/interface/StandardCompiler.cpp | 2 +- test/cmdlineTests/standard_yul/output.json | 2 +- test/cmdlineTests/standard_yul_object/output.json | 2 +- test/cmdlineTests/standard_yul_object_name/output.json | 2 +- test/cmdlineTests/standard_yul_optimiserSteps/output.json | 2 +- test/cmdlineTests/standard_yul_optimized/output.json | 2 +- 7 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Changelog.md b/Changelog.md index 7a0826977..377b5f9ce 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,6 +7,7 @@ Compiler Features: Bugfixes: + * AST: Fix wrong initial ID for Yul nodes in the AST. * NatSpec: Fix internal error when requesting userdoc or devdoc for a contract that emits an event defined in a foreign contract or interface. * SMTChecker: Fix encoding error that causes loops to unroll after completion. diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp index fc1de4249..767792601 100644 --- a/libsolidity/interface/StandardCompiler.cpp +++ b/libsolidity/interface/StandardCompiler.cpp @@ -1553,7 +1553,7 @@ Json::Value StandardCompiler::compileYul(InputsAndSettings _inputsAndSettings) if (isArtifactRequested(_inputsAndSettings.outputSelection, sourceName, contractName, "ast", wildcardMatchesExperimental)) { Json::Value sourceResult = Json::objectValue; - sourceResult["id"] = 1; + sourceResult["id"] = 0; sourceResult["ast"] = stack.astJson(); output["sources"][sourceName] = sourceResult; } diff --git a/test/cmdlineTests/standard_yul/output.json b/test/cmdlineTests/standard_yul/output.json index 9dcf20113..c1b22726f 100644 --- a/test/cmdlineTests/standard_yul/output.json +++ b/test/cmdlineTests/standard_yul/output.json @@ -169,7 +169,7 @@ "nodeType": "YulObject", "subObjects": [] }, - "id": 1 + "id": 0 } } } diff --git a/test/cmdlineTests/standard_yul_object/output.json b/test/cmdlineTests/standard_yul_object/output.json index edf139dc0..1404cd3aa 100644 --- a/test/cmdlineTests/standard_yul_object/output.json +++ b/test/cmdlineTests/standard_yul_object/output.json @@ -179,7 +179,7 @@ data_4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45 616263 } ] }, - "id": 1 + "id": 0 } } } diff --git a/test/cmdlineTests/standard_yul_object_name/output.json b/test/cmdlineTests/standard_yul_object_name/output.json index 7faeed3c3..6803c322d 100644 --- a/test/cmdlineTests/standard_yul_object_name/output.json +++ b/test/cmdlineTests/standard_yul_object_name/output.json @@ -258,7 +258,7 @@ sub_0: assembly { } ] }, - "id": 1 + "id": 0 } } } diff --git a/test/cmdlineTests/standard_yul_optimiserSteps/output.json b/test/cmdlineTests/standard_yul_optimiserSteps/output.json index 54dd24ac6..85a34261f 100644 --- a/test/cmdlineTests/standard_yul_optimiserSteps/output.json +++ b/test/cmdlineTests/standard_yul_optimiserSteps/output.json @@ -166,7 +166,7 @@ "nodeType": "YulObject", "subObjects": [] }, - "id": 1 + "id": 0 } } } diff --git a/test/cmdlineTests/standard_yul_optimized/output.json b/test/cmdlineTests/standard_yul_optimized/output.json index b260f72ed..d580ef6ae 100644 --- a/test/cmdlineTests/standard_yul_optimized/output.json +++ b/test/cmdlineTests/standard_yul_optimized/output.json @@ -161,7 +161,7 @@ "nodeType": "YulObject", "subObjects": [] }, - "id": 1 + "id": 0 } } }