|
|
|
|
@ -95,7 +95,7 @@ class Context {
|
|
|
|
|
|
|
|
|
|
class Type {
|
|
|
|
|
public:
|
|
|
|
|
enum class Kind { Void, Int32, Float, PtrInt32, PtrFloat, Array, Function };
|
|
|
|
|
enum class Kind { Void, Int32, Float, PtrInt32, PtrFloat, Label, Array, Function };
|
|
|
|
|
|
|
|
|
|
virtual ~Type() = default;
|
|
|
|
|
|
|
|
|
|
@ -107,6 +107,7 @@ class Type {
|
|
|
|
|
static const std::shared_ptr<Type>& GetFloatType();
|
|
|
|
|
static const std::shared_ptr<Type>& GetPtrInt32Type();
|
|
|
|
|
static const std::shared_ptr<Type>& GetPtrFloatType();
|
|
|
|
|
static const std::shared_ptr<Type>& GetLabelType();
|
|
|
|
|
static std::shared_ptr<ArrayType> GetArrayType(std::shared_ptr<Type> elem, std::vector<int> dims);
|
|
|
|
|
static std::shared_ptr<FunctionType> GetFunctionType(std::shared_ptr<Type> ret, std::vector<std::shared_ptr<Type>> params);
|
|
|
|
|
|
|
|
|
|
@ -117,6 +118,7 @@ class Type {
|
|
|
|
|
bool IsFloat() const { return kind_ == Kind::Float; }
|
|
|
|
|
bool IsPtrInt32() const { return kind_ == Kind::PtrInt32; }
|
|
|
|
|
bool IsPtrFloat() const { return kind_ == Kind::PtrFloat; }
|
|
|
|
|
bool IsLabel() const { return kind_ == Kind::Label; }
|
|
|
|
|
bool IsArray() const { return kind_ == Kind::Array; }
|
|
|
|
|
bool IsFunction() const { return kind_ == Kind::Function; }
|
|
|
|
|
|
|
|
|
|
|