summaryrefslogtreecommitdiff
path: root/graphics/asymptote/newexp.h
blob: dd64584a6a06b65e1d2019beffa53291f58a6c41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*****
 * newexp.h
 * Andy Hammerlindl 2003/07/28
 *
 * Handles the abstract syntax for expressions the create new objects,
 * such as record, array, and function constructors.
 *****/

#ifndef NEWEXP_H
#define NEWEXP_H

#include "exp.h"
#include "dec.h"
#include "fundec.h"
#include "entry.h"

namespace absyntax {

typedef fundef newFunctionExp;

class newRecordExp : public exp {
  ty *result;

  static bool encodeLevel(position pos, coenv &e, trans::tyEntry *ent);
public:
  newRecordExp(position pos, ty *result)
    : exp(pos), result(result) {}

  void prettyprint(ostream &out, Int indent);

  static types::ty *transFromTyEntry(position pos, coenv &e,
                                     trans::tyEntry *ent);

  types::ty *trans(coenv &e);
  types::ty *getType(coenv &e);
};
  
class newArrayExp : public exp {
  ty *celltype;
  explist *dimexps;
  dimensions *dims;
  arrayinit *ai;

public:
  newArrayExp(position pos,
              ty *celltype,
              explist *dimexps,
              dimensions *dims,
              arrayinit *ai)
    : exp(pos), celltype(celltype), dimexps(dimexps), dims(dims), ai(ai) {}

  void prettyprint(ostream &out, Int indent);

  types::ty *trans(coenv &e);
  types::ty *getType(coenv &e);
};
  
} // namespace absyntax

#endif