Merge pull request #109 from Herringway/serializer-safe-constructor

fix Serializer.this using address of ref parameter
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
This commit is contained in:
The Dlang Bot 2018-04-17 18:51:17 +02:00 committed by GitHub
commit 4437a22430
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -276,7 +276,7 @@ struct Dumper
try try
{ {
auto emitter = Emitter(stream_, canonical_, indent_, textWidth_, lineBreak_); auto emitter = Emitter(stream_, canonical_, indent_, textWidth_, lineBreak_);
auto serializer = Serializer(emitter, resolver_, encoding_, explicitStart_, auto serializer = Serializer(&emitter, resolver_, encoding_, explicitStart_,
explicitEnd_, YAMLVersion_, tags_); explicitEnd_, YAMLVersion_, tags_);
foreach(ref document; documents) foreach(ref document; documents)
{ {

View file

@ -66,12 +66,12 @@ struct Serializer
* YAMLVersion = YAML version string. * YAMLVersion = YAML version string.
* tagDirectives = Tag directives to emit. * tagDirectives = Tag directives to emit.
*/ */
this(ref Emitter emitter, Resolver resolver, Encoding encoding, this(Emitter* emitter, Resolver resolver, Encoding encoding,
const Flag!"explicitStart" explicitStart, const Flag!"explicitStart" explicitStart,
const Flag!"explicitEnd" explicitEnd, string YAMLVersion, const Flag!"explicitEnd" explicitEnd, string YAMLVersion,
TagDirective[] tagDirectives) @trusted TagDirective[] tagDirectives) @safe
{ {
emitter_ = &emitter; emitter_ = emitter;
resolver_ = resolver; resolver_ = resolver;
explicitStart_ = explicitStart; explicitStart_ = explicitStart;
explicitEnd_ = explicitEnd; explicitEnd_ = explicitEnd;