aboutsummaryrefslogtreecommitdiff
path: root/include/value.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/value.h')
-rw-r--r--include/value.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/value.h b/include/value.h
index 7dd6d28..b90b446 100644
--- a/include/value.h
+++ b/include/value.h
@@ -6,7 +6,6 @@
#include <stdint.h>
#include "string_view.h"
#include "std_gc/list.h"
-#include "std_gc/hash_map.h"
typedef enum {
TSL_TYPE_NULL,
@@ -36,10 +35,16 @@ typedef struct {
/* This is an index to the function */
typedef int TslFunction;
+typedef struct TslHashMap TslHashMap;
+
struct TslValue {
union {
TslNumber number;
TslString *string;
+ /*
+ TODO: Make this an int that refers to the index in the bytecode which contains the string view.
+ Then the size of this union will be 8 bytes instead of 16 bytes on 64-bit systems.
+ */
TslStringView string_ref;
TslBool boolean;
TslBool null;
@@ -58,4 +63,9 @@ int tsl_value_equals(const TslValue *lhs, const TslValue *rhs);
/* This should be called before setting/modifying the data of the value */
void tsl_value_clear(TslValue *self);
+int tsl_value_add(const TslValue *lhs_value, const TslValue *rhs_value, TslValue *result);
+
+/* Returns NULL if index is out of bounds of the list */
+TslValue* tsl_string_ref_get(const TslStringView *self, double index);
+
#endif /* TSL_VALUE_H */