Skip to content

Commit 9b495e8

Browse files
committed
Remove C# 7 syntaxes for Unity.
1 parent b112484 commit 9b495e8

5 files changed

Lines changed: 236 additions & 232 deletions

File tree

src/MsgPack/Serialization/PackHelpers.cs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ IList<Action<Packer, TObject>> operations
8585
{
8686
if ( packer == null )
8787
{
88-
SerializationExceptions.ThrowArgumentNullException( nameof( packer ) );
88+
SerializationExceptions.ThrowArgumentNullException( "packer" );
8989
}
9090

9191
if ( operations == null )
9292
{
93-
SerializationExceptions.ThrowArgumentNullException( nameof( operations ) );
93+
SerializationExceptions.ThrowArgumentNullException( "operations" );
9494
}
9595

9696
var parameter =
@@ -125,12 +125,12 @@ ref PackToArrayParameters<TObject> parameter
125125
{
126126
if ( parameter.Packer == null )
127127
{
128-
SerializationExceptions.ThrowArgumentNullException( nameof( parameter ), nameof( parameter.Packer ) );
128+
SerializationExceptions.ThrowArgumentNullException( "parameter", "Packer" );
129129
}
130130

131131
if ( parameter.Operations == null )
132132
{
133-
SerializationExceptions.ThrowArgumentNullException( nameof( parameter ), nameof( parameter.Operations ) );
133+
SerializationExceptions.ThrowArgumentNullException( "parameter", "Operations" );
134134
}
135135

136136
#if ASSERT
@@ -181,12 +181,12 @@ CancellationToken cancellationToken
181181
{
182182
if ( packer == null )
183183
{
184-
SerializationExceptions.ThrowArgumentNullException( nameof( packer ) );
184+
SerializationExceptions.ThrowArgumentNullException( "packer" );
185185
}
186186

187187
if ( operations == null )
188188
{
189-
SerializationExceptions.ThrowArgumentNullException( nameof( operations ) );
189+
SerializationExceptions.ThrowArgumentNullException( "operations" );
190190
}
191191

192192
var parameter =
@@ -219,12 +219,12 @@ ref PackToArrayAsyncParameters<TObject> parameter
219219
{
220220
if ( parameter.Packer == null )
221221
{
222-
SerializationExceptions.ThrowArgumentNullException( nameof( parameter ), nameof( parameter.Packer ) );
222+
SerializationExceptions.ThrowArgumentNullException( "parameter", "Packer" );
223223
}
224224

225225
if ( parameter.Operations == null )
226226
{
227-
SerializationExceptions.ThrowArgumentNullException( nameof( parameter ), nameof( parameter.Operations ) );
227+
SerializationExceptions.ThrowArgumentNullException( "parameter", "Operations" );
228228
}
229229

230230
return PackToArrayAsyncCore( parameter.Packer, parameter.Target, parameter.Operations, parameter.CancellationToken );
@@ -281,12 +281,12 @@ IDictionary<string, Action<Packer, TObject>> operations
281281
{
282282
if ( packer == null )
283283
{
284-
SerializationExceptions.ThrowArgumentNullException( nameof( packer ) );
284+
SerializationExceptions.ThrowArgumentNullException( "packer" );
285285
}
286286

287287
if ( operations == null )
288288
{
289-
SerializationExceptions.ThrowArgumentNullException( nameof( operations ) );
289+
SerializationExceptions.ThrowArgumentNullException( "operations" );
290290
}
291291

292292
var parameter =
@@ -320,20 +320,21 @@ ref PackToMapParameters<TObject> parameter
320320
{
321321
if ( parameter.Packer == null )
322322
{
323-
SerializationExceptions.ThrowArgumentNullException( nameof( parameter ), nameof( parameter.Packer ) );
323+
SerializationExceptions.ThrowArgumentNullException( "parameter", "Packer" );
324324
}
325325

326326
if ( parameter.Operations == null )
327327
{
328-
SerializationExceptions.ThrowArgumentNullException( nameof( parameter ), nameof( parameter.Operations ) );
328+
SerializationExceptions.ThrowArgumentNullException( "parameter", "Operations" );
329329
}
330330

331331
#if ASSERT
332332
Contract.Assert( parameter.Packer != null );
333333
Contract.Assert( parameter.Operations != null );
334334
#endif // ASSERT
335335

336-
if ( parameter.NullCheckers != null && ( parameter.SerializationContext?.DictionarySerlaizationOptions.OmitNullEntry ).GetValueOrDefault() )
336+
if ( parameter.NullCheckers != null
337+
&& parameter.SerializationContext != null && parameter.SerializationContext.DictionarySerlaizationOptions.OmitNullEntry )
337338
{
338339
#if ASSERT
339340
Contract.Assert( !SerializerDebugging.UseLegacyNullMapEntryHandling );
@@ -412,12 +413,12 @@ CancellationToken cancellationToken
412413
{
413414
if ( packer == null )
414415
{
415-
SerializationExceptions.ThrowArgumentNullException( nameof( packer ) );
416+
SerializationExceptions.ThrowArgumentNullException( "packer" );
416417
}
417418

418419
if ( operations == null )
419420
{
420-
SerializationExceptions.ThrowArgumentNullException( nameof( operations ) );
421+
SerializationExceptions.ThrowArgumentNullException( "operations" );
421422
}
422423

423424
var parameter =
@@ -452,12 +453,12 @@ ref PackToMapAsyncParameters<TObject> parameter
452453
{
453454
if ( parameter.Packer == null )
454455
{
455-
SerializationExceptions.ThrowArgumentNullException( nameof( parameter ), nameof( parameter.Packer ) );
456+
SerializationExceptions.ThrowArgumentNullException( "parameter", "Packer" );
456457
}
457458

458459
if ( parameter.Operations == null )
459460
{
460-
SerializationExceptions.ThrowArgumentNullException( nameof( parameter ), nameof( parameter.Operations ) );
461+
SerializationExceptions.ThrowArgumentNullException( "parameter", "Operations" );
461462
}
462463

463464
return PackToMapAsyncCore( parameter.SerializationContext, parameter.Packer, parameter.Target, parameter.Operations, parameter.NullCheckers, parameter.CancellationToken );
@@ -478,7 +479,8 @@ CancellationToken cancellationToken
478479
Contract.Assert( operations != null );
479480
#endif // ASSERT
480481

481-
if ( nullCheckers != null && ( serializationContext?.DictionarySerlaizationOptions.OmitNullEntry ).GetValueOrDefault() )
482+
if ( nullCheckers != null
483+
&& serializationContext != null && serializationContext.DictionarySerlaizationOptions.OmitNullEntry )
482484
{
483485
#if ASSERT
484486
Contract.Assert( !SerializerDebugging.UseLegacyNullMapEntryHandling );

src/MsgPack/Serialization/Reflection/ReflectionExtensions.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,12 @@ public static string ToILString( this MethodImplAttributes source )
239239
AddString( result, source, MethodImplAttributes.InternalCall, "internalcall" );
240240
AddString( result, source, MethodImplAttributes.Synchronized, "synchronized" );
241241
AddString( result, source, MethodImplAttributes.NoInlining, "noinlining" );
242+
#if !UNITY
242243
AddString( result, source, MethodImplAttributes.NoOptimization, "nooptimization" );
243-
#if !NETFX_35 && !NETFX_40 && !UNITY
244+
#if !NETFX_35 && !NETFX_40
244245
AddString( result, source, MethodImplAttributes.AggressiveInlining, "aggressiveinlining" );
245-
#endif // !NETFX_35 && !NETFX_40 && !UNITY
246+
#endif // !NETFX_35 && !NETFX_40
247+
#endif // !UNITY
246248

247249
return result.ToString();
248250
}

src/MsgPack/Serialization/SerializationTarget.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ private static bool CheckTargetEligibility( MemberInfo member )
409409
else
410410
{
411411
#if DEBUG
412-
Contract.Assert( false, $"Unknown type member {member}" );
412+
Contract.Assert( false, "Unknown type member " + member );
413413
#endif // DEBUG
414414
// ReSharper disable once HeuristicUnreachableCode
415415
return true;

0 commit comments

Comments
 (0)