Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Reverted recent changes to constructors for Throwable and Error.
Browse files Browse the repository at this point in the history
The changes to the other exception types remain, but apparently having
default file and line numbers on Throwable and Error causes some
problems with low-level stuff. And as Don points out, they really should
be abstract anyway, so the default arguments don't matter much anyay.
However, apparently, some changes have to be made to the compiler before
that can happen. So, for now, just the default arguments are fixed.
  • Loading branch information
jmdavis committed Jan 26, 2011
1 parent 4c62f1b commit bf8c089
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions import/object.di
Expand Up @@ -323,8 +323,8 @@ class Exception : Throwable

class Error : Throwable
{
this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__);
this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null);
this(string msg, Throwable next = null);
this(string msg, string file, size_t line, Throwable next = null);
Throwable bypassedException;
}

Expand Down
16 changes: 8 additions & 8 deletions src/object_.d
Expand Up @@ -1364,13 +1364,13 @@ unittest

class Error : Throwable
{
this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__)
this(string msg, Throwable next = null)
{
super(msg, file, line, next);
super(msg, next);
bypassedException = null;
}

this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null)
this(string msg, string file, size_t line, Throwable next = null)
{
super(msg, file, line, next);
bypassedException = null;
Expand All @@ -1385,17 +1385,17 @@ unittest
{
{
auto e = new Error("msg");
assert(e.file == __FILE__);
assert(e.line == __LINE__ - 2);
assert(e.file is null);
assert(e.line == 0);
assert(e.next is null);
assert(e.msg == "msg");
assert(e.bypassedException is null);
}

{
auto e = new Error("msg", new Exception("It's an Excepton!"), "hello", 42);
assert(e.file == "hello");
assert(e.line == 42);
auto e = new Error("msg", new Exception("It's an Excepton!"));
assert(e.file is null);
assert(e.line == 0);
assert(e.next !is null);
assert(e.msg == "msg");
assert(e.bypassedException is null);
Expand Down

0 comments on commit bf8c089

Please sign in to comment.