Fix tooltips generation for native properties to reflect getter and setter docsa

This commit is contained in:
Wojtek Figat
2021-02-07 21:41:17 +01:00
parent 2f34bfbeff
commit 103d630d80
3 changed files with 14 additions and 21 deletions

View File

@@ -437,13 +437,13 @@ public:
} }
/// <summary> /// <summary>
/// Sets actor orientation in 3D space /// Sets actor orientation in 3D space.
/// </summary> /// </summary>
/// <param name="value">The value to set.</param> /// <param name="value">The value to set.</param>
API_PROPERTY() void SetOrientation(const Quaternion& value); API_PROPERTY() void SetOrientation(const Quaternion& value);
/// <summary> /// <summary>
/// Gets actor scale in 3D space /// Gets actor scale in 3D space.
/// </summary> /// </summary>
API_PROPERTY(Attributes="HideInEditor, NoSerialize") API_PROPERTY(Attributes="HideInEditor, NoSerialize")
FORCE_INLINE Vector3 GetScale() const FORCE_INLINE Vector3 GetScale() const
@@ -458,13 +458,13 @@ public:
API_PROPERTY() void SetScale(const Vector3& value); API_PROPERTY() void SetScale(const Vector3& value);
/// <summary> /// <summary>
/// Gets actor rotation matrix /// Gets actor rotation matrix.
/// </summary> /// </summary>
API_PROPERTY(Attributes="HideInEditor, NoSerialize") API_PROPERTY(Attributes="HideInEditor, NoSerialize")
Matrix GetRotation() const; Matrix GetRotation() const;
/// <summary> /// <summary>
/// Sets actor rotation matrix /// Sets actor rotation matrix.
/// </summary> /// </summary>
/// <param name="value">The value to set.</param> /// <param name="value">The value to set.</param>
API_PROPERTY() void SetRotation(const Matrix& value); API_PROPERTY() void SetRotation(const Matrix& value);

View File

@@ -488,10 +488,7 @@ namespace Flax.Build.Bindings
{ {
if (comment.Contains("/// <returns>")) if (comment.Contains("/// <returns>"))
continue; continue;
var c = comment.Replace("::", "."); contents.Append(indent).Append(comment.Replace("::", ".")).AppendLine();
contents.Append(indent);
contents.Append(c);
contents.AppendLine();
} }
GenerateCSharpAttributes(buildData, contents, indent, eventInfo, true); GenerateCSharpAttributes(buildData, contents, indent, eventInfo, true);
@@ -586,11 +583,7 @@ namespace Flax.Build.Bindings
{ {
if (comment.Contains("/// <returns>")) if (comment.Contains("/// <returns>"))
continue; continue;
contents.Append(indent).Append(comment.Replace("::", ".")).AppendLine();
var c = comment.Replace("::", ".");
contents.Append(indent);
contents.Append(c);
contents.AppendLine();
} }
GenerateCSharpAttributes(buildData, contents, indent, fieldInfo, true); GenerateCSharpAttributes(buildData, contents, indent, fieldInfo, true);
@@ -636,14 +629,7 @@ namespace Flax.Build.Bindings
{ {
if (comment.Contains("/// <returns>") || comment.Contains("<param name=")) if (comment.Contains("/// <returns>") || comment.Contains("<param name="))
continue; continue;
contents.Append(indent).Append(comment.Replace("::", ".")).AppendLine();
var c = comment.Replace("::", ".");
contents.Append(indent);
if (propertyInfo.Getter != null && propertyInfo.Setter != null)
contents.Append(c.Replace("/// Gets ", "/// Gets or sets "));
else
contents.Append(c);
contents.AppendLine();
} }
GenerateCSharpAttributes(buildData, contents, indent, propertyInfo, true); GenerateCSharpAttributes(buildData, contents, indent, propertyInfo, true);

View File

@@ -711,6 +711,13 @@ namespace Flax.Build.Bindings
return propertyInfo; return propertyInfo;
throw new Exception($"Property {propertyName} in class {classInfo.Name} (line {context.Tokenizer.CurrentLine}) has mismatching getter return type ({getterType}) and setter parameter type ({setterType}). Both getter and setter methods must use the same value type used for property."); throw new Exception($"Property {propertyName} in class {classInfo.Name} (line {context.Tokenizer.CurrentLine}) has mismatching getter return type ({getterType}) and setter parameter type ({setterType}). Both getter and setter methods must use the same value type used for property.");
} }
// Fix documentation comment to reflect both getter and setters available
for (var i = 0; i < propertyInfo.Comment.Length; i++)
{
ref var comment = ref propertyInfo.Comment[i];
comment = comment.Replace("/// Gets ", "/// Gets or sets ");
}
} }
return propertyInfo; return propertyInfo;