From bc7519f5612cf5ce98fa6ab3a794246cae38de9b Mon Sep 17 00:00:00 2001 From: Ferdinand Majerech Date: Sat, 19 Jul 2014 04:17:18 +0200 Subject: [PATCH] Fixed deprecation errors for DMD 2.066 --- source/dyaml/composer.d | 4 ++-- source/dyaml/constructor.d | 12 ++++++------ source/dyaml/dumper.d | 4 ++-- source/dyaml/emitter.d | 14 +++++++------- source/dyaml/loader.d | 6 +++--- source/dyaml/parser.d | 8 ++++---- source/dyaml/queue.d | 2 +- source/dyaml/representer.d | 4 ++-- source/dyaml/resolver.d | 2 +- source/dyaml/scanner.d | 10 +++++----- source/dyaml/serializer.d | 10 +++++----- 11 files changed, 38 insertions(+), 38 deletions(-) diff --git a/source/dyaml/composer.d b/source/dyaml/composer.d index 25256a7..e7f2b32 100644 --- a/source/dyaml/composer.d +++ b/source/dyaml/composer.d @@ -84,7 +84,7 @@ final class Composer parser_ = null; resolver_ = null; constructor_ = null; - clear(anchors_); + anchors_.destroy(); anchors_ = null; } @@ -167,7 +167,7 @@ final class Composer //Drop the DOCUMENT-END event. parser_.getEvent(); - clear(anchors_); + anchors_.destroy(); return node; } diff --git a/source/dyaml/constructor.d b/source/dyaml/constructor.d index 375647b..08e22bd 100644 --- a/source/dyaml/constructor.d +++ b/source/dyaml/constructor.d @@ -108,11 +108,11 @@ final class Constructor /// Destroy the constructor. pure @safe nothrow ~this() { - clear(fromScalar_); + fromScalar_.destroy(); fromScalar_ = null; - clear(fromSequence_); + fromSequence_.destroy(); fromSequence_ = null; - clear(fromMapping_); + fromMapping_.destroy(); fromMapping_ = null; } @@ -698,7 +698,7 @@ Node.Pair[] constructOrderedMap(ref Node node) //Detect duplicates. //TODO this should be replaced by something with deterministic memory allocation. auto keys = redBlackTree!Node(); - scope(exit){clear(keys);} + scope(exit){keys.destroy();} foreach(ref pair; pairs) { enforce(!(pair.key in keys), @@ -767,7 +767,7 @@ Node[] constructSet(ref Node node) // memory allocation if possible. // Detect duplicates. ubyte[Node] map; - scope(exit){clear(map);} + scope(exit){map.destroy();} Node[] nodes; foreach(ref pair; pairs) { @@ -837,7 +837,7 @@ Node.Pair[] constructMap(ref Node node) //Detect duplicates. //TODO this should be replaced by something with deterministic memory allocation. auto keys = redBlackTree!Node(); - scope(exit){clear(keys);} + scope(exit){keys.destroy();} foreach(ref pair; pairs) { enforce(!(pair.key in keys), diff --git a/source/dyaml/dumper.d b/source/dyaml/dumper.d index 9683a7e..1eb3abc 100644 --- a/source/dyaml/dumper.d +++ b/source/dyaml/dumper.d @@ -189,14 +189,14 @@ struct Dumper ///Specify custom Resolver to use. @property void resolver(Resolver resolver) @trusted { - clear(resolver_); + resolver_.destroy(); resolver_ = resolver; } ///Specify custom Representer to use. @property void representer(Representer representer) @trusted { - clear(representer_); + representer_.destroy(); representer_ = representer; } diff --git a/source/dyaml/emitter.d b/source/dyaml/emitter.d index 7c406d9..59a0fe2 100644 --- a/source/dyaml/emitter.d +++ b/source/dyaml/emitter.d @@ -187,14 +187,14 @@ struct Emitter @trusted ~this() { stream_ = null; - clear(states_); - clear(events_); - clear(indents_); - clear(tagDirectives_); + states_.destroy(); + events_.destroy(); + indents_.destroy(); + tagDirectives_.destroy(); tagDirectives_ = null; - clear(preparedAnchor_); + preparedAnchor_.destroy(); preparedAnchor_ = null; - clear(preparedTag_); + preparedTag_.destroy(); preparedTag_ = null; } @@ -206,7 +206,7 @@ struct Emitter { event_ = events_.pop(); state_(); - clear(event_); + event_.destroy(); } } diff --git a/source/dyaml/loader.d b/source/dyaml/loader.d index f3b6d97..a7d9fa4 100644 --- a/source/dyaml/loader.d +++ b/source/dyaml/loader.d @@ -167,9 +167,9 @@ struct Loader ///Destroy the Loader. @trusted ~this() { - clear(reader_); - clear(scanner_); - clear(parser_); + reader_.destroy(); + scanner_.destroy(); + parser_.destroy(); } ///Set stream _name. Used in debugging messages. diff --git a/source/dyaml/parser.d b/source/dyaml/parser.d index 6cb189f..8f59dde 100644 --- a/source/dyaml/parser.d +++ b/source/dyaml/parser.d @@ -146,11 +146,11 @@ final class Parser ///Destroy the parser. @trusted ~this() { - clear(currentEvent_); - clear(tagDirectives_); + currentEvent_.destroy(); + tagDirectives_.destroy(); tagDirectives_ = null; - clear(states_); - clear(marks_); + states_.destroy(); + marks_.destroy(); } /** diff --git a/source/dyaml/queue.d b/source/dyaml/queue.d index f4dfa24..a49f026 100644 --- a/source/dyaml/queue.d +++ b/source/dyaml/queue.d @@ -196,7 +196,7 @@ void free(T)(T* ptr) @system nothrow { //GC doesn't need to care about any references in this struct anymore. static if(hasIndirections!T){GC.removeRange(cast(void*)ptr);} - static if(hasMember!(T, "__dtor")){clear(*ptr);} + static if(hasMember!(T, "__dtor")){(*ptr).destroy;} core.stdc.stdlib.free(ptr); } diff --git a/source/dyaml/representer.d b/source/dyaml/representer.d index f03eb0b..d7a0ff2 100644 --- a/source/dyaml/representer.d +++ b/source/dyaml/representer.d @@ -86,7 +86,7 @@ final class Representer ///Destroy the Representer. pure @safe nothrow ~this() { - clear(representers_); + representers_.destroy(); representers_ = null; } @@ -555,7 +555,7 @@ Node representPairs(ref Node node, Representer representer) @system { //TODO this should be replaced by something with deterministic memory allocation. auto keys = redBlackTree!Node(); - scope(exit){clear(keys);} + scope(exit){keys.destroy();} foreach(ref pair; pairs) { if(pair.key in keys){return true;} diff --git a/source/dyaml/resolver.d b/source/dyaml/resolver.d index 98273d3..e89462c 100644 --- a/source/dyaml/resolver.d +++ b/source/dyaml/resolver.d @@ -73,7 +73,7 @@ final class Resolver ///Destroy the Resolver. pure @safe nothrow ~this() { - clear(yamlImplicitResolvers_); + yamlImplicitResolvers_.destroy(); yamlImplicitResolvers_ = null; } diff --git a/source/dyaml/scanner.d b/source/dyaml/scanner.d index f82b7cf..0b944ca 100644 --- a/source/dyaml/scanner.d +++ b/source/dyaml/scanner.d @@ -163,11 +163,11 @@ final class Scanner ///Destroy the scanner. @trusted ~this() { - clear(tokens_); - clear(indents_); - clear(possibleSimpleKeys_); + tokens_.destroy(); + indents_.destroy(); + possibleSimpleKeys_.destroy(); possibleSimpleKeys_ = null; - clear(appender_); + appender_.destroy(); reader_ = null; } @@ -438,7 +438,7 @@ final class Scanner unwindIndent(-1); removePossibleSimpleKey(); allowSimpleKey_ = false; - clear(possibleSimpleKeys_); + possibleSimpleKeys_.destroy; tokens_.push(streamEndToken(reader_.mark, reader_.mark)); done_ = true; diff --git a/source/dyaml/serializer.d b/source/dyaml/serializer.d index 7ae7412..b483b5c 100644 --- a/source/dyaml/serializer.d +++ b/source/dyaml/serializer.d @@ -87,11 +87,11 @@ struct Serializer @safe ~this() { emitter_.emit(streamEndEvent(Mark(), Mark())); - clear(YAMLVersion_); + YAMLVersion_.destroy(); YAMLVersion_ = null; - clear(serializedNodes_); + serializedNodes_.destroy(); serializedNodes_ = null; - clear(anchors_); + anchors_.destroy(); anchors_ = null; } @@ -103,8 +103,8 @@ struct Serializer anchorNode(node); serializeNode(node); emitter_.emit(documentEndEvent(Mark(), Mark(), explicitEnd_)); - clear(serializedNodes_); - clear(anchors_); + serializedNodes_.destroy(); + anchors_.destroy(); Anchor[Node] emptyAnchors; anchors_ = emptyAnchors; lastAnchorID_ = 0;