private void Process(PropertyDeclarationSyntax syntaxItem) { if (PreprocessMode) { return; } if (syntaxItem == null || syntaxItem.IsPrivate() || syntaxItem.IsInternal() || syntaxItem.IsExluded()) { return; } var publicOnly = syntaxItem.Parent.Kind() == SyntaxKind.ClassDeclaration; if (!publicOnly || syntaxItem.IsPublic()) { var nullable = syntaxItem.Type.IsNullable() ? "?" : ""; AddLine($"{syntaxItem.Identifier.ToTypescript()}{nullable} : {syntaxItem.Type.ToTypescript()};"); } }
bool CheckVisibility(FieldDeclarationSyntax baseFieldFieldDeclaration, AccessorDeclarationSyntax getNode, AccessorDeclarationSyntax setNode, PropertyDeclarationSyntax propertyDeclaration) { if (baseFieldFieldDeclaration.IsPrivate()) { return(true); } else { if (baseFieldFieldDeclaration.IsPublic()) { if (propertyDeclaration.IsPublic() == false) { return(false); } if (getNode.Modifiers.Any()) { return(false); } if (setNode.Modifiers.Any()) { return(false); } } else if (baseFieldFieldDeclaration.IsProtected()) { if (propertyDeclaration.IsPrivate() == false) { return(false); } if (propertyDeclaration.IsProtected()) { if (getNode.Modifiers.Any()) { return(false); } if (setNode.Modifiers.Any()) { return(false); } } else if (propertyDeclaration.IsPublic()) { if (baseFieldFieldDeclaration.IsInternal() == false) { if (getNode.Modifiers.Any(x => x.IsKind(SyntaxKind.PrivateKeyword) || x.IsKind(SyntaxKind.InternalKeyword))) { return(false); } if (setNode.Modifiers.Any(x => x.IsKind(SyntaxKind.PrivateKeyword) || x.IsKind(SyntaxKind.InternalKeyword))) { return(false); } } else { if (getNode.Modifiers.Any(x => x.IsKind(SyntaxKind.PrivateKeyword))) { return(false); } if (setNode.Modifiers.Any(x => x.IsKind(SyntaxKind.PrivateKeyword))) { return(false); } } } } else if (baseFieldFieldDeclaration.IsInternal()) { if (propertyDeclaration.IsPrivate() == false) { return(false); } if (propertyDeclaration.IsInternal()) { if (getNode.Modifiers.Any()) { return(false); } if (setNode.Modifiers.Any()) { return(false); } } else if (propertyDeclaration.IsPublic()) { if (getNode.Modifiers.Any(x => x.IsKind(SyntaxKind.PrivateKeyword) || x.IsKind(SyntaxKind.ProtectedKeyword))) { return(false); } if (setNode.Modifiers.Any(x => x.IsKind(SyntaxKind.PrivateKeyword) || x.IsKind(SyntaxKind.ProtectedKeyword))) { return(false); } } } } return(true); }