d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
[official-gcc.git] / gcc / d / dmd / root / rootobject.d
blob65c499ddf4eab3c87737248c4da35440fec598d6
1 /**
2 * Provide the root object that AST classes in dmd inherit from.
4 * Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
5 * Authors: Walter Bright, https://www.digitalmars.com
6 * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
7 * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/rootobject.d, root/_rootobject.d)
8 * Documentation: https://dlang.org/phobos/dmd_root_rootobject.html
9 * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/root/rootobject.d
12 module dmd.root.rootobject;
14 /***********************************************************
17 enum DYNCAST : int
19 object,
20 expression,
21 dsymbol,
22 type,
23 identifier,
24 tuple,
25 parameter,
26 statement,
27 condition,
28 templateparameter,
29 initializer,
32 /***********************************************************
35 extern (C++) class RootObject
37 this() nothrow pure @nogc @safe scope
41 bool equals(const RootObject o) const
43 return o is this;
46 const(char)* toChars() const
48 assert(0);
51 ///
52 extern(D) const(char)[] toString() const
54 import core.stdc.string : strlen;
55 auto p = this.toChars();
56 return p[0 .. strlen(p)];
59 DYNCAST dyncast() const nothrow pure @nogc @safe
61 return DYNCAST.object;