Skip to content

Commit d7a7fc0

Browse files
committed
chore: use const vector& when loading lambdas into Ark::State
1 parent 617c765 commit d7a7fc0

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

.github/workflows/static_analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
cppcheck --platform=unix64 --template="{file}:{line}: {severity}: {message}" \
4343
--output-file=cppcheck.txt \
4444
-I include src \
45-
--enable=all --inline-suppr \
45+
--enable=all --inline-suppr --check-level=exhaustive \
4646
--suppressions-list=cppcheck-suppressions.txt
4747
content=$(python .github/generate_cppcheck_report.py $(echo $(git diff --name-only -r HEAD^1 HEAD)))
4848
echo "CPPCHECK_REPORT<<EOF" >> $GITHUB_ENV

src/arkscript/REPL/Repl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ namespace Ark
121121

122122
void Repl::registerBuiltins()
123123
{
124-
m_state.loadFunction("repl:history", [this]([[maybe_unused]] std::vector<Value>&, [[maybe_unused]] VM*) {
124+
m_state.loadFunction("repl:history", [this]([[maybe_unused]] const std::vector<Value>&, [[maybe_unused]] VM*) {
125125
return Value(m_code);
126126
});
127127

128-
m_state.loadFunction("repl:save", [this](std::vector<Value>& n, [[maybe_unused]] VM*) {
128+
m_state.loadFunction("repl:save", [this](const std::vector<Value>& n, [[maybe_unused]] VM*) {
129129
if (!types::check(n, ValueType::String))
130130
throw types::TypeCheckingError(
131131
"repl:save",
@@ -137,7 +137,7 @@ namespace Ark
137137
return Nil;
138138
});
139139

140-
m_state.loadFunction("repl:load", [this](std::vector<Value>& n, [[maybe_unused]] VM*) {
140+
m_state.loadFunction("repl:load", [this](const std::vector<Value>& n, [[maybe_unused]] VM*) {
141141
if (!types::check(n, ValueType::String))
142142
throw types::TypeCheckingError(
143143
"repl:load",

tests/unittests/Suites/DebuggerSuite.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ ut::suite<"Debugger"> debugger_suite = [] {
1818
std::stringstream os;
1919
Ark::State state({ lib_path });
2020

21-
// cppcheck-suppress constParameterReference
22-
state.loadFunction("prn", [&os](std::vector<Ark::Value>& args, Ark::VM* vm) -> Ark::Value {
21+
state.loadFunction("prn", [&os](const std::vector<Ark::Value>& args, Ark::VM* vm) -> Ark::Value {
2322
for (const auto& value : args)
2423
fmt::print(os, "{}", value.toString(*vm));
2524
fmt::println(os, "");

0 commit comments

Comments
 (0)