diff gcc/d/dmd/root/object.h @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/d/dmd/root/object.h	Thu Feb 13 11:34:05 2020 +0900
@@ -0,0 +1,58 @@
+
+/* Copyright (C) 1999-2019 by The D Language Foundation, All Rights Reserved
+ * http://www.digitalmars.com
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
+ * https://github.com/dlang/dmd/blob/master/src/root/object.h
+ */
+
+#pragma once
+
+#include "dsystem.h"
+
+typedef size_t hash_t;
+
+struct OutBuffer;
+
+enum DYNCAST
+{
+    DYNCAST_OBJECT,
+    DYNCAST_EXPRESSION,
+    DYNCAST_DSYMBOL,
+    DYNCAST_TYPE,
+    DYNCAST_IDENTIFIER,
+    DYNCAST_TUPLE,
+    DYNCAST_PARAMETER,
+    DYNCAST_STATEMENT
+};
+
+/*
+ * Root of our class library.
+ */
+class RootObject
+{
+public:
+    RootObject() { }
+
+    virtual bool equals(RootObject *o);
+
+    /**
+     * Return <0, ==0, or >0 if this is less than, equal to, or greater than obj.
+     * Useful for sorting Objects.
+     */
+    virtual int compare(RootObject *obj);
+
+    /**
+     * Pretty-print an Object. Useful for debugging the old-fashioned way.
+     */
+    virtual void print();
+
+    virtual const char *toChars();
+    virtual void toBuffer(OutBuffer *buf);
+
+    /**
+     * Used as a replacement for dynamic_cast. Returns a unique number
+     * defined by the library user. For Object, the return value is 0.
+     */
+    virtual int dyncast() const;
+};