mirror of
https://github.com/msojocs/wx-compiler.git
synced 2025-07-19 00:00:04 +08:00
fix: 修复一些问题
This commit is contained in:
parent
72353cb17e
commit
1a0e6443f7
@ -50,6 +50,7 @@ namespace night
|
||||
extern std::string NS_BUILTIN_ALL_OP;
|
||||
extern std::string NS_BUILTIN_TYPE;
|
||||
extern std::string NS_BUILTIN_KW;
|
||||
extern std::string NS_BUILTIN_OP_SELF;
|
||||
|
||||
int compile_ns(std::string const&,std::string const&,std::string const&,uint,std::string&,bool);
|
||||
void compile_ns_with_sourcemap(std::string const&,std::string const&,std::string const&,std::string const&,uint,std::string&,std::string&);
|
||||
@ -82,15 +83,31 @@ namespace night
|
||||
night::ns_node * offset_212 = nullptr;
|
||||
night::ns_node * offset_216 = nullptr;
|
||||
night::ns_node * offset_220 = nullptr;
|
||||
std::vector<std::vector<night::ns_node *>*> offset_224;
|
||||
|
||||
/**
|
||||
* 分析内存,两层vector
|
||||
*/
|
||||
std::vector<std::vector<night::ns_node *>*>* offset_224 = nullptr;
|
||||
|
||||
std::vector<night::ns_node *>* offset_228 = nullptr;
|
||||
std::vector<night::ns_node *>* offset_232 = nullptr;
|
||||
std::vector<std::vector<night::ns_node *>*>* offset_236 = nullptr;
|
||||
std::vector<night::ns_node *>* offset_240 = nullptr;
|
||||
std::vector<night::ns_node *>* offset_244 = nullptr;
|
||||
ns_node(/* args */);
|
||||
~ns_node();
|
||||
std::string debug_no_space(void);
|
||||
};
|
||||
|
||||
// class GodsSon
|
||||
// {
|
||||
// private:
|
||||
// /* data */
|
||||
// public:
|
||||
// std::string offset_0;
|
||||
|
||||
// };
|
||||
|
||||
|
||||
class NSGod
|
||||
{
|
||||
@ -103,6 +120,7 @@ namespace night
|
||||
{
|
||||
/* data */
|
||||
std::vector<night::ns_node *>* offset_24_vec = nullptr;
|
||||
std::vector<std::vector<night::ns_node *>*>* offset_24_vecVec;
|
||||
night::ns_node * offset_24_node;
|
||||
};
|
||||
|
||||
@ -128,10 +146,10 @@ namespace night
|
||||
{
|
||||
private:
|
||||
/* data */
|
||||
std::string offset_24;
|
||||
int offset_48 = 0;
|
||||
public:
|
||||
std::string offset_0;
|
||||
std::string offset_24;
|
||||
int offset_48 = 0;
|
||||
int offset_52 = 0; // 当前行数
|
||||
int offset_56 = 0; // 当前行第几个字符位置
|
||||
NSStream(/* args */);
|
||||
@ -243,7 +261,7 @@ namespace night
|
||||
/**
|
||||
* 是否是标点符号(punctuation)
|
||||
*/
|
||||
bool is_punctuation(std::string const&);
|
||||
night::ns_node * is_punctuation(std::string const&);
|
||||
bool is_save_for_division(night::ns_node *);
|
||||
night::ns_node * make_binary_or_just_value(night::ns_node *,bool);
|
||||
night::ns_node * make_call_or_just_expression(night::ns_node *);
|
||||
@ -263,6 +281,9 @@ namespace night
|
||||
{
|
||||
private:
|
||||
/* data */
|
||||
/*
|
||||
大小:64byte
|
||||
*/
|
||||
public:
|
||||
std::string offset_0;
|
||||
int offset_24;
|
||||
|
@ -50,50 +50,149 @@ namespace night
|
||||
|
||||
night::ns_node *NSASTParse::ast_obj_block()
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
night::ns_node *NSASTParse::ast_code_block()
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
night::ns_node *NSASTParse::ast_new_array()
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
night::ns_node *NSASTParse::ast_obj_op_self(night::ns_node *)
|
||||
|
||||
night::ns_node *NSASTParse::ast_obj_op_self(night::ns_node *a2)
|
||||
{
|
||||
auto v14 = this->offset_24;
|
||||
auto v15 = v14->gen_son(night::NS_TYPE_OBJ_SELF_OP);
|
||||
v15->offset_200 = a2 == nullptr;
|
||||
v15->offset_156 = "";
|
||||
v15->offset_192 = 0;
|
||||
auto v2 = this->offset_28->next();
|
||||
if (!v2)
|
||||
{
|
||||
std::string msg = "End of file";
|
||||
this->offset_28->err(msg, 0, 0, false);
|
||||
}
|
||||
auto v3 = v2->offset_60;
|
||||
auto v7 = v2->offset_84;
|
||||
if (a2)
|
||||
{
|
||||
v15->offset_192 = a2;
|
||||
v15->offset_156.assign(v3);
|
||||
v15->offset_84.assign(v7);
|
||||
}
|
||||
else
|
||||
{
|
||||
v15->offset_156.assign(v3);
|
||||
v15->offset_84.assign(v7);
|
||||
auto v12 = this->offset_28->peek();
|
||||
if (!v12)
|
||||
{
|
||||
std::string msg = "End of file";
|
||||
this->offset_28->err(msg, 0, 0, false);
|
||||
}
|
||||
if (night::NS_TYPE_VAR != v12->offset_0)
|
||||
{
|
||||
std::string msg = "Unexpected token `" + v12->offset_60 + "`";
|
||||
this->offset_28->err(msg, 0, 0, false);
|
||||
}
|
||||
auto v13 = this->ast_expression_no_comma();
|
||||
if (night::NS_TYPE_OBJ_SELF_OP == v13->offset_0)
|
||||
{
|
||||
auto v10 = this->offset_24->gen_son(night::NS_TYPE_OP);
|
||||
v10->offset_60.assign(v13->offset_156);
|
||||
v10->offset_84.assign(v13->offset_84);
|
||||
this->offset_28->push(v10);
|
||||
v15->offset_192 = v13->offset_192;
|
||||
}
|
||||
else
|
||||
{
|
||||
v15->offset_192 = v13;
|
||||
}
|
||||
}
|
||||
return v15;
|
||||
}
|
||||
|
||||
night::ns_node *NSASTParse::ast_op_self()
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
night::ns_node *NSASTParse::ast_if()
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
night::ns_node *NSASTParse::ast_for()
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
night::ns_node *NSASTParse::ast_while()
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
night::ns_node *NSASTParse::ast_do_while()
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
night::ns_node *NSASTParse::ast_switch()
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
bool NSASTParse::is_obj_op_self(bool)
|
||||
bool NSASTParse::is_obj_op_self(bool a3)
|
||||
{
|
||||
if (a3)
|
||||
{
|
||||
auto v3 = this->offset_28->peek();
|
||||
if (v3)
|
||||
{
|
||||
if (v3->offset_84.find('\n') != -1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
bool result = true;
|
||||
if (!this->is_op("++"))
|
||||
{
|
||||
result = this->is_op("--") != 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
bool NSASTParse::is_op_self(bool)
|
||||
bool NSASTParse::is_op_self(bool a3)
|
||||
{
|
||||
auto v3 = this->offset_28->peek();
|
||||
if (!v3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool v6 = night::NS_TYPE_OP == v3->offset_0;
|
||||
if (!v6)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (v3->offset_60.find_first_not_of(night::NS_BUILTIN_OP_SELF) == -1)
|
||||
{
|
||||
return v6;
|
||||
}
|
||||
if (!a3 || night::NS_TYPE_OP != v3->offset_0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ("-" != v3->offset_60)
|
||||
{
|
||||
return "+" == v3->offset_60;
|
||||
}
|
||||
return v6;
|
||||
}
|
||||
night::ns_node *NSASTParse::ast_dispatch(bool a3)
|
||||
{
|
||||
// ast_dispatch - 0
|
||||
auto v42 = this->is_punctuation("(\000)\000{");
|
||||
auto v42 = this->is_punctuation("(");
|
||||
if (!v42)
|
||||
{
|
||||
auto v67 = this->offset_44;
|
||||
this->offset_44 = "";
|
||||
const char asc_5527F4[] = "(\000)\000{";
|
||||
auto v45 = this->is_punctuation("[");
|
||||
auto v45 = this->is_punctuation("{");
|
||||
if (v45)
|
||||
{
|
||||
auto v28 = this->offset_28->next();
|
||||
@ -264,7 +363,7 @@ namespace night
|
||||
}
|
||||
}
|
||||
} // end check for "true"
|
||||
v21 = true;
|
||||
// v21 = false;
|
||||
if (v21)
|
||||
{
|
||||
auto v11 = this->ast_trans_kw();
|
||||
@ -366,7 +465,7 @@ namespace night
|
||||
auto v43 = this->offset_24;
|
||||
auto v44 = v43->gen_girl(night::std_v_n);
|
||||
auto v79 = v43->gen_son(night::NS_TYPE_PUNC);
|
||||
v79->offset_60 = "(\000)\000{";
|
||||
v79->offset_60 = "(";
|
||||
v44->push_back(v79);
|
||||
this->offset_28->next();
|
||||
auto v80 = this->ast_expression(); // 待确认
|
||||
@ -384,9 +483,9 @@ namespace night
|
||||
}
|
||||
}
|
||||
v44->push_back(v80);
|
||||
this->ignore_punc(")\000{"); // 参数待确认
|
||||
this->ignore_punc(")"); // 参数待确认
|
||||
v79 = this->offset_24->gen_son(night::NS_TYPE_PUNC);
|
||||
v79->offset_60 = ")\000{";
|
||||
v79->offset_60 = ")";
|
||||
v44->push_back(v79);
|
||||
v79 = this->offset_24->gen_son(night::NS_TYPE_BRACKET);
|
||||
v79->offset_228 = v44;
|
||||
@ -418,12 +517,12 @@ namespace night
|
||||
bool v18;
|
||||
if (a3)
|
||||
{
|
||||
v21 = this->is_op("\0");
|
||||
v21 = this->is_op("");
|
||||
v18 = a3;
|
||||
}
|
||||
else
|
||||
{
|
||||
v21 = this->is_op_or_comma("\0");
|
||||
v21 = this->is_op_or_comma("");
|
||||
v18 = false;
|
||||
}
|
||||
|
||||
@ -489,6 +588,7 @@ namespace night
|
||||
}
|
||||
return a2;
|
||||
}
|
||||
|
||||
night::ns_node *NSASTParse::make_call_or_just_expression(night::ns_node * a2)
|
||||
{
|
||||
if (
|
||||
@ -499,7 +599,7 @@ namespace night
|
||||
|| a2->offset_132 == ""
|
||||
)
|
||||
{
|
||||
if (this->is_punctuation("(\000)\000{"))
|
||||
if (this->is_punctuation("("))
|
||||
{
|
||||
a2 = this->ast_call(a2);
|
||||
}
|
||||
@ -524,9 +624,41 @@ namespace night
|
||||
printf("ast_ternary_expression\n");
|
||||
}
|
||||
|
||||
night::ns_node *NSASTParse::ast_obj_dot(night::ns_node*)
|
||||
night::ns_node *NSASTParse::ast_obj_dot(night::ns_node* a2)
|
||||
{
|
||||
printf("ast_obj_dot\n");
|
||||
auto v11 = this->offset_24;
|
||||
auto v9 = v11->gen_girl(night::std_v_n);
|
||||
auto v10 = v11->gen_son(night::NS_TYPE_OBJ_DOT);
|
||||
night::ns_node * v5 = nullptr;
|
||||
|
||||
v10->offset_192 = a2;
|
||||
v10->offset_196 = v9;
|
||||
|
||||
do
|
||||
{
|
||||
this->ignore_punc(".");
|
||||
auto v2 = this->offset_28;
|
||||
auto v3 = v2->offset_4;
|
||||
auto v7 = v3->offset_52;
|
||||
auto v8 = v3->offset_56;
|
||||
|
||||
auto v13 = v2->peek();
|
||||
if (!v13)
|
||||
{
|
||||
std::string msg = "End of file";
|
||||
this->offset_28->err(msg, 0, 0, false);
|
||||
}
|
||||
if (night::NS_TYPE_VAR != v13->offset_0)
|
||||
{
|
||||
std::string msg = "Unexpected token `" + v13->offset_60 + "`";
|
||||
this->offset_28->err(msg, v7, v8, true);
|
||||
}
|
||||
auto v18 = this->ast_expression_no_comma();
|
||||
v9->push_back(v18);
|
||||
v5 = this->offset_28->peek();
|
||||
|
||||
} while (v5 && "." == v5->offset_60);
|
||||
return v10;
|
||||
}
|
||||
|
||||
night::ns_node *NSASTParse::ast_obj_op(night::ns_node*)
|
||||
@ -542,6 +674,12 @@ namespace night
|
||||
{
|
||||
printf("ast_function\n");
|
||||
}
|
||||
night::ns_node *NSASTParse::ast_expression_no_comma()
|
||||
{
|
||||
auto v1 = this->ast_dispatch(false);
|
||||
auto bojv = this->make_binary_or_just_value(v1, true);
|
||||
return this->make_call_or_just_expression(bojv);
|
||||
}
|
||||
night::ns_node *NSASTParse::ast_var()
|
||||
{
|
||||
this->offset_28->next();
|
||||
@ -610,7 +748,7 @@ namespace night
|
||||
}
|
||||
auto son = this->offset_24->gen_son(night::NS_TYPE_PROG);
|
||||
son->offset_228 = v16;
|
||||
son->offset_108 = "\0";
|
||||
son->offset_108 = "";
|
||||
return son;
|
||||
|
||||
}
|
||||
@ -665,7 +803,7 @@ namespace night
|
||||
v21->offset_52 = v24->offset_52;
|
||||
|
||||
auto v25 = this->offset_24->gen_girl(night::std_v_v_n);
|
||||
auto lt = this->offset_24->gen_son(night::NS_TYPE_CALL);
|
||||
night::ns_node * lt = this->offset_24->gen_son(night::NS_TYPE_CALL);
|
||||
lt->offset_220 = v21;
|
||||
// lt->offset_224 = v25; // TODO...
|
||||
auto v5 = this->offset_28->peek();
|
||||
@ -721,7 +859,7 @@ namespace night
|
||||
{
|
||||
if (!this->is_punctuation(";"))
|
||||
{
|
||||
v18 = this->is_punctuation("}") == false;
|
||||
v18 = this->is_punctuation("}") == nullptr;
|
||||
}
|
||||
if (v18)
|
||||
{
|
||||
@ -768,7 +906,7 @@ namespace night
|
||||
return lt;
|
||||
}
|
||||
|
||||
bool NSASTParse::is_punctuation(std::string const &a2)
|
||||
night::ns_node * NSASTParse::is_punctuation(std::string const &a2)
|
||||
{
|
||||
auto v2 = this->offset_28->peek();
|
||||
if (v2)
|
||||
@ -776,14 +914,14 @@ namespace night
|
||||
if (night::NS_TYPE_PUNC == v2->offset_0)
|
||||
{
|
||||
if (a2 != v2->offset_60)
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return v2;
|
||||
}
|
||||
|
||||
bool NSASTParse::is_buildin_keywords(std::string const &a2)
|
||||
@ -849,9 +987,9 @@ namespace night
|
||||
bool NSASTParse::is_exp(night::ns_node *a2)
|
||||
{
|
||||
bool result = false;
|
||||
if (this->offset_0.length())
|
||||
if (a2->offset_0.length())
|
||||
{
|
||||
std::string v5 = this->offset_0;
|
||||
std::string v5 = a2->offset_0;
|
||||
if ( v5 != night::NS_TYPE_BOOL
|
||||
&& v5 != night::NS_TYPE_VAR
|
||||
&& v5 != night::NS_TYPE_STR
|
||||
@ -876,7 +1014,7 @@ namespace night
|
||||
{
|
||||
return v2;
|
||||
}
|
||||
auto v3 = this->offset_60;
|
||||
auto v3 = a2->offset_60;
|
||||
if (
|
||||
"null" != v3
|
||||
&& "undefined" != v3
|
||||
@ -941,7 +1079,7 @@ namespace night
|
||||
}
|
||||
auto son = this->offset_24->gen_son(night::NS_TYPE_PROG);
|
||||
son->offset_228 = v6;
|
||||
son->offset_108 = "\0";
|
||||
son->offset_108 = "";
|
||||
|
||||
return son;
|
||||
}
|
||||
@ -964,7 +1102,7 @@ namespace night
|
||||
v17->push_back(v22);
|
||||
|
||||
v22 = this->offset_24->gen_son(night::NS_TYPE_PUNC);
|
||||
v22->offset_60 = "(\000)\000{";
|
||||
v22->offset_60 = "(";
|
||||
v17->push_back(v22);
|
||||
this->offset_28->next();
|
||||
auto v2 = this->offset_28->offset_4;
|
||||
@ -992,7 +1130,7 @@ namespace night
|
||||
this->offset_28->next();
|
||||
auto v13 = this->offset_24;
|
||||
v22 = v13->gen_son(night::NS_TYPE_PUNC);
|
||||
v22->offset_60 = "(\000)\000{";
|
||||
v22->offset_60 = "(";
|
||||
v17->push_back(v22);
|
||||
|
||||
auto v14 = this->offset_24;
|
||||
@ -1003,7 +1141,7 @@ namespace night
|
||||
auto v15 = this->offset_24;
|
||||
v22 = v15->gen_son(night::NS_TYPE_PROG_NO_SEM_REQUIRE);
|
||||
v22->offset_228 = v17;
|
||||
v22->offset_108 = "\0";
|
||||
v22->offset_108 = "";
|
||||
|
||||
auto v5 = this->offset_28->peek();
|
||||
if (!v5)
|
||||
|
@ -22,10 +22,10 @@ namespace night
|
||||
std::string v3 = v10.append(" ");
|
||||
this->offset_48 += v3.length();
|
||||
|
||||
this->compile(a3->offset_184);
|
||||
// v10 = v7 + v8;
|
||||
std::string v7 = this->compile(a3->offset_184);
|
||||
std::string v4 = "";
|
||||
// v4 = v10.append(v9);
|
||||
v4 = v7 + v3;
|
||||
// v4.append(v9);
|
||||
return v4;
|
||||
}
|
||||
std::string NSCompileJs::compile_call(night::ns_node *a3)
|
||||
@ -37,9 +37,9 @@ namespace night
|
||||
auto v3 = a3->offset_224;
|
||||
for (int i = 0; ; i++)
|
||||
{
|
||||
if (i >= v3.size())
|
||||
if (i >= v3->size())
|
||||
break;
|
||||
auto v4 = v3.at(i);
|
||||
auto v4 = v3->at(i);
|
||||
if (v4->begin() != v4->end())
|
||||
{
|
||||
if (
|
||||
@ -47,7 +47,7 @@ namespace night
|
||||
|| (v4->at(0)->offset_0 != night::NS_TYPE_SKIP)
|
||||
)
|
||||
{
|
||||
str += "(\000)\000{"; // 待确认
|
||||
str += "("; // 待确认
|
||||
|
||||
this->offset_48++;
|
||||
for (int v19 = 0; v19 < v4->size(); v19++)
|
||||
@ -70,11 +70,11 @@ namespace night
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < a3->offset_224.size(); i++)
|
||||
for (int i = 0; i < a3->offset_224->size(); i++)
|
||||
{
|
||||
str += "(\000)\000{";
|
||||
str += "(";
|
||||
this->offset_48++;
|
||||
auto v12 = a3->offset_224[i];
|
||||
auto v12 = a3->offset_224->at(i);
|
||||
for (int j = 0; j < v12->size(); j++)
|
||||
{
|
||||
str += this->compile(v12->at(j));
|
||||
@ -136,8 +136,138 @@ namespace night
|
||||
}
|
||||
std::string NSCompileJs::compile_function(night::ns_node *a3)
|
||||
{
|
||||
// compile_function - 0
|
||||
std::string result = "";
|
||||
// TODO...
|
||||
if (a3->offset_132.length())
|
||||
{
|
||||
result += "function ";
|
||||
this->offset_48 += 9;
|
||||
|
||||
night::ns_sourcemap v43;
|
||||
v43.offset_0.assign(a3->offset_24);
|
||||
v43.offset_24 = a3->offset_48;
|
||||
v43.offset_28 = a3->offset_52;
|
||||
v43.offset_32.assign(a3->offset_132);
|
||||
v43.offset_56 = a3->offset_48;
|
||||
v43.offset_60 = this->offset_48;
|
||||
|
||||
this->offset_36.push_back(v43);
|
||||
result += a3->offset_132;
|
||||
this->offset_48 += a3->offset_132.length();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
result += "(function ";
|
||||
this->offset_48 += 10;
|
||||
}
|
||||
// compile_function - 5
|
||||
result += "(";
|
||||
this->offset_48++;
|
||||
auto v4 = a3->offset_244;
|
||||
bool v29 = false;
|
||||
for (int i = 0; i < v4->size(); i++)
|
||||
{
|
||||
auto v5 = v4->at(i);
|
||||
if (night::NS_TYPE_VAR == v5->offset_0)
|
||||
{
|
||||
result += v5->offset_60;
|
||||
this->offset_48 += v5->offset_60.length();
|
||||
}
|
||||
else
|
||||
{
|
||||
result += v5->offset_180->offset_60;
|
||||
v29 = true;
|
||||
this->offset_48 += v5->offset_180->offset_60.length();
|
||||
}
|
||||
if (i + 1 != v4->size())
|
||||
{
|
||||
result += ",";
|
||||
this->offset_48++;
|
||||
}
|
||||
}
|
||||
// compile_function - 10
|
||||
result += 5580790;
|
||||
this->offset_48++;
|
||||
if (v29)
|
||||
{
|
||||
result += 5580792;
|
||||
this->offset_48++;
|
||||
auto v10 = a3->offset_244;
|
||||
for (int i = 0; i < v10->size(); i++)
|
||||
{
|
||||
auto cur = v10->at(i);
|
||||
if (night::NS_TYPE_ASSIGN == cur->offset_0)
|
||||
{
|
||||
std::string v41 = cur->offset_180->offset_60;
|
||||
v41.append("=undefined===");
|
||||
v41.append(v41);
|
||||
v41.append("?");
|
||||
result += v41;
|
||||
this->offset_48 += v41.length();
|
||||
|
||||
result += this->compile(cur->offset_184);
|
||||
std::string v43 = ":" + cur->offset_180->offset_60;
|
||||
v43.append(";");
|
||||
result += v43;
|
||||
this->offset_48 += v43.length();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// compile_function - 15
|
||||
std::string v37 = this->compile(a3->offset_216);
|
||||
std::string v38;
|
||||
if (v29)
|
||||
{
|
||||
std::string v38;
|
||||
if (v37.find("arguments") != -1)
|
||||
{
|
||||
std::string v41 = "arguments." + night::nsv_;
|
||||
v41.append("length=arguments.length;");
|
||||
v38 = v41;
|
||||
result += v38;
|
||||
this->offset_48 += v38.length();
|
||||
}
|
||||
result += v37.substr(1);
|
||||
this->offset_48--;
|
||||
for (int i = 0; i < this->offset_36.size(); i++)
|
||||
{
|
||||
auto v18 = this->offset_36[i];
|
||||
auto v27 = v38.length() + v18.offset_60 - 1;
|
||||
v18.offset_60 = v27;
|
||||
}
|
||||
|
||||
goto LABEL_31;
|
||||
}
|
||||
// compile_function - 20
|
||||
if (v37.find("arguments") != -1)
|
||||
{
|
||||
std::string v41 = "{arguments." + night::nsv_;
|
||||
v41.append("length=arguments.length;");
|
||||
v38 = v41;
|
||||
result += v38;
|
||||
this->offset_48 += v38.length();
|
||||
|
||||
result += v37.substr(1);
|
||||
this->offset_48--;
|
||||
for (int i = 0; i < this->offset_36.size(); i++)
|
||||
{
|
||||
auto v18 = this->offset_36[i];
|
||||
auto v27 = v38.length() + v18.offset_60 - 1;
|
||||
v18.offset_60 = v27;
|
||||
}
|
||||
goto LABEL_31;
|
||||
}
|
||||
|
||||
// compile_function - 25
|
||||
result += v37;
|
||||
LABEL_31:
|
||||
if (!a3->offset_132.length())
|
||||
{
|
||||
result += 5580790;
|
||||
this->offset_48++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
std::string NSCompileJs::compile_if(night::ns_node *a3)
|
||||
@ -347,7 +477,7 @@ namespace night
|
||||
std::string result = "";
|
||||
if (night::NS_TYPE_OBJ_BLOCK == a3->offset_0)
|
||||
{
|
||||
result += "(\000)\000{";
|
||||
result += "(";
|
||||
this->offset_48++;
|
||||
}
|
||||
for (auto i = a3->offset_228->begin(); i != a3->offset_228->end(); i++)
|
||||
|
@ -24,7 +24,7 @@ namespace night
|
||||
node->offset_24_vec = new std::vector<night::ns_node *>();
|
||||
}
|
||||
this->offset_0.push_back(node);
|
||||
return node->offset_24_vec;
|
||||
return node->offset_24_vec; // 审查内存,是一层vector
|
||||
}
|
||||
|
||||
night::ns_node* NSGod::gen_son(std::string a2)
|
||||
|
@ -46,7 +46,7 @@ namespace night
|
||||
{
|
||||
v7 = this->read_string(v13.data, v14);
|
||||
}
|
||||
else if (v13.data - '0' > 9)
|
||||
else if ((uint8_t)(v13.data - '0') > 9)
|
||||
{
|
||||
if (!night::NSToken::tk_is_var_start(v13.data, 0))
|
||||
{
|
||||
@ -63,12 +63,13 @@ namespace night
|
||||
}
|
||||
std::string v15;
|
||||
auto v17 = this->read_while(night::NSToken::tk_is_valid_op_str, (void *)&v15);
|
||||
auto v7 = this->offset_0->gen_son(night::NS_TYPE_OP);
|
||||
|
||||
v7 = this->offset_0->gen_son(night::NS_TYPE_OP);
|
||||
v7->offset_60.assign(v17);
|
||||
v7->offset_84.assign(v14);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto v7 = this->offset_0->gen_son(night::NS_TYPE_PUNC);
|
||||
v7 = this->offset_0->gen_son(night::NS_TYPE_PUNC);
|
||||
auto v19 = this->offset_4->next();
|
||||
std::string v15(1, v19.data);
|
||||
v7->offset_60 = v15;
|
||||
@ -96,7 +97,7 @@ namespace night
|
||||
night::ns_node* NSToken::next(void)
|
||||
{
|
||||
auto result = this->offset_8;
|
||||
this->offset_8 = 0;
|
||||
this->offset_8 = nullptr;
|
||||
if (!result)
|
||||
{
|
||||
return this->read_next();
|
||||
|
@ -16759,7 +16759,9 @@ LABEL_50:
|
||||
std::string::basic_string((char *)v45, (int)&night::NS_TYPE_CALL);
|
||||
lpuexcpt = (struct _Unwind_Exception *)night::NSGod::gen_son(lpuexcptd, (int)v45);
|
||||
std::string::_M_dispose(v45);
|
||||
// offset_220
|
||||
*((_DWORD *)lpuexcpt + 55) = v21;
|
||||
// offset_224
|
||||
*((_DWORD *)lpuexcpt + 56) = v25;
|
||||
v5 = night::NSToken::peek(a1[7]);
|
||||
if ( v5 && std::string::find((int *)v5 + 21, 10, 0) == (char *)-1 )
|
||||
@ -17647,8 +17649,9 @@ _DWORD *__thiscall night::NSASTParse::ast_obj_op_self(_DWORD *this, int a2)
|
||||
v15 = night::NSGod::gen_son(v14, (int)v21);
|
||||
std::string::_M_dispose(v21);
|
||||
*((_BYTE *)v15 + 200) = a2 == 0;
|
||||
v11 = (int)(v15 + 39);
|
||||
v11 = (int)(v15 + 39);// offset_156
|
||||
std::string::operator=(v15 + 39, (char *)&byte_551F04);
|
||||
// v15.offset_192
|
||||
v15[48] = 0;
|
||||
v2 = night::NSToken::next(this[7]);
|
||||
if ( !v2 )
|
||||
@ -17692,6 +17695,7 @@ _DWORD *__thiscall night::NSASTParse::ast_obj_op_self(_DWORD *this, int a2)
|
||||
std::string::basic_string((char *)v21, (int)&night::NS_TYPE_OP);
|
||||
v10 = night::NSGod::gen_son(v9, (int)v21);
|
||||
std::string::_M_dispose(v21);
|
||||
// v10->offset_60 v13->offset_156
|
||||
std::string::_M_assign((int)(v10 + 15), v13 + 156);
|
||||
std::string::_M_assign((int)(v10 + 21), v13 + 84);
|
||||
night::NSToken::push(this[7], (int)v10);
|
||||
@ -17733,6 +17737,7 @@ _DWORD *__thiscall night::NSASTParse::ast_obj_dot(int *this, int a2)
|
||||
std::string::basic_string((char *)v18, (int)&night::NS_TYPE_OBJ_DOT);
|
||||
v10 = night::NSGod::gen_son(v12, (int)v18);
|
||||
std::string::_M_dispose(v18);
|
||||
|
||||
v10[48] = a2;
|
||||
v10[49] = v9;
|
||||
do
|
||||
@ -19185,7 +19190,7 @@ struct _Unwind_Exception *__fastcall night::NSASTParse::ast_var(_DWORD *a1)
|
||||
{
|
||||
std::vector<night::ns_node *>::push_back(v16, &v24);
|
||||
}
|
||||
|
||||
|
||||
v4 = a1[7];
|
||||
v5 = *(_DWORD *)(v4 + 4);
|
||||
v10 = *(_DWORD *)(v5 + 52);
|
||||
@ -19353,33 +19358,40 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this,
|
||||
char v40; // [esp+B8h] [ebp-70h] BYREF
|
||||
int v41; // [esp+C8h] [ebp-60h] BYREF
|
||||
int v42; // [esp+CCh] [ebp-5Ch]
|
||||
int v43; // [esp+E0h] [ebp-48h] BYREF
|
||||
int v44; // [esp+E4h] [ebp-44h]
|
||||
int v43; // [esp+E0h] [ebp-48h] BYREF v43.offset_0
|
||||
int v44; // [esp+E4h] [ebp-44h]
|
||||
char v45; // [esp+E8h] [ebp-40h] BYREF
|
||||
int v46; // [esp+F8h] [ebp-30h]
|
||||
int v46; // [esp+F8h] [ebp-30h] v43.offset_24
|
||||
int v47; // [esp+FCh] [ebp-2Ch]
|
||||
int v48[2]; // [esp+100h] [ebp-28h] BYREF
|
||||
char v49; // [esp+108h] [ebp-20h] BYREF
|
||||
int v50; // [esp+118h] [ebp-10h]
|
||||
int v50; // [esp+118h] [ebp-10h] v43.offset_56
|
||||
int v51; // [esp+11Ch] [ebp-Ch]
|
||||
|
||||
this[1] = 0;
|
||||
// compile_function - 0
|
||||
*this = this + 2;
|
||||
this[1] = 0;
|
||||
*((_BYTE *)this + 8) = 0;
|
||||
|
||||
// a3->offset_136
|
||||
v25 = a3[34];
|
||||
if ( v25 )
|
||||
{
|
||||
std::string::basic_string((void **)&v41, "function ");
|
||||
std::string::operator+=(&v41);
|
||||
v44 = 0;
|
||||
*(_DWORD *)(a2 + 48) += v42;
|
||||
|
||||
v43 = (int)&v45;
|
||||
v48[0] = (int)&v49;
|
||||
v44 = 0;
|
||||
v45 = 0;
|
||||
|
||||
v46 = 0;
|
||||
v47 = 0;
|
||||
|
||||
v48[0] = (int)&v49;
|
||||
v48[1] = 0;
|
||||
v49 = 0;
|
||||
|
||||
v50 = 0;
|
||||
v51 = 0;
|
||||
std::string::_M_assign((int)&v43, (int)(a3 + 6));
|
||||
@ -19388,6 +19400,8 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this,
|
||||
std::string::_M_assign((int)v48, (int)(a3 + 33));
|
||||
v50 = a3[12];
|
||||
v51 = *(_DWORD *)(a2 + 48);
|
||||
|
||||
// this->ofsset_36.push_back(v43)
|
||||
std::vector<night::ns_sourcemap>::push_back((night::ns_sourcemap **)(a2 + 36), (night::ns_sourcemap *)&v43);
|
||||
std::string::operator+=(a3 + 33);
|
||||
*(_DWORD *)(a2 + 48) += a3[34];
|
||||
@ -19401,13 +19415,15 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this,
|
||||
v3 = &v43;
|
||||
*(_DWORD *)(a2 + 48) += v44;
|
||||
}
|
||||
// compile_function - 5
|
||||
std::string::_M_dispose((void **)v3);
|
||||
std::string::operator+=(asc_5527F4);
|
||||
std::string::operator+=(asc_5527F4); // "(\000)\000{"
|
||||
lpuexcpt = 0;
|
||||
++*(_DWORD *)(a2 + 48);
|
||||
v29 = 0;
|
||||
while ( 1 )
|
||||
{
|
||||
// a3->offset_244
|
||||
v4 = (_DWORD *)a3[61];
|
||||
if ( lpuexcpt >= (v4[1] - *v4) >> 2 )
|
||||
break;
|
||||
@ -19440,6 +19456,7 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this,
|
||||
lpuexcpt = v26;
|
||||
}
|
||||
}
|
||||
// compile_function - 10
|
||||
std::string::operator+=(5580790);
|
||||
++*(_DWORD *)(a2 + 48);
|
||||
if ( v29 )
|
||||
@ -19455,9 +19472,11 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this,
|
||||
v34[1] = 0;
|
||||
v34[0] = &v35;
|
||||
v35 = 0;
|
||||
// cur
|
||||
v11 = (int *)std::vector<night::ns_node *>::at(v10, lpuexcpta);
|
||||
if ( std::operator==<char>((int)&night::NS_TYPE_ASSIGN, *v11) )
|
||||
{
|
||||
// cur
|
||||
v12 = std::vector<night::ns_node *>::at((_DWORD *)a3[61], lpuexcpta);
|
||||
std::string::basic_string((char *)v36, *(_DWORD *)(*(_DWORD *)v12 + 180) + 60);
|
||||
std::string::basic_string((char *)&v41, (int)v36);
|
||||
@ -19470,6 +19489,7 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this,
|
||||
std::string::_M_dispose((void **)&v41);
|
||||
std::string::operator+=(v37);
|
||||
*(_DWORD *)(a2 + 48) += v37[1];
|
||||
|
||||
v15 = std::vector<night::ns_node *>::at((_DWORD *)a3[61], lpuexcpta);
|
||||
night::NSCompileJs::compile[abi:cxx11](a2, *(_DWORD *)(*(_DWORD *)v15 + 184));
|
||||
std::string::operator+=(&v38);
|
||||
@ -19479,6 +19499,7 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this,
|
||||
std::string::_M_dispose((void **)&v43);
|
||||
std::string::operator+=(&v41);
|
||||
*(_DWORD *)(a2 + 48) += v42;
|
||||
|
||||
std::string::_M_dispose((void **)&v41);
|
||||
std::string::_M_dispose((void **)&v38);
|
||||
std::string::_M_dispose(v37);
|
||||
@ -19488,6 +19509,7 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this,
|
||||
++lpuexcpta;
|
||||
}
|
||||
}
|
||||
// compile_function - 15
|
||||
lpuexcptb = (*(_DWORD *)(a2 + 40) - *(_DWORD *)(a2 + 36)) >> 6;
|
||||
night::NSCompileJs::compile[abi:cxx11](a2, a3[54]);
|
||||
if ( v29 )
|
||||
@ -19510,6 +19532,7 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this,
|
||||
std::string::operator+=(&v43);
|
||||
std::string::_M_dispose((void **)&v43);
|
||||
--*(_DWORD *)(a2 + 48);
|
||||
// int a2
|
||||
while ( lpuexcptb < (*(_DWORD *)(a2 + 40) - *(_DWORD *)(a2 + 36)) >> 6 )
|
||||
{
|
||||
v18 = std::vector<night::ns_sourcemap>::at((int *)(a2 + 36), lpuexcptb);
|
||||
@ -19518,8 +19541,9 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this,
|
||||
*(_DWORD *)(v19 + 60) = v27;
|
||||
}
|
||||
v20 = (int *)&v38;
|
||||
goto LABEL_29;
|
||||
goto LABEL_29; // 销毁v20 -> LABEL_31
|
||||
}
|
||||
// compile_function - 20
|
||||
if ( std::string::find((int *)v37, "arguments", 0) != -1 )
|
||||
{
|
||||
std::operator+<char>((int)&v43, "{arguments.", (int)&night::nsv_);
|
||||
@ -19544,6 +19568,7 @@ LABEL_29:
|
||||
std::string::_M_dispose((void **)v20);
|
||||
goto LABEL_31;
|
||||
}
|
||||
// compile_function - 25
|
||||
std::string::operator+=(v37);
|
||||
LABEL_31:
|
||||
if ( !v25 )
|
||||
|
Loading…
x
Reference in New Issue
Block a user