Skip to content

Commit dd1ea3a

Browse files
committed
Compiler: Add missing references
1 parent fb9d933 commit dd1ea3a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

include/scratchcpp/compiler.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ class LIBSCRATCHCPP_EXPORT Compiler
5151

5252
const std::vector<List *> &lists() const;
5353

54-
void addInstruction(vm::Opcode opcode, std::initializer_list<unsigned int> args = {});
54+
void addInstruction(vm::Opcode opcode, const std::initializer_list<unsigned int> &args = {});
5555
void addInput(Input *input);
5656
void addInput(int id);
5757
void addFunctionCall(BlockFunc f);
58-
void addProcedureArg(std::string procCode, std::string argName);
58+
void addProcedureArg(const std::string &procCode, const std::string &argName);
5959
void moveToSubstack(std::shared_ptr<Block> substack1, std::shared_ptr<Block> substack2, SubstackType type);
6060
void moveToSubstack(std::shared_ptr<Block> substack, SubstackType type);
6161
void breakAtomicScript();
@@ -67,8 +67,8 @@ class LIBSCRATCHCPP_EXPORT Compiler
6767
unsigned int variableIndex(std::shared_ptr<Entity> varEntity);
6868
unsigned int listIndex(std::shared_ptr<Entity> listEntity);
6969
unsigned int constIndex(InputValue *value);
70-
unsigned int procedureIndex(std::string proc);
71-
long procedureArgIndex(std::string procCode, std::string argName);
70+
unsigned int procedureIndex(const std::string &proc);
71+
long procedureArgIndex(const std::string &procCode, const std::string &argName);
7272

7373
const std::vector<std::string> &procedures() const;
7474

src/engine/compiler.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const std::vector<List *> &Compiler::lists() const
103103
}
104104

105105
/*! Adds an instruction to the bytecode. */
106-
void Compiler::addInstruction(Opcode opcode, std::initializer_list<unsigned int> args)
106+
void Compiler::addInstruction(Opcode opcode, const std::initializer_list<unsigned int> &args)
107107
{
108108
impl->addInstruction(opcode, args);
109109
}
@@ -165,7 +165,7 @@ void Compiler::addFunctionCall(BlockFunc f)
165165
}
166166

167167
/*! Adds an argument to a procedure (custom block). */
168-
void Compiler::addProcedureArg(std::string procCode, std::string argName)
168+
void Compiler::addProcedureArg(const std::string &procCode, const std::string &argName)
169169
{
170170
if (impl->procedureArgs.find(procCode) != impl->procedureArgs.cend()) {
171171
const auto &procedure = impl->procedureArgs[procCode];
@@ -261,7 +261,7 @@ unsigned int Compiler::constIndex(InputValue *value)
261261
}
262262

263263
/*! Returns the index of the procedure code of the given block. */
264-
unsigned int Compiler::procedureIndex(std::string proc)
264+
unsigned int Compiler::procedureIndex(const std::string &proc)
265265
{
266266
auto it = std::find(impl->procedures.begin(), impl->procedures.end(), proc);
267267
if (it != impl->procedures.end())
@@ -271,7 +271,7 @@ unsigned int Compiler::procedureIndex(std::string proc)
271271
}
272272

273273
/*! Returns the index of the argument of the given procedure (custom block). */
274-
long Compiler::procedureArgIndex(std::string procCode, std::string argName)
274+
long Compiler::procedureArgIndex(const std::string &procCode, const std::string &argName)
275275
{
276276
if (impl->procedureArgs.count(procCode) == 0) {
277277
std::cout << "warning: could not find custom block '" << procCode << "'" << std::endl;

0 commit comments

Comments
 (0)