mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Resolved #25, Indexing an array with a non-integer causes an error
This commit is contained in:
@@ -26,6 +26,7 @@ typedef enum {
|
||||
LITERAL_FUNCTION_INTERMEDIATE, //used to process functions in the compiler only
|
||||
LITERAL_FUNCTION_ARG_REST, //used to process function rest parameters only
|
||||
LITERAL_FUNCTION_NATIVE, //for handling native functions only
|
||||
LITERAL_INDEX_BLANK, //for blank indexing i.e. arr[:]
|
||||
} LiteralType;
|
||||
|
||||
typedef struct {
|
||||
@@ -104,6 +105,10 @@ typedef struct {
|
||||
#define TO_TYPE_LITERAL(value, c) ((Literal){ LITERAL_TYPE, { .type.typeOf = value, .type.constant = c, .type.subtypes = NULL, .type.capacity = 0, .type.count = 0 }})
|
||||
#define TO_OPAQUE_LITERAL(value, t) ((Literal){ LITERAL_OPAQUE, { .opaque.ptr = value, .opaque.tag = t }})
|
||||
|
||||
//BUGFIX: For blank indexing
|
||||
#define IS_INDEX_BLANK(value) ((value).type == LITERAL_INDEX_BLANK)
|
||||
#define TO_INDEX_BLANK_LITERAL ((Literal){LITERAL_INDEX_BLANK, { .integer = 0 }})
|
||||
|
||||
TOY_API void freeLiteral(Literal literal);
|
||||
|
||||
#define IS_TRUTHY(x) _isTruthy(x)
|
||||
|
||||
Reference in New Issue
Block a user