diff --git a/source/dub/compilers/buildsettings.d b/source/dub/compilers/buildsettings.d index 3da87b1..0e9a1ce 100644 --- a/source/dub/compilers/buildsettings.d +++ b/source/dub/compilers/buildsettings.d @@ -12,8 +12,7 @@ import std.array : array; import std.algorithm : filter; import std.path : globMatch; -static if (__VERSION__ >= 2067) - import std.typecons : BitFlags; +import std.typecons : BitFlags; /// BuildPlatform specific settings, like needed libraries or additional @@ -284,26 +283,9 @@ struct BuildRequirements { import dub.internal.vibecompat.data.serialization : ignore; - static if (__VERSION__ >= 2067) { - @ignore BitFlags!BuildRequirement values; - this(BuildRequirement req) { values = req; } - } else { - @ignore BuildRequirement values; - this(BuildRequirement req) { values = req; } - BuildRequirement[] toRepresentation() - const { - BuildRequirement[] ret; - for (int f = 1; f <= BuildRequirement.max; f *= 2) - if (values & f) ret ~= cast(BuildRequirement)f; - return ret; - } - static BuildRequirements fromRepresentation(BuildRequirement[] v) - { - BuildRequirements ret; - foreach (f; v) ret.values |= f; - return ret; - } - } + @ignore BitFlags!BuildRequirement values; + this(BuildRequirement req) { values = req; } + alias values this; } @@ -340,27 +322,9 @@ struct BuildOptions { import dub.internal.vibecompat.data.serialization : ignore; - static if (__VERSION__ >= 2067) { - @ignore BitFlags!BuildOption values; - this(BuildOption opt) { values = opt; } - this(BitFlags!BuildOption v) { values = v; } - } else { - @ignore BuildOption values; - this(BuildOption opt) { values = opt; } - BuildOption[] toRepresentation() - const { - BuildOption[] ret; - for (int f = 1; f <= BuildOption.max; f *= 2) - if (values & f) ret ~= cast(BuildOption)f; - return ret; - } - static BuildOptions fromRepresentation(BuildOption[] v) - { - BuildOptions ret; - foreach (f; v) ret.values |= f; - return ret; - } - } + @ignore BitFlags!BuildOption values; + this(BuildOption opt) { values = opt; } + this(BitFlags!BuildOption v) { values = v; } alias values this; } diff --git a/source/dub/dependencyresolver.d b/source/dub/dependencyresolver.d index 6b42d80..f5e9dcb 100644 --- a/source/dub/dependencyresolver.d +++ b/source/dub/dependencyresolver.d @@ -43,7 +43,6 @@ hash_t toHash() const nothrow @trusted { size_t ret = pack.hashOf(); - //size_t ret = typeid(string).getHash(&pack); ret ^= typeid(CONFIG).getHash(&config); return ret; } diff --git a/source/dub/description.d b/source/dub/description.d index 9f519cb..c9c347c 100644 --- a/source/dub/description.d +++ b/source/dub/description.d @@ -44,10 +44,7 @@ foreach (ref p; packages) if (p.name == name) { - static if (__VERSION__ > 2065) - return p; - else - return *cast(inout(PackageDescription)*)&p; + return p; } throw new Exception("Package '"~name~"' not found in dependency tree."); } diff --git a/source/dub/internal/sdlang/lexer.d b/source/dub/internal/sdlang/lexer.d index 2295ed7..d57a187 100644 --- a/source/dub/internal/sdlang/lexer.d +++ b/source/dub/internal/sdlang/lexer.d @@ -1,4 +1,4 @@ -// SDLang-D +// SDLang-D // Written in the D programming language. module dub.internal.sdlang.lexer; @@ -1259,8 +1259,7 @@ else { auto timezone = new immutable SimpleTimeZone(offset.get()); - static if (__VERSION__ >= 2067) auto fsecs = dateTimeFrac.fracSecs; - else auto fsecs = FracSec.from!"hnsecs"(dateTimeFrac.fracSecs.total!"hnsecs"); + auto fsecs = dateTimeFrac.fracSecs; mixin(accept!("Value", "SysTime(dateTimeFrac.dateTime, fsecs, timezone)")); } } @@ -1268,9 +1267,8 @@ try { auto timezone = PosixTimeZone.getTimeZone(timezoneStr); - if(timezone) { - static if (__VERSION__ >= 2067) auto fsecs = dateTimeFrac.fracSecs; - else auto fsecs = FracSec.from!"hnsecs"(dateTimeFrac.fracSecs.total!"hnsecs"); + if (timezone) { + auto fsecs = dateTimeFrac.fracSecs; mixin(accept!("Value", "SysTime(dateTimeFrac.dateTime, fsecs, timezone)")); } } diff --git a/source/dub/internal/sdlang/token.d b/source/dub/internal/sdlang/token.d index b5f8f4a..ca1ef64 100644 --- a/source/dub/internal/sdlang/token.d +++ b/source/dub/internal/sdlang/token.d @@ -1,4 +1,4 @@ -// SDLang-D +// SDLang-D // Written in the D programming language. module dub.internal.sdlang.token; @@ -247,10 +247,7 @@ void toSDLString(Sink)(SysTime value, ref Sink sink) if(isOutputRange!(Sink,char)) { - static if (__VERSION__ >= 2067) - auto dateTimeFrac = DateTimeFrac(cast(DateTime)value, value.fracSecs); - else - auto dateTimeFrac = DateTimeFrac(cast(DateTime)value, value.fracSec); + auto dateTimeFrac = DateTimeFrac(cast(DateTime)value, value.fracSecs); toSDLString(dateTimeFrac, sink); sink.put("-"); @@ -286,12 +283,7 @@ sink.put("+"); long hours, minutes; - static if (__VERSION__ >= 2066) - offset.split!("hours", "minutes")(hours, minutes); - else { - hours = offset.hours; - minutes = offset.minutes; - } + offset.split!("hours", "minutes")(hours, minutes); sink.put("%.2s".format(hours)); sink.put(":"); @@ -326,14 +318,7 @@ } long hours, minutes, seconds, msecs; - static if (__VERSION__ >= 2066) - value.split!("hours", "minutes", "seconds", "msecs")(hours, minutes, seconds, msecs); - else { - hours = value.hours; - minutes = value.minutes; - seconds = value.seconds; - msecs = value.fracSec.msecs; - } + value.split!("hours", "minutes", "seconds", "msecs")(hours, minutes, seconds, msecs); sink.put("%.2s".format(hours)); sink.put(':'); diff --git a/source/dub/internal/vibecompat/core/file.d b/source/dub/internal/vibecompat/core/file.d index 0dcbe14..404cd87 100644 --- a/source/dub/internal/vibecompat/core/file.d +++ b/source/dub/internal/vibecompat/core/file.d @@ -216,9 +216,7 @@ */ FileInfo getFileInfo(Path path) { - static if (__VERSION__ >= 2064) - auto ent = std.file.DirEntry(path.toNativeString()); - else auto ent = std.file.dirEntry(path.toNativeString()); + auto ent = std.file.DirEntry(path.toNativeString()); return makeFileInfo(ent); } /// ditto diff --git a/source/dub/internal/vibecompat/data/json.d b/source/dub/internal/vibecompat/data/json.d index a2705a3..c352bf3 100644 --- a/source/dub/internal/vibecompat/data/json.d +++ b/source/dub/internal/vibecompat/data/json.d @@ -2102,15 +2102,13 @@ private void enforceJson(string file = __FILE__, size_t line = __LINE__)(bool cond, lazy string message = "JSON exception") { - static if (__VERSION__ >= 2065) enforceEx!JSONException(cond, message, file, line); - else if (!cond) throw new JSONException(message); + enforceEx!JSONException(cond, message, file, line); } private void enforceJson(string file = __FILE__, size_t line = __LINE__)(bool cond, lazy string message, string err_file, int err_line) { auto errmsg() { return format("%s(%s): Error: %s", err_file, err_line+1, message); } - static if (__VERSION__ >= 2065) enforceEx!JSONException(cond, errmsg, file, line); - else if (!cond) throw new JSONException(errmsg); + enforceEx!JSONException(cond, errmsg, file, line); } private void enforceJson(string file = __FILE__, size_t line = __LINE__)(bool cond, lazy string message, string err_file, int* err_line) diff --git a/source/dub/internal/vibecompat/data/serialization.d b/source/dub/internal/vibecompat/data/serialization.d index 0c051e2..0f9b7c4 100644 --- a/source/dub/internal/vibecompat/data/serialization.d +++ b/source/dub/internal/vibecompat/data/serialization.d @@ -196,7 +196,7 @@ } /// -static if (__VERSION__ >= 2065) unittest { +unittest { import dub.internal.vibecompat.data.json; static struct SizeI { @@ -266,7 +266,7 @@ } /// -static if (__VERSION__ >= 2065) unittest { +unittest { import dub.internal.vibecompat.data.json; static struct SizeI { @@ -292,7 +292,7 @@ private void serializeImpl(Serializer, alias Policy, T, ATTRIBUTES...)(ref Serializer serializer, T value) { import std.typecons : Nullable, Tuple, tuple; - static if (__VERSION__ >= 2067) import std.typecons : BitFlags; + import std.typecons : BitFlags; static assert(Serializer.isSupportedValueType!string, "All serializers must support string values."); static assert(Serializer.isSupportedValueType!(typeof(null)), "All serializers must support null values."); @@ -356,7 +356,7 @@ } else static if (/*isInstanceOf!(Nullable, TU)*/is(T == Nullable!TPS, TPS...)) { if (value.isNull()) serializeImpl!(Serializer, Policy, typeof(null))(serializer, null); else serializeImpl!(Serializer, Policy, typeof(value.get()), ATTRIBUTES)(serializer, value.get()); - } else static if (__VERSION__ >= 2067 && is(T == BitFlags!E, E)) { + } else static if (is(T == BitFlags!E, E)) { size_t cnt = 0; foreach (v; EnumMembers!E) if (value & v) @@ -450,7 +450,7 @@ private T deserializeImpl(T, alias Policy, Serializer, ATTRIBUTES...)(ref Serializer deserializer) { import std.typecons : Nullable; - static if (__VERSION__ >= 2067) import std.typecons : BitFlags; + import std.typecons : BitFlags; static assert(Serializer.isSupportedValueType!string, "All serializers must support string values."); static assert(Serializer.isSupportedValueType!(typeof(null)), "All serializers must support null values."); @@ -496,7 +496,7 @@ } else static if (isInstanceOf!(Nullable, T)) { if (deserializer.tryReadNull()) return T.init; return T(deserializeImpl!(typeof(T.init.get()), Policy, Serializer, ATTRIBUTES)(deserializer)); - } else static if (__VERSION__ >= 2067 && is(T == BitFlags!E, E)) { + } else static if (is(T == BitFlags!E, E)) { T ret; deserializer.readArray!(E[])((sz) {}, { ret |= deserializeImpl!(E, Policy, Serializer, ATTRIBUTES)(deserializer); @@ -1276,7 +1276,6 @@ assert(s.serializeToJson().deserializeJson!S() == s); } -static if (__VERSION__ >= 2067) unittest { // test BitFlags serialization import std.typecons : BitFlags; diff --git a/source/dub/internal/vibecompat/inet/path.d b/source/dub/internal/vibecompat/inet/path.d index f5bd81f..68cd513 100644 --- a/source/dub/internal/vibecompat/inet/path.d +++ b/source/dub/internal/vibecompat/inet/path.d @@ -34,8 +34,7 @@ /// Constructs a Path object by parsing a path string. this(string pathstr) { - static if (__VERSION__ < 2066) m_nodes = splitPath(pathstr).idup; - else m_nodes = splitPath(pathstr); + m_nodes = splitPath(pathstr); m_absolute = (pathstr.startsWith("/") || m_nodes.length > 0 && (m_nodes[0].toString().countUntil(':')>0 || m_nodes[0] == "\\")); m_endsWithSlash = pathstr.endsWith("/"); }