More work on binder type registration, support in REPL to show registered types.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-01-08 18:18:24 +01:00
parent 093ffde6bc
commit 8660933f27
12 changed files with 320 additions and 146 deletions

View File

@@ -48,7 +48,7 @@ namespace MalachScript {
uint32_t _hash;
public:
Identifier() : _str(nullptr), _length(0), _hash(0) {}
Identifier() : _str(empty.c_str()), _length(0), _hash(0) {}
constexpr Identifier(const char* c) : _str(c), _length(CalcLength(c)), _hash(Hash(c)) {}
constexpr Identifier(const char* c, size_t length) : _str(c), _length(length), _hash(Hash(c)) {}
constexpr Identifier(const char* c, size_t length, uint32_t hash) : _str(c), _length(length), _hash(hash) {}

View File

@@ -27,17 +27,17 @@ namespace MalachScript {
static constinit Identifier _autoName = "auto";
static Binder::BoundType _int8Type = Binder::BoundType(ClassAttr::None, sizeof(int8_t));
static Binder::BoundType _int16Type = Binder::BoundType(ClassAttr::None, sizeof(int16_t));
static Binder::BoundType _int32Type = Binder::BoundType(ClassAttr::None, sizeof(int32_t));
static Binder::BoundType _int64Type = Binder::BoundType(ClassAttr::None, sizeof(int64_t));
static Binder::BoundType _uint8Type = Binder::BoundType(ClassAttr::None, sizeof(uint8_t));
static Binder::BoundType _uint16Type = Binder::BoundType(ClassAttr::None, sizeof(uint16_t));
static Binder::BoundType _uint32Type = Binder::BoundType(ClassAttr::None, sizeof(uint32_t));
static Binder::BoundType _uint64Type = Binder::BoundType(ClassAttr::None, sizeof(uint64_t));
static Binder::BoundType _floatType = Binder::BoundType(ClassAttr::None, sizeof(float));
static Binder::BoundType _doubleType = Binder::BoundType(ClassAttr::None, sizeof(double));
static Binder::BoundType _boolType = Binder::BoundType(ClassAttr::None, sizeof(uint8_t));
static Binder::BoundType _int8Type = Binder::BoundType(_int8Name, ClassAttr::None, sizeof(int8_t));
static Binder::BoundType _int16Type = Binder::BoundType(_int16Name, ClassAttr::None, sizeof(int16_t));
static Binder::BoundType _int32Type = Binder::BoundType(_int32Name, ClassAttr::None, sizeof(int32_t));
static Binder::BoundType _int64Type = Binder::BoundType(_int64Name, ClassAttr::None, sizeof(int64_t));
static Binder::BoundType _uint8Type = Binder::BoundType(_uint8Name, ClassAttr::None, sizeof(uint8_t));
static Binder::BoundType _uint16Type = Binder::BoundType(_uint16Name, ClassAttr::None, sizeof(uint16_t));
static Binder::BoundType _uint32Type = Binder::BoundType(_uint32Name, ClassAttr::None, sizeof(uint32_t));
static Binder::BoundType _uint64Type = Binder::BoundType(_uint64Name, ClassAttr::None, sizeof(uint64_t));
static Binder::BoundType _floatType = Binder::BoundType(_floatName, ClassAttr::None, sizeof(float));
static Binder::BoundType _doubleType = Binder::BoundType(_doubleName, ClassAttr::None, sizeof(double));
static Binder::BoundType _boolType = Binder::BoundType(_boolName, ClassAttr::None, sizeof(uint8_t));
class PrimitiveTypes {
public: