mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 06:44:07 +10:00
Comment tweaks
This commit is contained in:
@@ -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);
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user