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. --- CMakeLists.txt | 2 +- src/yuescript/yue_ast.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d5908f..402e5c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ -project(yue CXX) cmake_minimum_required(VERSION 3.1) +project(yue CXX) set(LUA_LIBDIR ${LUA_INCDIR}/../lib ${LUA_INCDIR}/../../lib) set(LUA_INCLUDE_DIR "${LUA_INCDIR}") 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