aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2023-06-30 09:38:40 +0800
committerLi Jin <dragon-fly@qq.com>2023-06-30 09:38:40 +0800
commitef64f6d54bfc25c35e9d3044e324c9a3da7c2b94 (patch)
tree42e73885a31abbffcf80ca65c39d4b6e1a751dc1
parentdce38caac22a024026d19f556aefe0669f97403c (diff)
downloadyuescript-ef64f6d54bfc25c35e9d3044e324c9a3da7c2b94.tar.gz
yuescript-ef64f6d54bfc25c35e9d3044e324c9a3da7c2b94.tar.bz2
yuescript-ef64f6d54bfc25c35e9d3044e324c9a3da7c2b94.zip
fix small formatting cases.
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/yuescript/yue_ast.cpp8
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 @@
1project(yue CXX)
2cmake_minimum_required(VERSION 3.1) 1cmake_minimum_required(VERSION 3.1)
2project(yue CXX)
3 3
4set(LUA_LIBDIR ${LUA_INCDIR}/../lib ${LUA_INCDIR}/../../lib) 4set(LUA_LIBDIR ${LUA_INCDIR}/../lib ${LUA_INCDIR}/../../lib)
5set(LUA_INCLUDE_DIR "${LUA_INCDIR}") 5set(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 {
116} 116}
117std::string BinaryOperator_t::to_string(void* ud) const { 117std::string BinaryOperator_t::to_string(void* ud) const {
118 auto info = reinterpret_cast<YueFormat*>(ud); 118 auto info = reinterpret_cast<YueFormat*>(ud);
119 return info->convert(this); 119 auto op = info->convert(this);
120 if (op == "!="sv) {
121 return "~="s;
122 }
123 return op;
120} 124}
121std::string UnaryOperator_t::to_string(void* ud) const { 125std::string UnaryOperator_t::to_string(void* ud) const {
122 auto info = reinterpret_cast<YueFormat*>(ud); 126 auto info = reinterpret_cast<YueFormat*>(ud);
@@ -1041,7 +1045,7 @@ std::string FnArgsDef_t::to_string(void* ud) const {
1041 if (shadowOption) { 1045 if (shadowOption) {
1042 line += (line.empty() ? ""s : " "s) + shadowOption->to_string(ud); 1046 line += (line.empty() ? ""s : " "s) + shadowOption->to_string(ud);
1043 } 1047 }
1044 return '(' + line + ')'; 1048 return line.empty() ? ""s : '(' + line + ')';
1045} 1049}
1046std::string FunLit_t::to_string(void* ud) const { 1050std::string FunLit_t::to_string(void* ud) const {
1047 auto info = reinterpret_cast<YueFormat*>(ud); 1051 auto info = reinterpret_cast<YueFormat*>(ud);