Browse Source

Do not use safeIdentifier id to store the full type name (refactoring).

pull/547/head
triton 11 years ago
parent
commit
4db4bfa567
  1. 7
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs

7
src/Generator/Generators/CSharp/CSharpTextTemplate.cs

@ -729,18 +729,19 @@ namespace CppSharp.Generators.CSharp
var fieldTypePrinted = field.QualifiedType.CSharpType(TypePrinter); var fieldTypePrinted = field.QualifiedType.CSharpType(TypePrinter);
var typeName = safeIdentifier;
if (!string.IsNullOrWhiteSpace(fieldTypePrinted.NameSuffix)) if (!string.IsNullOrWhiteSpace(fieldTypePrinted.NameSuffix))
safeIdentifier += fieldTypePrinted.NameSuffix; typeName += fieldTypePrinted.NameSuffix;
var access = @class != null && !@class.IsGenerated ? "internal" : "public"; var access = @class != null && !@class.IsGenerated ? "internal" : "public";
if (field.Expression != null) if (field.Expression != null)
{ {
var fieldValuePrinted = field.Expression.CSharpValue(ExpressionPrinter); var fieldValuePrinted = field.Expression.CSharpValue(ExpressionPrinter);
Write("{0} {1} {2} = {3};", access, fieldTypePrinted.Type, safeIdentifier, fieldValuePrinted); Write("{0} {1} {2} = {3};", access, fieldTypePrinted.Type, typeName, fieldValuePrinted);
} }
else else
{ {
Write("{0} {1} {2};", access, fieldTypePrinted.Type, safeIdentifier); Write("{0} {1} {2};", access, fieldTypePrinted.Type, typeName);
} }
PopBlock(NewLineKind.BeforeNextBlock); PopBlock(NewLineKind.BeforeNextBlock);

Loading…
Cancel
Save