fix: 逻辑错误

This commit is contained in:
msojocs 2023-08-30 23:01:10 +08:00
parent 700f4b7257
commit 7719cf14f1
7 changed files with 43 additions and 7 deletions

4
.vscode/launch.json vendored
View File

@ -12,10 +12,10 @@
"program": "${workspaceFolder}/build/wcc",
"args": [
"\"--config-path\"",
"\"/mnt/d/Work/disassembly/wcc-exec/wcc/cmd1.txt\""
"\"/mnt/d/Work/WeChatProjects/miniprogram-1/wcc/99a9bac3c05fc25dd070298212c4a7d3\""
],
"stopAtEntry": false,
"cwd": "/mnt/d/Work/WeChatProjects/miniprogram-demo/miniprogram",
"cwd": "/mnt/d/Work/WeChatProjects/miniprogram-1",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",

View File

@ -325,7 +325,10 @@ namespace night
std::string compile_obj_dot(night::ns_node *);
std::string compile_obj_property(night::ns_node *);
std::string compile_obj_self_op(night::ns_node *);
std::string compile_once(std::string &, std::vector<std::string> *, bool);
/**
* @param a3
*/
std::string compile_once(std::string &a3, std::vector<std::string> *a4, bool a5);
std::string compile_op_self(night::ns_node *);
std::string compile_prog(night::ns_node *);
std::string compile_prog_no_sem(night::ns_node *);

View File

@ -190,17 +190,19 @@ namespace night
this->offset_48++;
if (v29)
{
result += ")";
result += "{";
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;
std::string _v41 = v41;
v41.append("=undefined===");
v41.append(v41);
v41.append(_v41);
v41.append("?");
result += v41;
this->offset_48 += v41.length();
@ -533,8 +535,11 @@ namespace night
return result;
}
int compile_i = 0;
std::string NSCompileJs::compile(night::ns_node * a3)
{
compile_i++;
int inner_compile_i = compile_i;
if (this->offset_0.size() == 0)
{
std::string v9 = a3->offset_0;

View File

@ -16,6 +16,7 @@ namespace WXML {
{
}
int DealSingleTokenToOps_i = 0;
int WXMLDom::DealSingleTokenToOps(
std::string const& a1,
std::string& a2,
@ -30,6 +31,8 @@ namespace WXML {
const std::map<std::string,std::string> & a11
)
{
DealSingleTokenToOps_i++;
int inner_DealSingleTokenToOps_i = DealSingleTokenToOps_i;
// DealSingleTokenToOps - 0
std::string v11;
if (a8)
@ -248,6 +251,7 @@ namespace WXML {
}
return 0;
}
int RenderAllOpsAndRecord_i = 0;
void WXMLDom::RenderAllOpsAndRecord(
std::string const& a2,
std::string& a3,
@ -258,6 +262,8 @@ namespace WXML {
const std::map<std::string,std::string> & a8
)
{
RenderAllOpsAndRecord_i++;
int inner_RenderAllOpsAndRecord_i = RenderAllOpsAndRecord_i;
if (this->offset_0 == "TEXTNODE")
{
this->DealSingleTokenToOps(a2, a3, a4, a5, &this->offset_84, 0, 0, 1, a6, a7, a8);
@ -382,8 +388,11 @@ namespace WXML {
}
int RewriteTree_i = 0;
void WXMLDom::RewriteTree(void)
{
RewriteTree_i++;
int inner_RewriteTree_i = RewriteTree_i;
// RewriteTree - 0
for (int i = 0; i < this->offset_72.size(); i++)
{
@ -548,7 +557,7 @@ namespace WXML {
{
this->offset_72[i]->RewriteTree();
}
return;
}
void WXMLDom::RenderChildren(
@ -607,6 +616,7 @@ namespace WXML {
a6 << "var " << v147 << "=" << a3;
a6 << "[x[" << this->offset_248->GetStrID(a2) << "]].j" << a12;
}
v109++;
}
}
}
@ -855,6 +865,7 @@ namespace WXML {
}
int RenderNonDefine_i = 0;
void WXMLDom::RenderNonDefine(
std::string const& a2,
std::string const& a3,
@ -872,6 +883,8 @@ namespace WXML {
std::map<std::string,std::string> * a15
)
{
RenderNonDefine_i++;
int inner_RenderNonDefine_i = RenderNonDefine_i;
// RenderNonDefine - 0
if (a13 && this->offset_24.size())
{
@ -1301,7 +1314,7 @@ namespace WXML {
if ( v161[0] != 'w'
|| v161[1] != 'x'
|| v161[2] != ':' && v161[2] != '-'
|| v161 != "wx:scope-data")
|| v161 == "wx:scope-data")
{
// pos: 搜索 -> !__stricmp((const char *)v161, "wx:scope-data")
// ++emplace_back_i;
@ -1399,6 +1412,10 @@ namespace WXML {
}
// RenderNonDefine - 35
if (a5 == "o2J")
{
int a = 0;
}
a6 << "var " << a5 << "=_mz(z,'" << this->offset_0 << "',[";
v259 = "";
for (auto jj = v324.begin(); jj < v324.end(); jj++)

View File

@ -30,6 +30,8 @@ namespace WXML
Parser::~Parser()
{
}
int Parse_i = 0;
int offset_0_push_i = 0;
int Parser::Parse(
std::string const& a2,
std::string const& a3,
@ -38,6 +40,8 @@ namespace WXML
std::string& a6,
bool a7)
{
Parse_i++;
int inner_Parse_i = Parse_i;
// WXML::EXPRLib::Parser::Parse - 0
this->offset_0.clear();
this->offset_40.clear();
@ -82,6 +86,7 @@ namespace WXML
v70->offset_4_int = WXML::EXPRLib::TransitTable::GetExprNTType();
}
this->offset_0.push_back(v70);
offset_0_push_i += 2;
// WXML::EXPRLib::Parser::Parse - 20
int v49 = 0;
while (true)
@ -222,6 +227,7 @@ namespace WXML
std::shared_ptr<WXML::EXPRLib::Base> cur1 = baseList[i];
if( cur1->offset_0() == 4)
break;
offset_0_push_i++;
this->offset_0.push_back(cur1);
}

View File

@ -177,8 +177,11 @@ namespace WXML {
}
}
int GetTokens_i = 0;
int Tokenizer::GetTokens(std::vector<WXML::EXPRLib::Token> & a2, std::string &a3)
{
GetTokens_i++;
int inner_GetTokens_i = GetTokens_i;
int v21 = 18899;
WXML::EXPRLib::Tokenizer::InitTransitTable();
int v24 = 1;

View File

@ -8776,6 +8776,7 @@ void __fastcall WXML::EXPRLib::TransitTable::Init(int a1)
v968 = std::vector<WXML::EXPRLib::BNF>::push_back(&v1982);
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(&v1980, v968);
std::vector<zcc::shared_ptr<WXML::EXPRLib::Base>>::~vector(&v1982);
v1979 = 0;
v1980 = 0;
v1981 = 0;
@ -8786,6 +8787,7 @@ void __fastcall WXML::EXPRLib::TransitTable::Init(int a1)
std::vector<WXML::EXPRLib::BNF>::_M_move_assign(&v1979);
std::string::_M_dispose(&v1982, v969);
std::vector<WXML::EXPRLib::BNF>::~vector(&v1979);
v1979 = 0;
v1980 = 0;
v1981 = 0;