tipc
A TIP to LLVM compiler
TipCons.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "TipType.h"
4 #include <vector>
5 
14 class TipCons : public TipType {
15 public:
16  TipCons() = default;
17 
18  const std::vector<std::shared_ptr<TipType>> &getArguments() const;
19  void setArguments(std::vector<std::shared_ptr<TipType>> &args);
20  virtual int arity() const;
21  bool doMatch(TipType const *t) const;
22 
23  // delegate the obligation to override accept to subtypes
24 
25 protected:
26  TipCons(std::vector<std::shared_ptr<TipType>> arguments);
27  std::vector<std::shared_ptr<TipType>> arguments;
28 };
Abstract base class for all proper types.
Definition: TipCons.h:14
std::vector< std::shared_ptr< TipType > > arguments
Definition: TipCons.h:27
virtual int arity() const
Definition: TipCons.cpp:4
const std::vector< std::shared_ptr< TipType > > & getArguments() const
Definition: TipCons.cpp:36
bool doMatch(TipType const *t) const
Check for dynamic subtype and artity agreement We explicitly test the types here which is not robust ...
Definition: TipCons.cpp:19
void setArguments(std::vector< std::shared_ptr< TipType >> &args)
Definition: TipCons.cpp:32
TipCons()=default
Abstract base class of all types.
Definition: TipType.h:19