private static void AddProperty(ClassSyntaxNode classNode, ScriptClassProperty property) { var propertyNode = new PropertySyntaxNode(property.Name, property.ValueType, property.GetterSourceCode, property.SetterSourceCode); classNode.AddSubNode(propertyNode); classNode.AddSubNode(new EmptyLineSyntaxNode()); }
public void Visit(PropertySyntaxNode propertySyntax) { if (string.IsNullOrWhiteSpace(propertySyntax.PropertyGetterSourceCode) && string.IsNullOrWhiteSpace(propertySyntax.PropertySetterSourceCode)) { AppendLine($"public {propertySyntax.ValueType} {propertySyntax.PropertyName} {{ get; set; }}"); return; } AppendLine($"public {propertySyntax.ValueType} {propertySyntax.PropertyName}"); AppendLine("{"); _indentLevel++; if (!string.IsNullOrWhiteSpace(propertySyntax.PropertyGetterSourceCode)) { AddPropertyPart("get", propertySyntax.PropertyGetterSourceCode); } if (!string.IsNullOrWhiteSpace(propertySyntax.PropertySetterSourceCode)) { AddPropertyPart("set", propertySyntax.PropertySetterSourceCode); } _indentLevel--; AppendLine("}"); }