|
|
|
|
@ -95,7 +95,7 @@ class Context {
|
|
|
|
|
|
|
|
|
|
class Type {
|
|
|
|
|
public:
|
|
|
|
|
enum class Kind { Void, Int32, PtrInt32, Array, Function };
|
|
|
|
|
enum class Kind { Void, Int32, Float, PtrInt32, PtrFloat, Array, Function };
|
|
|
|
|
|
|
|
|
|
virtual ~Type() = default;
|
|
|
|
|
|
|
|
|
|
@ -104,7 +104,9 @@ class Type {
|
|
|
|
|
// Type::GetInt32Type() == Type::GetInt32Type()
|
|
|
|
|
static const std::shared_ptr<Type>& GetVoidType();
|
|
|
|
|
static const std::shared_ptr<Type>& GetInt32Type();
|
|
|
|
|
static const std::shared_ptr<Type>& GetFloatType();
|
|
|
|
|
static const std::shared_ptr<Type>& GetPtrInt32Type();
|
|
|
|
|
static const std::shared_ptr<Type>& GetPtrFloatType();
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
@ -112,7 +114,9 @@ class Type {
|
|
|
|
|
Kind GetKind() const { return kind_; }
|
|
|
|
|
bool IsVoid() const { return kind_ == Kind::Void; }
|
|
|
|
|
bool IsInt32() const { return kind_ == Kind::Int32; }
|
|
|
|
|
bool IsFloat() const { return kind_ == Kind::Float; }
|
|
|
|
|
bool IsPtrInt32() const { return kind_ == Kind::PtrInt32; }
|
|
|
|
|
bool IsPtrFloat() const { return kind_ == Kind::PtrFloat; }
|
|
|
|
|
bool IsArray() const { return kind_ == Kind::Array; }
|
|
|
|
|
bool IsFunction() const { return kind_ == Kind::Function; }
|
|
|
|
|
|
|
|
|
|
|