mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Resolved #14
This commit is contained in:
@@ -46,7 +46,7 @@ var a = 1;
|
|||||||
print a;
|
print a;
|
||||||
|
|
||||||
//test scope will shadow higher scope on redefine
|
//test scope will shadow higher scope on redefine
|
||||||
var b = 3;
|
var b: int = 3;
|
||||||
{
|
{
|
||||||
var b = 4;
|
var b = 4;
|
||||||
print b;
|
print b;
|
||||||
|
|||||||
@@ -144,7 +144,14 @@ static int writeLiteralTypeToCache(LiteralArray* literalCache, Literal literal)
|
|||||||
//push the store to the cache, tweaking the type
|
//push the store to the cache, tweaking the type
|
||||||
Literal lit = TO_ARRAY_LITERAL(store);
|
Literal lit = TO_ARRAY_LITERAL(store);
|
||||||
lit.type = LITERAL_TYPE_INTERMEDIATE; //NOTE: tweaking the type usually isn't a good idea
|
lit.type = LITERAL_TYPE_INTERMEDIATE; //NOTE: tweaking the type usually isn't a good idea
|
||||||
return pushLiteralArray(literalCache, lit);
|
|
||||||
|
//BUGFIX: check if exactly this literal array exists
|
||||||
|
int index = findLiteralIndex(literalCache, lit);
|
||||||
|
if (index < 0) {
|
||||||
|
index = pushLiteralArray(literalCache, lit);
|
||||||
|
}
|
||||||
|
|
||||||
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int writeLiteralToCompiler(Compiler* compiler, Literal literal) {
|
static int writeLiteralToCompiler(Compiler* compiler, Literal literal) {
|
||||||
|
|||||||
@@ -400,6 +400,7 @@ bool literalsAreEqual(Literal lhs, Literal rhs) {
|
|||||||
return !strncmp(AS_STRING(lhs), AS_STRING(rhs), STRLEN(lhs));
|
return !strncmp(AS_STRING(lhs), AS_STRING(rhs), STRLEN(lhs));
|
||||||
|
|
||||||
case LITERAL_ARRAY:
|
case LITERAL_ARRAY:
|
||||||
|
case LITERAL_TYPE_INTERMEDIATE: //BUGFIX: used for storing types as an array
|
||||||
//mismatched sizes
|
//mismatched sizes
|
||||||
if (AS_ARRAY(lhs)->count != AS_ARRAY(rhs)->count) {
|
if (AS_ARRAY(lhs)->count != AS_ARRAY(rhs)->count) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user