mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 22:21:09 +03:00
Sed "@safe pure nothrow"
This commit is contained in:
parent
24fffa6ecc
commit
d609bd332f
11 changed files with 28 additions and 28 deletions
|
@ -3255,12 +3255,12 @@ if (isSomeChar!C)
|
||||||
getFirst();
|
getFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
@property bool empty() const pure nothrow @safe
|
@property bool empty() const @safe pure nothrow
|
||||||
{
|
{
|
||||||
return _s.empty;
|
return _s.empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property inout(Result) save() inout pure nothrow @safe
|
@property inout(Result) save() inout @safe pure nothrow
|
||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -4418,7 +4418,7 @@ unittest
|
||||||
{
|
{
|
||||||
import std.exception : assertCTFEable;
|
import std.exception : assertCTFEable;
|
||||||
|
|
||||||
void dg() pure @safe nothrow
|
void dg() @safe pure nothrow
|
||||||
{
|
{
|
||||||
byte[] sarr = [1, 2, 3, 4];
|
byte[] sarr = [1, 2, 3, 4];
|
||||||
ubyte[] uarr = [1, 2, 3, 4];
|
ubyte[] uarr = [1, 2, 3, 4];
|
||||||
|
|
|
@ -385,7 +385,7 @@ if (isDynamicArray!T && allSatisfy!(isIntegral, I))
|
||||||
return arrayAllocImpl!(true, T, ST)(sizes);
|
return arrayAllocImpl!(true, T, ST)(sizes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@safe nothrow pure unittest
|
@safe pure nothrow unittest
|
||||||
{
|
{
|
||||||
cast(void)minimallyInitializedArray!(int[][][][][])();
|
cast(void)minimallyInitializedArray!(int[][][][][])();
|
||||||
double[] arr = minimallyInitializedArray!(double[])(100);
|
double[] arr = minimallyInitializedArray!(double[])(100);
|
||||||
|
|
|
@ -524,7 +524,7 @@ private:
|
||||||
}
|
}
|
||||||
+/
|
+/
|
||||||
private:
|
private:
|
||||||
void negate() pure nothrow @safe
|
void negate() @safe pure nothrow
|
||||||
{
|
{
|
||||||
if (!data.isZero())
|
if (!data.isZero())
|
||||||
sign = !sign;
|
sign = !sign;
|
||||||
|
|
|
@ -119,7 +119,7 @@ struct Complex(T) if (isFloatingPoint!T)
|
||||||
See the $(LINK2 std_format.html, std.format) and $(XREF string, format)
|
See the $(LINK2 std_format.html, std.format) and $(XREF string, format)
|
||||||
documentation for more information.
|
documentation for more information.
|
||||||
*/
|
*/
|
||||||
string toString() const /* TODO: pure @safe nothrow */
|
string toString() const /* TODO: @safe pure nothrow */
|
||||||
{
|
{
|
||||||
import std.exception : assumeUnique;
|
import std.exception : assumeUnique;
|
||||||
char[] buf;
|
char[] buf;
|
||||||
|
|
|
@ -3998,7 +3998,7 @@ address.
|
||||||
Returns: A pointer to the newly constructed object (which is the same
|
Returns: A pointer to the newly constructed object (which is the same
|
||||||
as $(D chunk)).
|
as $(D chunk)).
|
||||||
*/
|
*/
|
||||||
T* emplace(T)(T* chunk) @safe nothrow pure
|
T* emplace(T)(T* chunk) @safe pure nothrow
|
||||||
{
|
{
|
||||||
emplaceRef!T(*chunk);
|
emplaceRef!T(*chunk);
|
||||||
return chunk;
|
return chunk;
|
||||||
|
|
|
@ -914,7 +914,7 @@ unittest {
|
||||||
static assert(is(typeof(dg_trusted) == int delegate() @trusted));
|
static assert(is(typeof(dg_trusted) == int delegate() @trusted));
|
||||||
static assert(is(typeof(dg_system) == int delegate() @system));
|
static assert(is(typeof(dg_system) == int delegate() @system));
|
||||||
static assert(is(typeof(dg_pure_nothrow) == int delegate() pure nothrow));
|
static assert(is(typeof(dg_pure_nothrow) == int delegate() pure nothrow));
|
||||||
//static assert(is(typeof(dg_pure_nothrow_safe) == int delegate() pure nothrow @safe));
|
//static assert(is(typeof(dg_pure_nothrow_safe) == int delegate() @safe pure nothrow));
|
||||||
|
|
||||||
assert(dg_ref() == refvar);
|
assert(dg_ref() == refvar);
|
||||||
assert(dg_pure() == 1);
|
assert(dg_pure() == 1);
|
||||||
|
|
|
@ -5958,7 +5958,7 @@ unittest
|
||||||
assert(fabs(r - 2.18504f) < .00001);
|
assert(fabs(r - 2.18504f) < .00001);
|
||||||
}
|
}
|
||||||
|
|
||||||
pure @safe nothrow unittest
|
@safe pure nothrow unittest
|
||||||
{
|
{
|
||||||
// issue 6381: floor/ceil should be usable in pure function.
|
// issue 6381: floor/ceil should be usable in pure function.
|
||||||
auto x = floor(1.2);
|
auto x = floor(1.2);
|
||||||
|
|
|
@ -1392,7 +1392,7 @@ private:
|
||||||
public:
|
public:
|
||||||
// This is used in parallel_algorithm but is too unstable to document
|
// This is used in parallel_algorithm but is too unstable to document
|
||||||
// as public API.
|
// as public API.
|
||||||
size_t defaultWorkUnitSize(size_t rangeLen) const pure nothrow @safe
|
size_t defaultWorkUnitSize(size_t rangeLen) const @safe pure nothrow
|
||||||
{
|
{
|
||||||
if(this.size == 0)
|
if(this.size == 0)
|
||||||
{
|
{
|
||||||
|
@ -1922,7 +1922,7 @@ public:
|
||||||
{
|
{
|
||||||
size_t _length;
|
size_t _length;
|
||||||
|
|
||||||
public @property size_t length() const pure nothrow @safe
|
public @property size_t length() const @safe pure nothrow
|
||||||
{
|
{
|
||||||
return _length;
|
return _length;
|
||||||
}
|
}
|
||||||
|
@ -2138,7 +2138,7 @@ public:
|
||||||
size_t _length;
|
size_t _length;
|
||||||
|
|
||||||
// Available if hasLength!S.
|
// Available if hasLength!S.
|
||||||
public @property size_t length() const pure nothrow @safe
|
public @property size_t length() const @safe pure nothrow
|
||||||
{
|
{
|
||||||
return _length;
|
return _length;
|
||||||
}
|
}
|
||||||
|
@ -3883,7 +3883,7 @@ private struct RoundRobinBuffer(C1, C2)
|
||||||
primed = false;
|
primed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool empty() @property const pure nothrow @safe
|
bool empty() @property const @safe pure nothrow
|
||||||
{
|
{
|
||||||
return _empty;
|
return _empty;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1214,7 +1214,7 @@ Example:
|
||||||
--------------------
|
--------------------
|
||||||
alias FA = FunctionAttribute; // shorten the enum name
|
alias FA = FunctionAttribute; // shorten the enum name
|
||||||
|
|
||||||
real func(real x) pure nothrow @safe
|
real func(real x) @safe pure nothrow
|
||||||
{
|
{
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1305,7 +1305,7 @@ Constructor initializing $(D this) with $(D value).
|
||||||
/**
|
/**
|
||||||
Returns $(D true) if and only if $(D this) is in the null state.
|
Returns $(D true) if and only if $(D this) is in the null state.
|
||||||
*/
|
*/
|
||||||
@property bool isNull() const pure nothrow @safe
|
@property bool isNull() const @safe pure nothrow
|
||||||
{
|
{
|
||||||
return _isNull;
|
return _isNull;
|
||||||
}
|
}
|
||||||
|
@ -1333,7 +1333,7 @@ succeeds, $(D this) becomes non-null.
|
||||||
Gets the value. $(D this) must not be in the null state.
|
Gets the value. $(D this) must not be in the null state.
|
||||||
This function is also called for the implicit conversion to $(D T).
|
This function is also called for the implicit conversion to $(D T).
|
||||||
*/
|
*/
|
||||||
@property ref inout(T) get() inout pure nothrow @safe
|
@property ref inout(T) get() inout @safe pure nothrow
|
||||||
{
|
{
|
||||||
enum message = "Called `get' on null Nullable!" ~ T.stringof ~ ".";
|
enum message = "Called `get' on null Nullable!" ~ T.stringof ~ ".";
|
||||||
assert(!isNull, message);
|
assert(!isNull, message);
|
||||||
|
@ -1408,7 +1408,7 @@ unittest
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
// Ensure Nullable can be used in pure/nothrow/@safe environment.
|
// Ensure Nullable can be used in pure/nothrow/@safe environment.
|
||||||
function() pure nothrow @safe
|
function() @safe pure nothrow
|
||||||
{
|
{
|
||||||
Nullable!int n;
|
Nullable!int n;
|
||||||
assert(n.isNull);
|
assert(n.isNull);
|
||||||
|
@ -1680,7 +1680,7 @@ unittest
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
// Ensure Nullable can be used in pure/nothrow/@safe environment.
|
// Ensure Nullable can be used in pure/nothrow/@safe environment.
|
||||||
function() pure nothrow @safe
|
function() @safe pure nothrow
|
||||||
{
|
{
|
||||||
Nullable!(int, int.min) n;
|
Nullable!(int, int.min) n;
|
||||||
assert(n.isNull);
|
assert(n.isNull);
|
||||||
|
@ -1749,7 +1749,7 @@ struct NullableRef(T)
|
||||||
/**
|
/**
|
||||||
Constructor binding $(D this) with $(D value).
|
Constructor binding $(D this) with $(D value).
|
||||||
*/
|
*/
|
||||||
this(T* value) pure nothrow @safe
|
this(T* value) @safe pure nothrow
|
||||||
{
|
{
|
||||||
_value = value;
|
_value = value;
|
||||||
}
|
}
|
||||||
|
@ -1757,7 +1757,7 @@ Constructor binding $(D this) with $(D value).
|
||||||
/**
|
/**
|
||||||
Binds the internal state to $(D value).
|
Binds the internal state to $(D value).
|
||||||
*/
|
*/
|
||||||
void bind(T* value) pure nothrow @safe
|
void bind(T* value) @safe pure nothrow
|
||||||
{
|
{
|
||||||
_value = value;
|
_value = value;
|
||||||
}
|
}
|
||||||
|
@ -1765,7 +1765,7 @@ Binds the internal state to $(D value).
|
||||||
/**
|
/**
|
||||||
Returns $(D true) if and only if $(D this) is in the null state.
|
Returns $(D true) if and only if $(D this) is in the null state.
|
||||||
*/
|
*/
|
||||||
@property bool isNull() const pure nothrow @safe
|
@property bool isNull() const @safe pure nothrow
|
||||||
{
|
{
|
||||||
return _value is null;
|
return _value is null;
|
||||||
}
|
}
|
||||||
|
@ -1773,7 +1773,7 @@ Returns $(D true) if and only if $(D this) is in the null state.
|
||||||
/**
|
/**
|
||||||
Forces $(D this) to the null state.
|
Forces $(D this) to the null state.
|
||||||
*/
|
*/
|
||||||
void nullify() pure nothrow @safe
|
void nullify() @safe pure nothrow
|
||||||
{
|
{
|
||||||
_value = null;
|
_value = null;
|
||||||
}
|
}
|
||||||
|
@ -1793,7 +1793,7 @@ Assigns $(D value) to the internally-held state.
|
||||||
Gets the value. $(D this) must not be in the null state.
|
Gets the value. $(D this) must not be in the null state.
|
||||||
This function is also called for the implicit conversion to $(D T).
|
This function is also called for the implicit conversion to $(D T).
|
||||||
*/
|
*/
|
||||||
@property ref inout(T) get() inout pure nothrow @safe
|
@property ref inout(T) get() inout @safe pure nothrow
|
||||||
{
|
{
|
||||||
enum message = "Called `get' on null NullableRef!" ~ T.stringof ~ ".";
|
enum message = "Called `get' on null NullableRef!" ~ T.stringof ~ ".";
|
||||||
assert(!isNull, message);
|
assert(!isNull, message);
|
||||||
|
@ -1844,7 +1844,7 @@ unittest
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
// Ensure NullableRef can be used in pure/nothrow/@safe environment.
|
// Ensure NullableRef can be used in pure/nothrow/@safe environment.
|
||||||
function() pure nothrow @safe
|
function() @safe pure nothrow
|
||||||
{
|
{
|
||||||
auto storage = new int;
|
auto storage = new int;
|
||||||
*storage = 19902;
|
*storage = 19902;
|
||||||
|
@ -3474,7 +3474,7 @@ unittest
|
||||||
alias int F2() pure nothrow;
|
alias int F2() pure nothrow;
|
||||||
static assert(is(DerivedFunctionType!(F1, F2) == F2));
|
static assert(is(DerivedFunctionType!(F1, F2) == F2));
|
||||||
alias int F3() @safe;
|
alias int F3() @safe;
|
||||||
alias int F23() pure nothrow @safe;
|
alias int F23() @safe pure nothrow;
|
||||||
static assert(is(DerivedFunctionType!(F2, F3) == F23));
|
static assert(is(DerivedFunctionType!(F2, F3) == F23));
|
||||||
|
|
||||||
// return type covariance
|
// return type covariance
|
||||||
|
|
|
@ -108,7 +108,7 @@ import std.conv, std.digest.md, std.digest.sha, std.random, std.range, std.strin
|
||||||
public struct UUID
|
public struct UUID
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@safe nothrow pure char toChar(size_t i) const
|
@safe pure nothrow char toChar(size_t i) const
|
||||||
{
|
{
|
||||||
if(i <= 9)
|
if(i <= 9)
|
||||||
return cast(char)('0' + i);
|
return cast(char)('0' + i);
|
||||||
|
@ -116,7 +116,7 @@ public struct UUID
|
||||||
return cast(char)('a' + (i-10));
|
return cast(char)('a' + (i-10));
|
||||||
}
|
}
|
||||||
|
|
||||||
@safe nothrow pure char[36] _toString() const
|
@safe pure nothrow char[36] _toString() const
|
||||||
{
|
{
|
||||||
char[36] result;
|
char[36] result;
|
||||||
|
|
||||||
|
@ -625,7 +625,7 @@ public struct UUID
|
||||||
/**
|
/**
|
||||||
* Swap the data of this UUID with the data of rhs.
|
* Swap the data of this UUID with the data of rhs.
|
||||||
*/
|
*/
|
||||||
@safe nothrow pure void swap(ref UUID rhs)
|
@safe pure nothrow void swap(ref UUID rhs)
|
||||||
{
|
{
|
||||||
auto bck = data;
|
auto bck = data;
|
||||||
data = rhs.data;
|
data = rhs.data;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue