From 58fc17197bc8ae6180316be07f5ec065dc4e878f Mon Sep 17 00:00:00 2001 From: kiith-sa Date: Thu, 13 Sep 2012 21:37:28 +0200 Subject: [PATCH] Replaced some incorrect 'in' uses with 'const'. --- cdc.d | 12 ++++++------ dyaml/emitter.d | 20 ++++++++++---------- dyaml/node.d | 8 ++++---- dyaml/token.d | 10 +++++----- dyaml/zerostring.d | 2 +- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/cdc.d b/cdc.d index 0d9e40a..92a389b 100755 --- a/cdc.d +++ b/cdc.d @@ -484,7 +484,7 @@ struct CompileOptions * Params: options = Compiler command line options. * sources = Source files to compile. */ - this(string[] options, in string[] sources) + this(string[] options, const string[] sources) { foreach(i, opt; options) { @@ -530,7 +530,7 @@ struct CompileOptions * * Returns: Translated options. */ - string[] get_options(in string compiler) + string[] get_options(const string compiler) { string[] result = options_.dup; @@ -593,7 +593,7 @@ struct CompileOptions ///Thrown at errors in execution of other processes (e.g. compiler commands). 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. * arguments = Compiler arguments. */ -void execute_compiler(in string compiler, string[] arguments) +void execute_compiler(const string compiler, string[] arguments) { 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). -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. @@ -657,7 +657,7 @@ void execute(string command, string[] args) * * Bugs: LDC fails to return any results. */ -string[] scan(in string directory, string extensions ...) +string[] scan(const string directory, string extensions ...) { string[] result; foreach(string name; dirEntries(directory, SpanMode.depth)) diff --git a/dyaml/emitter.d b/dyaml/emitter.d index 981b5ae..43002c8 100644 --- a/dyaml/emitter.d +++ b/dyaml/emitter.d @@ -227,7 +227,7 @@ struct Emitter } ///Write a string to the file/stream. - void writeString(in string str) @system + void writeString(const string str) @system { try final switch(encoding_) { @@ -759,7 +759,7 @@ struct Emitter } ///Process and write an anchor/alias. - void processAnchor(in string indicator) @trusted + void processAnchor(const string indicator) @trusted { if(event_.anchor.isNull()) { @@ -857,7 +857,7 @@ struct Emitter } ///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", new Error("Unsupported YAML version: " ~ YAMLVersion)); @@ -877,7 +877,7 @@ struct Emitter } ///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 != "", new Error("Tag handle must not be empty")); @@ -892,7 +892,7 @@ struct Emitter } ///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 != "", new Error("Tag prefix must not be empty")); @@ -1179,7 +1179,7 @@ struct Emitter void writeStreamEnd() @system {stream_.flush();} ///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 { const bool prefixSpace = !whitespace_ && needWhitespace; @@ -1222,7 +1222,7 @@ struct Emitter } ///Start new line. - void writeLineBreak(in string data = null) @system + void writeLineBreak(const string data = null) @system { whitespace_ = indentation_ = true; ++line_; @@ -1231,7 +1231,7 @@ struct Emitter } ///Write a YAML version directive. - void writeVersionDirective(in string versionText) @system + void writeVersionDirective(const string versionText) @system { writeString("%YAML "); writeString(versionText); @@ -1239,7 +1239,7 @@ struct Emitter } ///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(handle); @@ -1571,7 +1571,7 @@ struct ScalarWriter size_t hintsIdx = 0; 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); return decode(text_, idx); diff --git a/dyaml/node.d b/dyaml/node.d index ea51de2..b9207aa 100644 --- a/dyaml/node.d +++ b/dyaml/node.d @@ -226,7 +226,7 @@ struct Node * be in full form, e.g. "tag:yaml.org,2002:int", not * 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)) { tag_ = Tag(tag); @@ -283,7 +283,7 @@ struct Node * 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[])) { tag_ = Tag(tag); @@ -348,7 +348,7 @@ struct Node * 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); @@ -413,7 +413,7 @@ struct Node * 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[]))) in { diff --git a/dyaml/token.d b/dyaml/token.d index 8f0802e..cf09221 100644 --- a/dyaml/token.d +++ b/dyaml/token.d @@ -79,7 +79,7 @@ struct Token * end = End position 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); } @@ -91,7 +91,7 @@ Token directiveToken(in Mark start, in Mark end, in string value) pure @safe not * start = Start 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); } @@ -103,7 +103,7 @@ Token simpleToken(TokenID id)(in Mark start, in Mark end) pure @safe nothrow * end = End position of the token. * 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); } @@ -126,7 +126,7 @@ alias simpleToken!(TokenID.FlowEntry) flowEntryToken; * end = End position 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); } @@ -144,7 +144,7 @@ alias simpleValueToken!(TokenID.Anchor) anchorToken; * value = Value 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); } diff --git a/dyaml/zerostring.d b/dyaml/zerostring.d index 61a62c5..ecaeb21 100644 --- a/dyaml/zerostring.d +++ b/dyaml/zerostring.d @@ -24,7 +24,7 @@ struct ZeroString(string TypeName) @disable int opCmp(ref ZeroString); ///Construct a string. - this(in string str) pure nothrow @safe + this(const string str) pure nothrow @safe { if(str is null || str == "") {