From a9b5835e5de85e8532bcba39b1a621d6a53cf021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 17 Sep 2021 20:53:32 +0200 Subject: [PATCH] AsmPrinter: Don't include whitespace after @src if there's no code snippet --- libyul/AsmPrinter.cpp | 2 +- .../standard_yul_source_locations/output.json | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libyul/AsmPrinter.cpp b/libyul/AsmPrinter.cpp index 6a764ee16..c8f169cd1 100644 --- a/libyul/AsmPrinter.cpp +++ b/libyul/AsmPrinter.cpp @@ -293,7 +293,7 @@ string AsmPrinter::formatSourceLocation( ":" + to_string(_location.end); - return joinHumanReadable(vector{sourceLocation, solidityCodeSnippet}, " "); + return sourceLocation + (solidityCodeSnippet.empty() ? "" : " ") + solidityCodeSnippet; } string AsmPrinter::formatDebugData(shared_ptr const& _debugData, bool _statement) diff --git a/test/cmdlineTests/standard_yul_source_locations/output.json b/test/cmdlineTests/standard_yul_source_locations/output.json index 485380625..0ba3b09a3 100644 --- a/test/cmdlineTests/standard_yul_source_locations/output.json +++ b/test/cmdlineTests/standard_yul_source_locations/output.json @@ -599,15 +599,15 @@ object \"C_54\" { let newFreePtr := add(160, and(add(argSize, 31), not(31))) if or(gt(newFreePtr, sub(shl(64, 1), 1)), lt(newFreePtr, 160)) { - mstore(/** @src -1:-1:-1 */ 0, /** @src 0:79:435 \"contract C...\" */ shl(224, 0x4e487b71)) + mstore(/** @src -1:-1:-1 */ 0, /** @src 0:79:435 \"contract C...\" */ shl(224, 0x4e487b71)) mstore(4, 0x41) - revert(/** @src -1:-1:-1 */ 0, /** @src 0:79:435 \"contract C...\" */ 0x24) + revert(/** @src -1:-1:-1 */ 0, /** @src 0:79:435 \"contract C...\" */ 0x24) } mstore(64, newFreePtr) codecopy(160, programSize, argSize) if slt(argSize, 32) { - revert(/** @src -1:-1:-1 */ 0, 0) + revert(/** @src -1:-1:-1 */ 0, 0) } /// @src 0:79:435 \"contract C...\" constructor_C(mload(160)) @@ -1431,15 +1431,15 @@ object \"D_72\" { let newFreePtr := add(160, and(add(argSize, 31), not(31))) if or(gt(newFreePtr, sub(shl(64, 1), 1)), lt(newFreePtr, 160)) { - mstore(/** @src -1:-1:-1 */ 0, /** @src 1:91:166 \"contract D is C(3)...\" */ shl(224, 0x4e487b71)) + mstore(/** @src -1:-1:-1 */ 0, /** @src 1:91:166 \"contract D is C(3)...\" */ shl(224, 0x4e487b71)) mstore(4, 0x41) - revert(/** @src -1:-1:-1 */ 0, /** @src 1:91:166 \"contract D is C(3)...\" */ 0x24) + revert(/** @src -1:-1:-1 */ 0, /** @src 1:91:166 \"contract D is C(3)...\" */ 0x24) } mstore(64, newFreePtr) codecopy(160, programSize, argSize) if slt(argSize, 32) { - revert(/** @src -1:-1:-1 */ 0, 0) + revert(/** @src -1:-1:-1 */ 0, 0) } /// @src 1:91:166 \"contract D is C(3)...\" constructor_D(mload(160))