1 /**
2  * Forward-compatibility module for providing support for Phobos functionality
3  * not available in older versions of Phobos.
4  *
5  * Should not implement functionalitiy which is gone from the latest Phobos.
6  *
7  * Implementations copied/re-implemented from std.exception and std.traits;
8  *
9  * The baseline compatibility is D/Phobos 2.068.2
10  *
11  * Authors: $(HTTP erdani.org, Andrei Alexandrescu),
12  *            Jonathan M Davis,
13  *            $(HTTP digitalmars.com, Walter Bright),
14  *            Tomasz Stachowiak ($(D isExpressions)),
15  *            $(HTTP erdani.org, Andrei Alexandrescu),
16  *            Shin Fujishiro,
17  *            $(HTTP octarineparrot.com, Robert Clipsham),
18  *            $(HTTP klickverbot.at, David Nadlinger),
19  *            Kenji Hara,
20  *            Shoichi Kato,
21  *            Mike Bierlee (m.bierlee@lostmoment.com)
22  * Copyright: Copyright Digital Mars 2005 - 2009., Copyright Andrei Alexandrescu 2008-, Jonathan M Davis 2011-., 2014-2022 Mike Bierlee
23  * License:  $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0)
24  */
25 
26 module poodinis.polyfill;
27 
28 import std.exception;
29 
30 static if (!__traits(compiles, basicExceptionCtors))
31 {
32     mixin template basicExceptionCtors()
33     {
34         /++
35             Params:
36                 msg  = The message for the exception.
37                 file = The file where the exception occurred.
38                 line = The line number where the exception occurred.
39                 next = The previous exception in the chain of exceptions, if any.
40         +/
41         this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) @nogc @safe pure nothrow
42         {
43             super(msg, file, line, next);
44         }
45 
46         /++
47             Params:
48                 msg  = The message for the exception.
49                 next = The previous exception in the chain of exceptions.
50                 file = The file where the exception occurred.
51                 line = The line number where the exception occurred.
52         +/
53         this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__) @nogc @safe pure nothrow
54         {
55             super(msg, file, line, next);
56         }
57     }
58 }
59 else
60 {
61     public import std.exception : basicExceptionCtors;
62 }