Skip to content

Commit 5e56d5d

Browse files
committed
perf: 清理冗余代码;
1 parent 4429965 commit 5e56d5d

5 files changed

Lines changed: 35 additions & 87 deletions

File tree

3rdparty/angel-lsp

Submodule angel-lsp updated 42 files

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ endif()
670670

671671
# emit marco in Qt conflicts with antlr4-cpp
672672
target_compile_definitions(WingHexExplorer2 PRIVATE QT_NO_EMIT)
673-
# for QStrign contraction optimization
673+
# for QString contraction optimization
674674
target_compile_definitions(WingHexExplorer2 PRIVATE QT_USE_QSTRINGBUILDER)
675675

676676
target_include_directories(

README_en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ Of course, there are other repositories as mirror for Chinese users (which will
173173

174174
## WIKI
175175

176-
  If you want to learn how to use WingHexEditor and how to develop plug-ins for the software, please go to [this link](https://wing-summer.github.io/WingHexExplorer2/docs/zh/credits.html) (Chinese only). At the same time, you are also welcome to point out errors in the Wiki and contribute high-quality content.
176+
  If you want to learn how to use or how to develop plug-ins for the software, please go to [this link](https://wing-summer.github.io/WingHexExplorer2/docs/zh/credits.html) (Chinese only). At the same time, you are also welcome to point out errors in the Wiki and contribute high-quality content.
177177

178178
## Plugins
179179

src/class/scriptmachine.cpp

Lines changed: 27 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "grammar/ASConsole/AngelscriptConsoleLexer.h"
2121
#include "grammar/ASConsole/AngelscriptConsoleParser.h"
2222

23-
#include "AngelScript/sdk/add_on/autowrapper/aswrappedcall.h"
2423
#include "AngelScript/sdk/add_on/scriptgrid/scriptgrid.h"
2524
#include "AngelScript/sdk/add_on/scripthandle/scripthandle.h"
2625
#include "AngelScript/sdk/add_on/scriptmath/scriptmath.h"
@@ -1363,28 +1362,14 @@ void ScriptMachine::registerEngineAssert(asIScriptEngine *engine) {
13631362
// The string type must be available
13641363
ASSERT(engine->GetTypeInfoByDecl("string"));
13651364

1366-
if (strstr(asGetLibraryOptions(), "AS_MAX_PORTABILITY") == 0) {
1367-
r = engine->RegisterGlobalFunction("void assert(bool expression)",
1368-
asFUNCTION(scriptAssert),
1369-
asCALL_CDECL);
1370-
ASSERT(r >= 0);
1371-
1372-
r = engine->RegisterGlobalFunction(
1373-
"void assert_x(bool expression, const string &in msg)",
1374-
asFUNCTION(scriptAssert_X), asCALL_CDECL);
1375-
ASSERT(r >= 0);
1376-
1377-
} else {
1378-
r = engine->RegisterGlobalFunction("void assert(bool expression)",
1379-
WRAP_FN(scriptAssert),
1380-
asCALL_GENERIC);
1381-
ASSERT(r >= 0);
1365+
r = engine->RegisterGlobalFunction("void assert(bool expression)",
1366+
asFUNCTION(scriptAssert), asCALL_CDECL);
1367+
ASSERT(r >= 0);
13821368

1383-
r = engine->RegisterGlobalFunction(
1384-
"void assert_x(bool expression, const string &in msg)",
1385-
WRAP_FN(scriptAssert_X), asCALL_GENERIC);
1386-
ASSERT(r >= 0);
1387-
}
1369+
r = engine->RegisterGlobalFunction(
1370+
"void assert_x(bool expression, const string &in msg)",
1371+
asFUNCTION(scriptAssert_X), asCALL_CDECL);
1372+
ASSERT(r >= 0);
13881373
}
13891374

13901375
void ScriptMachine::registerEngineClipboard(asIScriptEngine *engine) {
@@ -1394,44 +1379,22 @@ void ScriptMachine::registerEngineClipboard(asIScriptEngine *engine) {
13941379
// The string type must be available
13951380
ASSERT(engine->GetTypeInfoByDecl("string"));
13961381

1397-
if (strstr(asGetLibraryOptions(), "AS_MAX_PORTABILITY") == 0) {
1398-
r = engine->RegisterGlobalFunction(
1399-
"void setText(const string &in text)", asFUNCTION(clip_setText),
1400-
asCALL_CDECL);
1401-
ASSERT(r >= 0);
1402-
1403-
r = engine->RegisterGlobalFunction(
1404-
"string text()", asFUNCTION(clip_getText), asCALL_CDECL);
1405-
ASSERT(r >= 0);
1406-
1407-
r = engine->RegisterGlobalFunction(
1408-
"void setBinary(const uint8[]@ data)", asFUNCTION(clip_setBinary),
1409-
asCALL_CDECL);
1410-
ASSERT(r >= 0);
1411-
1412-
r = engine->RegisterGlobalFunction(
1413-
"uint8[]@ getBinary()", asFUNCTION(clip_getBinary), asCALL_CDECL);
1414-
ASSERT(r >= 0);
1415-
1416-
} else {
1417-
r = engine->RegisterGlobalFunction(
1418-
"void setText(const string &in text)", WRAP_FN(clip_setText),
1419-
asCALL_GENERIC);
1420-
ASSERT(r >= 0);
1382+
r = engine->RegisterGlobalFunction("void setText(const string &in text)",
1383+
asFUNCTION(clip_setText), asCALL_CDECL);
1384+
ASSERT(r >= 0);
14211385

1422-
r = engine->RegisterGlobalFunction(
1423-
"string text()", asFUNCTION(clip_getText), asCALL_GENERIC);
1424-
ASSERT(r >= 0);
1386+
r = engine->RegisterGlobalFunction("string text()",
1387+
asFUNCTION(clip_getText), asCALL_CDECL);
1388+
ASSERT(r >= 0);
14251389

1426-
r = engine->RegisterGlobalFunction(
1427-
"void setBinary(const uint8[]@ data)", WRAP_FN(clip_setBinary),
1428-
asCALL_GENERIC);
1429-
ASSERT(r >= 0);
1390+
r = engine->RegisterGlobalFunction("void setBinary(const uint8[]@ data)",
1391+
asFUNCTION(clip_setBinary),
1392+
asCALL_CDECL);
1393+
ASSERT(r >= 0);
14301394

1431-
r = engine->RegisterGlobalFunction(
1432-
"uint8[]@ getBinary()", WRAP_FN(clip_getBinary), asCALL_GENERIC);
1433-
ASSERT(r >= 0);
1434-
}
1395+
r = engine->RegisterGlobalFunction(
1396+
"uint8[]@ getBinary()", asFUNCTION(clip_getBinary), asCALL_CDECL);
1397+
ASSERT(r >= 0);
14351398

14361399
engine->SetDefaultNamespace("");
14371400
}
@@ -1806,26 +1769,12 @@ void ScriptMachine::registerExceptionRoutines(asIScriptEngine *engine) {
18061769
// The string type must be available
18071770
ASSERT(engine->GetTypeInfoByDecl("string"));
18081771

1809-
if (strstr(asGetLibraryOptions(), "AS_MAX_PORTABILITY") == 0) {
1810-
r = engine->RegisterGlobalFunction("void throw(const string &in)",
1811-
asFUNCTION(scriptThrow),
1812-
asCALL_CDECL);
1813-
ASSERT(r >= 0);
1814-
1815-
r = engine->RegisterGlobalFunction("string getExceptionInfo()",
1816-
asFUNCTION(scriptGetExceptionInfo),
1817-
asCALL_CDECL);
1818-
ASSERT(r >= 0);
1819-
1820-
} else {
1821-
r = engine->RegisterGlobalFunction("void throw(const string &in)",
1822-
WRAP_FN(scriptThrow),
1823-
asCALL_GENERIC);
1824-
ASSERT(r >= 0);
1772+
r = engine->RegisterGlobalFunction("void throw(const string &in)",
1773+
asFUNCTION(scriptThrow), asCALL_CDECL);
1774+
ASSERT(r >= 0);
18251775

1826-
r = engine->RegisterGlobalFunction("string getExceptionInfo()",
1827-
WRAP_FN(scriptGetExceptionInfo),
1828-
asCALL_GENERIC);
1829-
ASSERT(r >= 0);
1830-
}
1776+
r = engine->RegisterGlobalFunction("string getExceptionInfo()",
1777+
asFUNCTION(scriptGetExceptionInfo),
1778+
asCALL_CDECL);
1779+
ASSERT(r >= 0);
18311780
}

src/class/wingangelapi.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,9 +2217,8 @@ QString WingAngelAPI::_InputBox_getItem(const QString &title,
22172217
bool o = false;
22182218
auto ret = cArray2QStringList(items, &o);
22192219
if (o) {
2220-
return WingInputDialog::getItem(nullptr, title, label, ret, current,
2221-
editable, ok,
2222-
Qt::InputMethodHints(inputMethodHints));
2220+
return dlgGetItem(nullptr, title, label, ret, current, editable, ok,
2221+
Qt::InputMethodHints(inputMethodHints));
22232222
} else {
22242223
if (ok) {
22252224
*ok = false;
@@ -2266,9 +2265,9 @@ CScriptArray *WingAngelAPI::_FileDialog_getOpenFileNames(
22662265
if (ctx) {
22672266
return retArrayWrapperFunction(
22682267
[&]() -> QStringList {
2269-
return WingFileDialog::getOpenFileNames(
2270-
nullptr, caption, dir, filter, selectedFilter,
2271-
QFileDialog::Options(options));
2268+
return dlgGetOpenFileNames(nullptr, caption, dir, filter,
2269+
selectedFilter,
2270+
QFileDialog::Options(options));
22722271
},
22732272
static_cast<asITypeInfo *>(ctx->GetEngine()->GetUserData(
22742273
AsUserDataType::UserData_StringListTypeInfo)));

0 commit comments

Comments
 (0)