Replaced some incorrect 'in' uses with 'const'.

This commit is contained in:
kiith-sa 2012-09-13 21:37:28 +02:00
parent 4f78702a57
commit 58fc17197b
5 changed files with 26 additions and 26 deletions

12
cdc.d
View file

@ -484,7 +484,7 @@ struct CompileOptions
* Params: options = Compiler command line options. * Params: options = Compiler command line options.
* sources = Source files to compile. * sources = Source files to compile.
*/ */
this(string[] options, in string[] sources) this(string[] options, const string[] sources)
{ {
foreach(i, opt; options) foreach(i, opt; options)
{ {
@ -530,7 +530,7 @@ struct CompileOptions
* *
* Returns: Translated options. * Returns: Translated options.
*/ */
string[] get_options(in string compiler) string[] get_options(const string compiler)
{ {
string[] result = options_.dup; string[] result = options_.dup;
@ -593,7 +593,7 @@ struct CompileOptions
///Thrown at errors in execution of other processes (e.g. compiler commands). ///Thrown at errors in execution of other processes (e.g. compiler commands).
class CompileException : Exception class CompileException : Exception
{ {
this(in string message, in string file, in size_t line){super(message, file, line);} this(const string message, const string file, in size_t line){super(message, file, line);}
}; };
/** /**
@ -602,7 +602,7 @@ class CompileException : Exception
* Params: compiler = Compiler to execute. * Params: compiler = Compiler to execute.
* arguments = Compiler arguments. * arguments = Compiler arguments.
*/ */
void execute_compiler(in string compiler, string[] arguments) void execute_compiler(const string compiler, string[] arguments)
{ {
try try
{ {
@ -621,7 +621,7 @@ void execute_compiler(in string compiler, string[] arguments)
} }
///Thrown at errors in execution of other processes (e.g. compiler commands). ///Thrown at errors in execution of other processes (e.g. compiler commands).
class ProcessException : Exception {this(in string message){super(message);}}; class ProcessException : Exception {this(const string message){super(message);}};
/** /**
* Execute a command-line program and print its output. * Execute a command-line program and print its output.
@ -657,7 +657,7 @@ void execute(string command, string[] args)
* *
* Bugs: LDC fails to return any results. * Bugs: LDC fails to return any results.
*/ */
string[] scan(in string directory, string extensions ...) string[] scan(const string directory, string extensions ...)
{ {
string[] result; string[] result;
foreach(string name; dirEntries(directory, SpanMode.depth)) foreach(string name; dirEntries(directory, SpanMode.depth))

View file

@ -227,7 +227,7 @@ struct Emitter
} }
///Write a string to the file/stream. ///Write a string to the file/stream.
void writeString(in string str) @system void writeString(const string str) @system
{ {
try final switch(encoding_) try final switch(encoding_)
{ {
@ -759,7 +759,7 @@ struct Emitter
} }
///Process and write an anchor/alias. ///Process and write an anchor/alias.
void processAnchor(in string indicator) @trusted void processAnchor(const string indicator) @trusted
{ {
if(event_.anchor.isNull()) if(event_.anchor.isNull())
{ {
@ -857,7 +857,7 @@ struct Emitter
} }
///Prepare YAML version string for output. ///Prepare YAML version string for output.
static string prepareVersion(in string YAMLVersion) @trusted static string prepareVersion(const string YAMLVersion) @trusted
{ {
enforce(YAMLVersion.split(".")[0] == "1", enforce(YAMLVersion.split(".")[0] == "1",
new Error("Unsupported YAML version: " ~ YAMLVersion)); new Error("Unsupported YAML version: " ~ YAMLVersion));
@ -877,7 +877,7 @@ struct Emitter
} }
///Prepare tag directive handle for output. ///Prepare tag directive handle for output.
static string prepareTagHandle(in string handle) @trusted static string prepareTagHandle(const string handle) @trusted
{ {
enforce(handle !is null && handle != "", enforce(handle !is null && handle != "",
new Error("Tag handle must not be empty")); new Error("Tag handle must not be empty"));
@ -892,7 +892,7 @@ struct Emitter
} }
///Prepare tag directive prefix for output. ///Prepare tag directive prefix for output.
static string prepareTagPrefix(in string prefix) @trusted static string prepareTagPrefix(const string prefix) @trusted
{ {
enforce(prefix !is null && prefix != "", enforce(prefix !is null && prefix != "",
new Error("Tag prefix must not be empty")); new Error("Tag prefix must not be empty"));
@ -1179,7 +1179,7 @@ struct Emitter
void writeStreamEnd() @system {stream_.flush();} void writeStreamEnd() @system {stream_.flush();}
///Write an indicator (e.g. ":", "[", ">", etc.). ///Write an indicator (e.g. ":", "[", ">", etc.).
void writeIndicator(in string indicator, in bool needWhitespace, void writeIndicator(const string indicator, in bool needWhitespace,
in bool whitespace = false, in bool indentation = false) @system in bool whitespace = false, in bool indentation = false) @system
{ {
const bool prefixSpace = !whitespace_ && needWhitespace; const bool prefixSpace = !whitespace_ && needWhitespace;
@ -1222,7 +1222,7 @@ struct Emitter
} }
///Start new line. ///Start new line.
void writeLineBreak(in string data = null) @system void writeLineBreak(const string data = null) @system
{ {
whitespace_ = indentation_ = true; whitespace_ = indentation_ = true;
++line_; ++line_;
@ -1231,7 +1231,7 @@ struct Emitter
} }
///Write a YAML version directive. ///Write a YAML version directive.
void writeVersionDirective(in string versionText) @system void writeVersionDirective(const string versionText) @system
{ {
writeString("%YAML "); writeString("%YAML ");
writeString(versionText); writeString(versionText);
@ -1239,7 +1239,7 @@ struct Emitter
} }
///Write a tag directive. ///Write a tag directive.
void writeTagDirective(in string handle, in string prefix) @system void writeTagDirective(const string handle, const string prefix) @system
{ {
writeString("%TAG "); writeString("%TAG ");
writeString(handle); writeString(handle);
@ -1571,7 +1571,7 @@ struct ScalarWriter
size_t hintsIdx = 0; size_t hintsIdx = 0;
if(text_.length == 0){return hintsIdx;} if(text_.length == 0){return hintsIdx;}
dchar lastChar(in string str, ref size_t end) dchar lastChar(const string str, ref size_t end)
{ {
size_t idx = end = end - strideBack(str, end); size_t idx = end = end - strideBack(str, end);
return decode(text_, idx); return decode(text_, idx);

View file

@ -226,7 +226,7 @@ struct Node
* be in full form, e.g. "tag:yaml.org,2002:int", not * be in full form, e.g. "tag:yaml.org,2002:int", not
* a shortcut, like "!!int". * a shortcut, like "!!int".
*/ */
this(T)(T value, in string tag = null) @trusted this(T)(T value, const string tag = null) @trusted
if (isSomeString!T || (!isArray!T && !isAssociativeArray!T)) if (isSomeString!T || (!isArray!T && !isAssociativeArray!T))
{ {
tag_ = Tag(tag); tag_ = Tag(tag);
@ -283,7 +283,7 @@ struct Node
* auto set = Node([1, 2, 3, 4, 5], "tag:yaml.org,2002:set"); * auto set = Node([1, 2, 3, 4, 5], "tag:yaml.org,2002:set");
* -------------------- * --------------------
*/ */
this(T)(T[] array, in string tag = null) @safe this(T)(T[] array, const string tag = null) @safe
if (!isSomeString!(T[])) if (!isSomeString!(T[]))
{ {
tag_ = Tag(tag); tag_ = Tag(tag);
@ -348,7 +348,7 @@ struct Node
* auto pairs = Node([1 : "a", 2 : "b"], "tag:yaml.org,2002:pairs"); * auto pairs = Node([1 : "a", 2 : "b"], "tag:yaml.org,2002:pairs");
* -------------------- * --------------------
*/ */
this(K, V)(V[K] array, in string tag = null) @safe this(K, V)(V[K] array, const string tag = null) @safe
{ {
tag_ = Tag(tag); tag_ = Tag(tag);
@ -413,7 +413,7 @@ struct Node
* auto pairs = Node([1, 2], ["a", "b"], "tag:yaml.org,2002:pairs"); * auto pairs = Node([1, 2], ["a", "b"], "tag:yaml.org,2002:pairs");
* -------------------- * --------------------
*/ */
this(K, V)(K[] keys, V[] values, in string tag = null) @safe this(K, V)(K[] keys, V[] values, const string tag = null) @safe
if(!(isSomeString!(K[]) || isSomeString!(V[]))) if(!(isSomeString!(K[]) || isSomeString!(V[])))
in in
{ {

View file

@ -79,7 +79,7 @@ struct Token
* end = End position of the token. * end = End position of the token.
* value = Value of the token. * value = Value of the token.
*/ */
Token directiveToken(in Mark start, in Mark end, in string value) pure @safe nothrow Token directiveToken(const Mark start, const Mark end, const string value) pure @safe nothrow
{ {
return Token(value, start, end, TokenID.Directive); return Token(value, start, end, TokenID.Directive);
} }
@ -91,7 +91,7 @@ Token directiveToken(in Mark start, in Mark end, in string value) pure @safe not
* start = Start position of the token. * start = Start position of the token.
* end = End position of the token. * end = End position of the token.
*/ */
Token simpleToken(TokenID id)(in Mark start, in Mark end) pure @safe nothrow Token simpleToken(TokenID id)(const Mark start, const Mark end) pure @safe nothrow
{ {
return Token(null, start, end, id); return Token(null, start, end, id);
} }
@ -103,7 +103,7 @@ Token simpleToken(TokenID id)(in Mark start, in Mark end) pure @safe nothrow
* end = End position of the token. * end = End position of the token.
* encoding = Encoding of the stream. * encoding = Encoding of the stream.
*/ */
Token streamStartToken(in Mark start, in Mark end, in Encoding encoding) pure @safe nothrow Token streamStartToken(const Mark start, const Mark end, const Encoding encoding) pure @safe nothrow
{ {
return Token(null, start, end, TokenID.StreamStart, ScalarStyle.Invalid, encoding); return Token(null, start, end, TokenID.StreamStart, ScalarStyle.Invalid, encoding);
} }
@ -126,7 +126,7 @@ alias simpleToken!(TokenID.FlowEntry) flowEntryToken;
* end = End position of the token. * end = End position of the token.
* value = Value of the token. * value = Value of the token.
*/ */
Token simpleValueToken(TokenID id)(in Mark start, in Mark end, string value) pure @safe nothrow Token simpleValueToken(TokenID id)(const Mark start, const Mark end, string value) pure @safe nothrow
{ {
return Token(value, start, end, id); return Token(value, start, end, id);
} }
@ -144,7 +144,7 @@ alias simpleValueToken!(TokenID.Anchor) anchorToken;
* value = Value of the token. * value = Value of the token.
* style = Style of the token. * style = Style of the token.
*/ */
Token scalarToken(in Mark start, in Mark end, in string value, in ScalarStyle style) pure @safe nothrow Token scalarToken(const Mark start, const Mark end, const string value, in ScalarStyle style) pure @safe nothrow
{ {
return Token(value, start, end, TokenID.Scalar, style); return Token(value, start, end, TokenID.Scalar, style);
} }

View file

@ -24,7 +24,7 @@ struct ZeroString(string TypeName)
@disable int opCmp(ref ZeroString); @disable int opCmp(ref ZeroString);
///Construct a string. ///Construct a string.
this(in string str) pure nothrow @safe this(const string str) pure nothrow @safe
{ {
if(str is null || str == "") if(str is null || str == "")
{ {