Changeset 519 for trunk/import

Show
Ignore:
Timestamp:
01/23/11 04:26:02 (1 year ago)
Author:
jmdavis
Message:

Added Throwable and default arguments to most Exception and Error constructors.

For whatever reason, a number of Exception and Error types didn't take a
Throwable for chaining exceptions, and most of them didn't have default
arguments for file and line number (some didn't even take file and line
number in the first place). So, most of the Exception and Error types in
core.exception and object_.d/object.di now have take an optional
Throwable argument and optional file and line number arguments which
default to FILE and LINE. In at least one case (AssertError?), I
couldn't make it take default arguments for file and line number without
breaking code, so it doesn't. But if I could do it and maintain
backwards comptability, I did. I also added unit tests to verify that
the various constructors work properly.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/import/object.di

    r509 r519  
    22 * Contains all implicitly declared types and variables. 
    33 * 
    4  * Copyright: Copyright Digital Mars 2000 - 2010
     4 * Copyright: Copyright Digital Mars 2000 - 2011
    55 * License:   <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. 
    66 * Authors:   Walter Bright, Sean Kelly 
    77 * 
    8  *          Copyright Digital Mars 2000 - 2009
     8 *          Copyright Digital Mars 2000 - 2011
    99 * Distributed under the Boost Software License, Version 1.0. 
    1010 *    (See accompanying file LICENSE_1_0.txt or copy at 
     
    317317class Exception : Throwable 
    318318{ 
    319     this(string msg, Throwable next = null); 
    320     this(string msg, string file, size_t line, Throwable next = null); 
     319    this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null); 
     320    this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__); 
    321321} 
    322322 
     
    324324class Error : Throwable 
    325325{ 
    326     this(string msg, Throwable next = null); 
    327     this(string msg, string file, size_t line, Throwable next = null); 
     326    this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__); 
     327    this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null); 
    328328    Throwable   bypassedException; 
    329329}