From 5cff0a5da322783fd31e0fb96ad56f6309cf66d9 Mon Sep 17 00:00:00 2001 From: msojocs Date: Sat, 29 Jul 2023 16:30:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A4=84=E7=90=86=E4=B9=B1=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/night/ns_ast_parse.cpp | 21 ++++++++++++++++----- src/night/ns_compile_js.cpp | 22 +++++++++++----------- src/night/ns_node.cpp | 2 +- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/night/ns_ast_parse.cpp b/src/night/ns_ast_parse.cpp index 525a617..f9add64 100644 --- a/src/night/ns_ast_parse.cpp +++ b/src/night/ns_ast_parse.cpp @@ -295,8 +295,10 @@ namespace night } return v6; } + int ast_dispatch_i = 0; night::ns_node *NSASTParse::ast_dispatch(bool a3) { + int inner_ast_dispatch_i = ++ast_dispatch_i; // ast_dispatch - 0 auto v42 = this->is_punctuation("("); if (!v42) @@ -560,7 +562,8 @@ namespace night if ("." == v40) { auto v11 = this->ast_obj_dot(v59); - return this->make_call_or_just_expression(v11); + auto result = this->make_call_or_just_expression(v11); + return result; } } if (this->is_obj_op_self(true)) @@ -569,7 +572,8 @@ namespace night return this->make_call_or_just_expression(v11); } auto v11 = v59; - return this->make_call_or_just_expression(v11); + night::ns_node * result = this->make_call_or_just_expression(v11); + return result; } // ast_dispatch - 5 @@ -619,7 +623,8 @@ namespace night } } // ast_dispatch - 20 - return this->make_call_or_just_expression(v79); + auto result = this->make_call_or_just_expression(v79); + return result; } std::vector* NSASTParse::make_list_by_parser( @@ -691,9 +696,11 @@ namespace night return v18.vec; } - + + int make_binary_or_just_value_i = 0; night::ns_node *NSASTParse::make_binary_or_just_value(night::ns_node * a2, bool a3) { + int inner_make_binary_or_just_value_i = ++make_binary_or_just_value_i; bool v21; bool v18; if (a3) @@ -765,6 +772,7 @@ namespace night { this->offset_28->err("Expected exp", v15, v16, 1); } + return this->make_binary_or_just_value(v26, a3); } } return a2; @@ -787,9 +795,10 @@ namespace night } return a2; } - + int ast_expression_i = 0; night::ns_node *NSASTParse::ast_expression() { + ast_expression_i++; auto v1 = this->ast_dispatch(false); auto binary_or_just_value = this->make_binary_or_just_value(v1, false); auto result = this->make_call_or_just_expression(binary_or_just_value); @@ -806,8 +815,10 @@ namespace night throw "not implement"; } + int ast_obj_dot_i = 0; night::ns_node *NSASTParse::ast_obj_dot(night::ns_node* a2) { + ast_obj_dot_i++; auto v11 = this->offset_24; auto v9 = v11->gen_girl(night::std_v_n); auto v10 = v11->gen_son(night::NS_TYPE_OBJ_DOT); diff --git a/src/night/ns_compile_js.cpp b/src/night/ns_compile_js.cpp index d5c10ea..08becb9 100644 --- a/src/night/ns_compile_js.cpp +++ b/src/night/ns_compile_js.cpp @@ -17,15 +17,14 @@ namespace night } std::string NSCompileJs::compile_binary(night::ns_node *a3) { - this->compile(a3->offset_180); + std::string ret = this->compile(a3->offset_180); std::string v10 = " " + a3->offset_156; std::string v3 = v10.append(" "); this->offset_48 += v3.length(); std::string v7 = this->compile(a3->offset_184); std::string v4 = ""; - v4 = v7 + v3; - // v4.append(v9); + v4 = ret + v3 + v7; return v4; } std::string NSCompileJs::compile_call(night::ns_node *a3) @@ -60,7 +59,7 @@ namespace night this->offset_48++; } } - str += 5580790; // TODO...待确认 + str += ")"; // TODO...待确认 this->offset_48++; } @@ -84,7 +83,7 @@ namespace night this->offset_48++; } } - str += 5580790; + str += ")"; this->offset_48++; } @@ -127,7 +126,7 @@ namespace night this->offset_48++; result += this->compile(v3->at(2)); - result += 5580790; + result += ")"; this->offset_48++; result += this->compile(a3->offset_216); @@ -187,11 +186,12 @@ namespace night } } // compile_function - 10 - result += 5580790; + result += ")"; + // "(function (nv_evt,nv_instanc" this->offset_48++; if (v29) { - result += 5580792; + result += ")"; this->offset_48++; auto v10 = a3->offset_244; for (int i = 0; i < v10->size(); i++) @@ -265,7 +265,7 @@ namespace night LABEL_31: if (!a3->offset_132.length()) { - result += 5580790; + result += ")"; this->offset_48++; } return result; @@ -442,7 +442,7 @@ namespace night result += v5; this->offset_48 += v5.length(); result += this->compile(a3->offset_204); - result += 5580790; + result += ")"; this->offset_48++; result += this->compile(a3->offset_216); @@ -487,7 +487,7 @@ namespace night } if (night::NS_TYPE_OBJ_BLOCK == a3->offset_0) { - result += 5580790; + result += ")"; this->offset_48++; } return result; diff --git a/src/night/ns_node.cpp b/src/night/ns_node.cpp index 13e379b..ae32cc9 100644 --- a/src/night/ns_node.cpp +++ b/src/night/ns_node.cpp @@ -13,7 +13,7 @@ namespace night std::string ns_node::debug_no_space() { - return ""; + throw "not implement"; } } \ No newline at end of file