From ef64f6d54bfc25c35e9d3044e324c9a3da7c2b94 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Fri, 30 Jun 2023 09:38:40 +0800 Subject: fix small formatting cases. --- src/yuescript/yue_ast.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/yuescript/yue_ast.cpp b/src/yuescript/yue_ast.cpp index d9f8419..f243d24 100644 --- a/src/yuescript/yue_ast.cpp +++ b/src/yuescript/yue_ast.cpp @@ -116,7 +116,11 @@ std::string UpdateOp_t::to_string(void* ud) const { } std::string BinaryOperator_t::to_string(void* ud) const { auto info = reinterpret_cast(ud); - return info->convert(this); + auto op = info->convert(this); + if (op == "!="sv) { + return "~="s; + } + return op; } std::string UnaryOperator_t::to_string(void* ud) const { auto info = reinterpret_cast(ud); @@ -1041,7 +1045,7 @@ std::string FnArgsDef_t::to_string(void* ud) const { if (shadowOption) { line += (line.empty() ? ""s : " "s) + shadowOption->to_string(ud); } - return '(' + line + ')'; + return line.empty() ? ""s : '(' + line + ')'; } std::string FunLit_t::to_string(void* ud) const { auto info = reinterpret_cast(ud); -- cgit v1.2.3-55-g6feb