Skip to content

Commit 7a76485

Browse files
committed
chore: addressing cppcheck recommandations: more ranges, less variable shadowing
1 parent d7a7fc0 commit 7a76485

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

include/Ark/State.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,6 @@ namespace Ark
128128
*/
129129
void extendBytecode(const std::vector<bytecode_t>& pages, const std::vector<std::string>& symbols, const std::vector<Value>& constants);
130130

131-
[[nodiscard]] inline const bytecode_t& bytecode() const noexcept
132-
{
133-
return m_bytecode;
134-
}
135-
136131
friend class VM;
137132
friend class Repl;
138133
friend class internal::Closure;

src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@ namespace Ark::internal
2121

2222
void ASTLowerer::addToTables(const std::vector<std::string>& symbols, const std::vector<ValTableElem>& constants)
2323
{
24-
for (const std::string& sym : symbols)
25-
m_symbols.emplace_back(sym);
26-
for (const ValTableElem& elem : constants)
27-
m_values.emplace_back(elem);
24+
std::ranges::copy(symbols, std::back_inserter(m_symbols));
25+
std::ranges::copy(constants, std::back_inserter(m_values));
2826
}
2927

30-
void ASTLowerer::offsetPagesBy(std::size_t offset)
28+
void ASTLowerer::offsetPagesBy(const std::size_t offset)
3129
{
3230
m_start_page_at_offset = offset;
3331
}

src/arkreactor/VM/Debugger.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,23 @@
1414
namespace Ark::internal
1515
{
1616
Debugger::Debugger(const ExecutionContext& context, const std::vector<std::filesystem::path>& libenv, const std::vector<std::string>& symbols, const std::vector<Value>& constants) :
17-
m_libenv(libenv), m_symbols(symbols), m_constants(constants), m_os(std::cout), m_colorize(true)
17+
m_libenv(libenv),
18+
m_symbols(symbols),
19+
m_constants(constants),
20+
m_os(std::cout),
21+
m_colorize(true)
1822
{
1923
saveState(context);
2024
}
2125

2226
Debugger::Debugger(const std::vector<std::filesystem::path>& libenv, const std::string& path_to_prompt_file, std::ostream& os, const std::vector<std::string>& symbols, const std::vector<Value>& constants) :
23-
m_libenv(libenv), m_symbols(symbols), m_constants(constants), m_os(os), m_colorize(false)
24-
{
25-
m_prompt_stream = std::make_unique<std::ifstream>(path_to_prompt_file);
26-
}
27+
m_libenv(libenv),
28+
m_symbols(symbols),
29+
m_constants(constants),
30+
m_os(os),
31+
m_colorize(false),
32+
m_prompt_stream(std::make_unique<std::ifstream>(path_to_prompt_file))
33+
{}
2734

2835
void Debugger::saveState(const ExecutionContext& context)
2936
{

0 commit comments

Comments
 (0)