forked from vectorgraphics/asymptote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
coenv.h
40 lines (31 loc) · 908 Bytes
/
coenv.h
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
/*****
* coenv.h
* Andy Hammerlindl 2004/11/18
*
* Bundles the env and coder classes needed in translating the abstract syntax
* tree. It also also implements some functions that involve both the env and
* coder, such as implicitCast().
*****/
#ifndef COENV_H
#define COENV_H
#include "env.h"
#include "coder.h"
namespace trans {
class coenv {
public:
coder &c;
env &e;
coenv(coder &c, env &e)
: c(c), e(e) {}
// This is used when an expression of type source needs to be an
// expression of type target.
// If it is allowed, the casting instructions (if any) will be added.
// Otherwise, an appropriate error message will be printed.
bool implicitCast(position pos, ty *target, ty *source);
bool explicitCast(position pos, ty *target, ty *source);
void add(protoenv &source, varEntry *qualifier) {
e.add(source, qualifier, c);
}
};
} // namespace trans
#endif