d: Merge dmd, druntime d8e3976a58, phobos 7a6e95688
[official-gcc.git] / gcc / d / dmd / rootobject.d
blob7c926fea0555383fae15823854bf377b83b5e379
1 /**
2 * Provide the root object that AST classes in dmd inherit from.
4 * Copyright: Copyright (C) 1999-2024 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/rootobject.d, _rootobject.d)
8 * Documentation: https://dlang.org/phobos/dmd_rootobject.html
9 * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/rootobject.d
12 module dmd.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;