tipc
A TIP to LLVM compiler
TipFunction.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "TipCons.h"
4 #include "TipType.h"
5 #include <memory>
6 #include <string>
7 #include <vector>
8 
14 class TipFunction : public TipCons {
15 public:
16  TipFunction() = delete;
17  TipFunction(std::vector<std::shared_ptr<TipType>> params,
18  std::shared_ptr<TipType> ret);
19 
20  std::vector<std::shared_ptr<TipType>> getParamTypes() const;
21  std::shared_ptr<TipType> getReturnType() const;
22 
23  bool operator==(const TipType &other) const override;
24  bool operator!=(const TipType &other) const override;
25 
26  void accept(TipTypeVisitor *visitor) override;
27 
28 protected:
29  std::ostream &print(std::ostream &out) const override;
30 
31 private:
32  std::vector<std::shared_ptr<TipType>>
33  combine(std::vector<std::shared_ptr<TipType>> params,
34  std::shared_ptr<TipType> ret);
35 };
Abstract base class for all proper types.
Definition: TipCons.h:14
A proper type representing a function.
Definition: TipFunction.h:14
std::vector< std::shared_ptr< TipType > > getParamTypes() const
Definition: TipFunction.cpp:17
void accept(TipTypeVisitor *visitor) override
Definition: TipFunction.cpp:60
bool operator==(const TipType &other) const override
Definition: TipFunction.cpp:37
TipFunction()=delete
std::shared_ptr< TipType > getReturnType() const
Definition: TipFunction.cpp:23
std::ostream & print(std::ostream &out) const override
Definition: TipFunction.cpp:27
bool operator!=(const TipType &other) const override
Definition: TipFunction.cpp:56
Base class for TIP type visitors.
Definition: TipTypeVisitor.h:24
Abstract base class of all types.
Definition: TipType.h:19