tipc
A TIP to LLVM compiler
TipAlpha.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "TipCons.h"
4 #include "TipVar.h"
5 #include <string>
6 
10 class TipAlpha : public TipVar {
11 public:
12  TipAlpha() = delete;
13 
19 
25  TipAlpha(ASTNode *node, std::string const name);
26 
33  TipAlpha(ASTNode *node, ASTNode *context, std::string const name);
34 
35  ASTNode *getContext() const;
36  std::string const &getName() const;
37 
38  bool operator==(const TipType &other) const override;
39  bool operator!=(const TipType &other) const override;
40 
41  void accept(TipTypeVisitor *visitor) override;
42 
43 protected:
44  // Node for distinguishing free type variables based on usage context
46 
47  std::ostream &print(std::ostream &out) const override;
48 
49  std::string const name;
50 };
Abstract base class for all AST nodes.
Definition: ASTNode.h:34
Class for free type variables.
Definition: TipAlpha.h:10
TipAlpha()=delete
std::string const name
Definition: TipAlpha.h:49
ASTNode * context
Definition: TipAlpha.h:45
bool operator==(const TipType &other) const override
Definition: TipAlpha.cpp:29
bool operator!=(const TipType &other) const override
Definition: TipAlpha.cpp:40
ASTNode * getContext() const
Definition: TipAlpha.cpp:44
std::ostream & print(std::ostream &out) const override
Definition: TipAlpha.cpp:14
std::string const & getName() const
Definition: TipAlpha.cpp:46
void accept(TipTypeVisitor *visitor) override
Definition: TipAlpha.cpp:48
Base class for TIP type visitors.
Definition: TipTypeVisitor.h:24
Abstract base class of all types.
Definition: TipType.h:19
Class representing a type variable.
Definition: TipVar.h:13
ASTNode * node
Definition: TipVar.h:29