From 993dd6c5bc9523decbe82be70a7e97fd16be9201 Mon Sep 17 00:00:00 2001 From: Cameron Ross Date: Fri, 20 Apr 2018 20:45:23 -0300 Subject: [PATCH] remove many unnecessary destructors --- source/dyaml/constructor.d | 11 ----------- source/dyaml/loader.d | 7 ------- source/dyaml/parser.d | 10 ---------- source/dyaml/representer.d | 7 ------- source/dyaml/resolver.d | 7 ------- source/dyaml/scanner.d | 10 ---------- source/dyaml/serializer.d | 6 ------ 7 files changed, 58 deletions(-) diff --git a/source/dyaml/constructor.d b/source/dyaml/constructor.d index 89c8f8c..2be16cf 100644 --- a/source/dyaml/constructor.d +++ b/source/dyaml/constructor.d @@ -101,17 +101,6 @@ final class Constructor addConstructorScalar("tag:yaml.org,2002:merge", &constructMerge); } - /// Destroy the constructor. - @nogc pure @safe nothrow ~this() - { - fromScalar_.destroy(); - fromScalar_ = null; - fromSequence_.destroy(); - fromSequence_ = null; - fromMapping_.destroy(); - fromMapping_ = null; - } - /** Add a constructor function from scalar. * * The function must take a reference to $(D Node) to construct from. diff --git a/source/dyaml/loader.d b/source/dyaml/loader.d index 416c797..1bdb2da 100644 --- a/source/dyaml/loader.d +++ b/source/dyaml/loader.d @@ -126,13 +126,6 @@ struct Loader } } - /// Destroy the Loader. - @trusted ~this() - { - reader_.destroy(); - scanner_.destroy(); - parser_.destroy(); - } /// Set stream _name. Used in debugging messages. void name(string name) pure @safe nothrow @nogc diff --git a/source/dyaml/parser.d b/source/dyaml/parser.d index 50c5543..44437d6 100644 --- a/source/dyaml/parser.d +++ b/source/dyaml/parser.d @@ -142,16 +142,6 @@ final class Parser marks_.reserve(32); } - ///Destroy the parser. - @trusted ~this() - { - currentEvent_.destroy(); - tagDirectives_.destroy(); - tagDirectives_ = null; - states_.destroy(); - marks_.destroy(); - } - /** * Check if the next event is one of specified types. * diff --git a/source/dyaml/representer.d b/source/dyaml/representer.d index 0e354d1..ed786b6 100644 --- a/source/dyaml/representer.d +++ b/source/dyaml/representer.d @@ -81,13 +81,6 @@ final class Representer addRepresenter!SysTime(&representSysTime); } - ///Destroy the Representer. - ~this() pure @safe nothrow - { - representers_.destroy(); - representers_ = null; - } - ///Set default _style for scalars. If style is $(D ScalarStyle.Invalid), the _style is chosen automatically. @property void defaultScalarStyle(ScalarStyle style) pure @safe nothrow { diff --git a/source/dyaml/resolver.d b/source/dyaml/resolver.d index 8e8297b..9dd6622 100644 --- a/source/dyaml/resolver.d +++ b/source/dyaml/resolver.d @@ -69,13 +69,6 @@ final class Resolver if(defaultImplicitResolvers){addImplicitResolvers();} } - ///Destroy the Resolver. - ~this() pure @safe nothrow - { - yamlImplicitResolvers_.destroy(); - yamlImplicitResolvers_ = null; - } - /** * Add an implicit scalar resolver. * diff --git a/source/dyaml/scanner.d b/source/dyaml/scanner.d index d9be4c5..7511a08 100644 --- a/source/dyaml/scanner.d +++ b/source/dyaml/scanner.d @@ -170,16 +170,6 @@ final class Scanner fetchStreamStart(); } - /// Destroy the scanner. - ~this() @trusted - { - tokens_.destroy(); - indents_.destroy(); - possibleSimpleKeys_.destroy(); - possibleSimpleKeys_ = null; - reader_ = null; - } - /// Check if the next token is one of specified types. /// /// If no types are specified, checks if any tokens are left. diff --git a/source/dyaml/serializer.d b/source/dyaml/serializer.d index ae5ec58..c69772a 100644 --- a/source/dyaml/serializer.d +++ b/source/dyaml/serializer.d @@ -85,12 +85,6 @@ struct Serializer ~this() @safe { emitter_.emit(streamEndEvent(Mark(), Mark())); - YAMLVersion_.destroy(); - YAMLVersion_ = null; - serializedNodes_.destroy(); - serializedNodes_ = null; - anchors_.destroy(); - anchors_ = null; } ///Serialize a node, emitting it in the process.