Comment tweaks

This commit is contained in:
2026-04-12 15:02:07 +10:00
parent c0c03a4110
commit e24823924a
3 changed files with 12 additions and 3 deletions

View File

@@ -1,4 +1,13 @@
fn swap(a, b) {
return b, a;
}
print 1; var a = 42;
var b = 69;
var c;
var d;
//TODO: reverse the assignment bytecode order?
c, d = swap(a, b);

View File

@@ -801,6 +801,8 @@ static unsigned int writeInstructionVarDeclare(Toy_Bytecode** mb, Toy_AstVarDecl
static unsigned int writeInstructionAssign(Toy_Bytecode** mb, Toy_AstVarAssign ast, bool chainedAssignment) { static unsigned int writeInstructionAssign(Toy_Bytecode** mb, Toy_AstVarAssign ast, bool chainedAssignment) {
unsigned int result = 0; unsigned int result = 0;
//TODO: flip the order of target & value, to allow chained assignment AND multiple return values
//target is a variable name //target is a variable name
if (ast.target->type == TOY_AST_VALUE && TOY_VALUE_IS_STRING(ast.target->value.value)) { if (ast.target->type == TOY_AST_VALUE && TOY_VALUE_IS_STRING(ast.target->value.value)) {
//name string //name string

View File

@@ -356,8 +356,6 @@ static void processAccess(Toy_VM* vm) {
return; return;
} }
//URGENT: should I loop functions into the reference system?
//in the event of a certain subset of types, create references instead (these should only exist on the stack) //in the event of a certain subset of types, create references instead (these should only exist on the stack)
if (TOY_VALUE_IS_REFERENCE(*valuePtr) || TOY_VALUE_IS_ARRAY(*valuePtr) || TOY_VALUE_IS_TABLE(*valuePtr) || TOY_VALUE_IS_FUNCTION(*valuePtr)) { if (TOY_VALUE_IS_REFERENCE(*valuePtr) || TOY_VALUE_IS_ARRAY(*valuePtr) || TOY_VALUE_IS_TABLE(*valuePtr) || TOY_VALUE_IS_FUNCTION(*valuePtr)) {
Toy_Value ref = TOY_REFERENCE_FROM_POINTER(valuePtr); Toy_Value ref = TOY_REFERENCE_FROM_POINTER(valuePtr);