mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Resolved #38
This commit is contained in:
20
scripts/test/dot-assignments-bugfix.toy
Normal file
20
scripts/test/dot-assignments-bugfix.toy
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
NOTES: For some reason, this code results in the error:
|
||||||
|
Undeclared variable "inner"
|
||||||
|
|
||||||
|
It only occurs under these very specific conditions.
|
||||||
|
|
||||||
|
It appears to be a compiler issue, see issue #38 for more info.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
fn _getValue(self) {
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
var cache;
|
||||||
|
cache = 42.getValue(); //assignment, rather than declaration, allows the bug
|
||||||
|
|
||||||
|
|
||||||
|
print "All good";
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#define TOY_VERSION_MAJOR 0
|
#define TOY_VERSION_MAJOR 0
|
||||||
#define TOY_VERSION_MINOR 6
|
#define TOY_VERSION_MINOR 6
|
||||||
#define TOY_VERSION_PATCH 0
|
#define TOY_VERSION_PATCH 1
|
||||||
#define TOY_VERSION_BUILD __DATE__ " " __TIME__
|
#define TOY_VERSION_BUILD __DATE__ " " __TIME__
|
||||||
|
|
||||||
//platform exports/imports
|
//platform exports/imports
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ static Opcode writeCompilerWithJumps(Compiler* compiler, ASTNode* node, void* br
|
|||||||
return node->binary.opcode;
|
return node->binary.opcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret != OP_EOF && (node->binary.opcode == OP_AND || node->binary.opcode == OP_OR || (node->binary.opcode >= OP_COMPARE_EQUAL && node->binary.opcode <= OP_INVERT))) {
|
if (ret != OP_EOF && (node->binary.opcode == OP_VAR_ASSIGN || node->binary.opcode == OP_AND || node->binary.opcode == OP_OR || (node->binary.opcode >= OP_COMPARE_EQUAL && node->binary.opcode <= OP_INVERT))) {
|
||||||
compiler->bytecode[compiler->count++] = (unsigned char)ret; //1 byte
|
compiler->bytecode[compiler->count++] = (unsigned char)ret; //1 byte
|
||||||
ret = OP_EOF; //untangle in this case
|
ret = OP_EOF; //untangle in this case
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ int main() {
|
|||||||
"coercions.toy",
|
"coercions.toy",
|
||||||
"comparisons.toy",
|
"comparisons.toy",
|
||||||
"dot-and-matrix.toy",
|
"dot-and-matrix.toy",
|
||||||
|
"dot-assignments-bugfix.toy",
|
||||||
"dot-chaining.toy",
|
"dot-chaining.toy",
|
||||||
"functions.toy",
|
"functions.toy",
|
||||||
"imports-and-exports.toy",
|
"imports-and-exports.toy",
|
||||||
|
|||||||
Reference in New Issue
Block a user