LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
desugar-visitor.hh
Go to the documentation of this file.
1 
6 #ifndef OBJECT_DESUGAR_VISITOR_HH
7 # define OBJECT_DESUGAR_VISITOR_HH
8 
9 # include <astclone/cloner.hh>
10 # include <parse/tweast.hh>
11 # include <object/libobject.hh>
12 
13 namespace object
14 {
17  {
18  public:
21 
22  // Import overloaded virtual functions.
23  using super_type::operator();
24 
27 
29  virtual ~DesugarVisitor();
30 
31  public:
35  virtual void operator()(const ast::DecsList& e) override;
36 
39 
41  virtual void operator()(const ast::TypeDecs& e) override;
43  virtual void operator()(const ast::FunctionDec& e) override;
45  virtual void operator()(const ast::NameTy& e) override;
46 
48 
51 
53  virtual void operator()(const ast::VarDec& e) override;
55  virtual void operator()(const ast::ObjectExp& e) override;
57  virtual void operator()(const ast::AssignExp& e) override;
59  virtual void operator()(const ast::CallExp& e) override;
60 
62 
65 
67  virtual void operator()(const ast::FieldVar& e) override;
69  virtual void operator()(const ast::MethodCallExp& e) override;
70 
72 
78  virtual ast::exps_type* recurse_args(const ast::exps_type& actuals,
79  const type::Record& formals);
80 
82  typedef std::list<const type::Class*> classes_type;
83 
84  private:
87 
92  std::string type_symbol(const type::Type* type);
93 
96  std::string upcast_fun_name(const type::Class* from,
97  const type::Class* to);
100  std::string downcast_fun_name(const type::Class* from,
101  const type::Class* to);
102 
105  std::string dispatch_fun_name(const type::Class* owner,
106  const type::Method* method);
107 
111  void adapt_type(ast::Exp*& source_exp, const type::Class* source_type,
112  const type::Class* target_type);
113 
116 
124  ast::Exp* variant_exp(const type::Class* static_type,
125  const std::string& exact_type,
126  const field_inits_type& inits);
127 
129  ast::Exp* variant_exp(const type::Class* static_type,
130  const type::Class* dynamic_type,
131  const field_inits_type& inits);
132 
141  parse::Tweast* variant_ty(const type::Class* class_type);
142 
150  parse::Tweast* cast_function(const std::string& name,
151  const type::Class* source,
152  const type::Class* target,
153  const type::Class* exact_type);
154 
158  const type::Class* target);
159 
163  const type::Class* target);
164 
171  ast::Exp* dispatch_switch(const type::Class* class_type,
172  const type::Method* method);
173 
184  parse::Tweast* method_call(const misc::symbol& class_name,
185  const misc::symbol& method_name,
186  const std::string& target,
187  const ast::VarDecs::Ds& formals);
188 
190 
191  private:
194 
199  };
200 
201 } // namespace object
202 
203 #endif // !OBJECT_DESUGAR_VISITOR_HH