Skip to content

Commit

Permalink
Added a bit of documentation where there was some documentation missing
Browse files Browse the repository at this point in the history
  • Loading branch information
Toon Schoenmakers committed Nov 14, 2014
1 parent 3046fd4 commit 1f783b3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/bytecode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,23 +718,30 @@ void Bytecode::booleanOr(const Expression *left, const Expression *right)
*/
void Bytecode::modifiers(const Modifiers *modifiers, const Variable *variable)
{
// we will need a pointer to the variable on the stack that we can pop off later on to modify it
variable->pointer(this);

// loop through all the modifiers
for (const auto &modifier : *modifiers)
{
// Push the token of the modifier (so the name of it) to the stack
string(modifier.get()->token());

// the stack currently contains { size, buffer, variable }

// pop the buffer and size from the stack (in reverse order) to get the modifier name
auto size = pop();
auto buffer = pop();

// call the native function to save the modifier to the variable on the stack
_stack.push(std::move(_callbacks.modifier(_userdata, buffer, size)));

// the stack currently contains { modifier, variable }

// pop the modifier
auto mod = pop();
// pop the latest value from the stack

// pop the variable from the stack
auto var = pop();

// Let's retrieve our parameters and if we have them generate them
Expand All @@ -761,6 +768,7 @@ void Bytecode::parameters(const Parameters *parameters)
// Construct the parameters through our callback
auto params = _callbacks.create_params(_userdata, _function.new_constant(parameters->size()));

// loop through all the parameters and add them to our params object one by one
for (auto &param : *parameters)
{
switch (param->type()) {
Expand All @@ -780,6 +788,7 @@ void Bytecode::parameters(const Parameters *parameters)
auto size = pop();
auto buffer = pop();

// actually append the string
_callbacks.params_append_string(_userdata, params, buffer, size);
break;
}
Expand Down

0 comments on commit 1f783b3

Please sign in to comment.