d: Merge dmd, druntime d8e3976a58, phobos 7a6e95688
[official-gcc.git] / gcc / d / dmd / ctfe.h
blob72d895c715096a64f3b6c5fd4dbc8fc26a2e28d9
2 /* Compiler implementation of the D programming language
3 * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
4 * written by Walter Bright
5 * https://www.digitalmars.com
6 * Distributed under the Boost Software License, Version 1.0.
7 * https://www.boost.org/LICENSE_1_0.txt
8 * https://github.com/dlang/dmd/blob/master/src/dmd/ctfe.h
9 */
11 #pragma once
13 #include "tokens.h"
14 #include "expression.h"
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).
20 class ClassReferenceExp final : public Expression
22 public:
23 StructLiteralExp *value;
24 ClassDeclaration *originalClass();
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);
29 void accept(Visitor *v) override { v->visit(this); }
32 /**
33 An uninitialized value
35 class VoidInitExp final : public Expression
37 public:
38 VarDeclaration *var;
40 void accept(Visitor *v) override { v->visit(this); }
43 /**
44 Fake class which holds the thrown exception.
45 Used for implementing exception handling.
47 class ThrownExceptionExp final : public Expression
49 public:
50 ClassReferenceExp *thrown; // the thing being tossed
51 const char *toChars() const override;
52 void accept(Visitor *v) override { v->visit(this); }
55 /****************************************************************/
57 // This type is only used by the interpreter.
59 class CTFEExp final : public Expression
61 public:
62 const char *toChars() const override;