1 
2 /* Compiler implementation of the D programming language
3  * Copyright (C) 1999-2021 by The D Language Foundation, All Rights Reserved
4  * written by Walter Bright
5  * http://www.digitalmars.com
6  * Distributed under the Boost Software License, Version 1.0.
7  * http://www.boost.org/LICENSE_1_0.txt
8  * https://github.com/dlang/dmd/blob/master/src/dmd/ctfe.h
9  */
10 
11 #pragma once
12 
13 #include "tokens.h"
14 #include "expression.h"
15 
16 /**
17   A reference to a class, or an interface. We need this when we
18   point to a base class (we must record what the type is).
19  */
20 class ClassReferenceExp : public Expression
21 {
22 public:
23     StructLiteralExp *value;
24     ClassDeclaration *originalClass();
25 
26     /// Return index of the field, or -1 if not found
27     /// Same as getFieldIndex, but checks for a direct match with the VarDeclaration
28     int findFieldIndexByName(VarDeclaration *v);
accept(Visitor * v)29     void accept(Visitor *v) { v->visit(this); }
30 };
31 
32 /**
33   An uninitialized value
34  */
35 class VoidInitExp : public Expression
36 {
37 public:
38     VarDeclaration *var;
39 
40     const char *toChars() const;
accept(Visitor * v)41     void accept(Visitor *v) { v->visit(this); }
42 };
43 
44 /**
45   Fake class which holds the thrown exception.
46   Used for implementing exception handling.
47 */
48 class ThrownExceptionExp : public Expression
49 {
50 public:
51     ClassReferenceExp *thrown; // the thing being tossed
52     const char *toChars() const;
accept(Visitor * v)53     void accept(Visitor *v) { v->visit(this); }
54 };
55 
56 /****************************************************************/
57 
58 // This type is only used by the interpreter.
59 
60 class CTFEExp : public Expression
61 {
62 public:
63     const char *toChars() const;
64 };
65