Browse Source

Optimized ArgumentNullException exception message.

Should lead to less code size bloat due to unnecessarily unique strings.
pull/621/merge
Joao Matos 10 years ago
parent
commit
2ed0565d18
  1. 2
      src/Generator/Generators/CLI/CLIMarshal.cs
  2. 2
      src/Generator/Generators/CSharp/CSharpMarshal.cs

2
src/Generator/Generators/CLI/CLIMarshal.cs

@ -700,7 +700,7 @@ namespace CppSharp.Generators.CLI
Context.SupportBefore.WriteLine("if (ReferenceEquals({0}, nullptr))", Context.Parameter.Name); Context.SupportBefore.WriteLine("if (ReferenceEquals({0}, nullptr))", Context.Parameter.Name);
Context.SupportBefore.WriteLineIndent( Context.SupportBefore.WriteLineIndent(
"throw gcnew ::System::ArgumentNullException(\"{0}\", " + "throw gcnew ::System::ArgumentNullException(\"{0}\", " +
"\"{0} cannot be null because it is a C++ reference (&).\");", "\"Cannot be null because it is a C++ reference (&).\");",
Context.Parameter.Name); Context.Parameter.Name);
} }

2
src/Generator/Generators/CSharp/CSharpMarshal.cs

@ -674,7 +674,7 @@ namespace CppSharp.Generators.CSharp
Context.SupportBefore.WriteLine("if (ReferenceEquals({0}, null))", param); Context.SupportBefore.WriteLine("if (ReferenceEquals({0}, null))", param);
Context.SupportBefore.WriteLineIndent( Context.SupportBefore.WriteLineIndent(
"throw new global::System.ArgumentNullException(\"{0}\", " + "throw new global::System.ArgumentNullException(\"{0}\", " +
"\"{0} cannot be null because it is a C++ reference (&).\");", "\"Cannot be null because it is a C++ reference (&).\");",
param); param);
} }
Context.Return.Write("{0}.{1}", param, Helpers.InstanceIdentifier); Context.Return.Write("{0}.{1}", param, Helpers.InstanceIdentifier);

Loading…
Cancel
Save