private SDField GetParsedField(IFieldSymbol field) { var syntaxReference = field.DeclaringSyntaxReferences.Any() ? field.DeclaringSyntaxReferences.Single() : null; var sdField = new SDField(field.GetIdentifier()) { Name = field.Name, DeclaringType = _typeRefParser.GetParsedTypeReference(field.ContainingType), Accessibility = field.DeclaredAccessibility.ToString().ToLower(), ReturnType = _typeRefParser.GetParsedTypeReference(field.Type), ConstantValue = field.ConstantValue != null ? field.ConstantValue.ToString() : string.Empty, IsConst = field.IsConst, IsReadonly = field.IsReadOnly, Documentations = DocumentationParser.ParseDocumentation(field), Region = syntaxReference != null ? new SDRegion { Start = syntaxReference.Span.Start, End = syntaxReference.Span.End, StartLine = syntaxReference.SyntaxTree.GetLineSpan(syntaxReference.Span).StartLinePosition.Line + 1, EndLine = syntaxReference.SyntaxTree.GetLineSpan(syntaxReference.Span).EndLinePosition.Line + 1, FilePath = syntaxReference.SyntaxTree.FilePath, Filename = Path.GetFileName(syntaxReference.SyntaxTree.FilePath) } : null }; ParserOptions.SDRepository.AddMember(sdField); return sdField; }
private SDField GetParsedField(IFieldSymbol field) { var syntaxReference = field.DeclaringSyntaxReferences.Any() ? field.DeclaringSyntaxReferences.Single() : null; var sdField = new SDField(field.GetIdentifier()) { Name = field.Name, DeclaringType = _typeRefParser.GetParsedTypeReference(field.ContainingType), Accessibility = field.DeclaredAccessibility.ToString().ToLower(), ReturnType = _typeRefParser.GetParsedTypeReference(field.Type), ConstantValue = field.ConstantValue != null?field.ConstantValue.ToString() : string.Empty, IsConst = field.IsConst, IsReadonly = field.IsReadOnly, Documentations = DocumentationParser.ParseDocumentation(field), Region = syntaxReference != null ? new SDRegion { Start = syntaxReference.Span.Start, End = syntaxReference.Span.End, StartLine = syntaxReference.SyntaxTree.GetLineSpan(syntaxReference.Span).StartLinePosition.Line + 1, EndLine = syntaxReference.SyntaxTree.GetLineSpan(syntaxReference.Span).EndLinePosition.Line + 1, FilePath = syntaxReference.SyntaxTree.FilePath, Filename = Path.GetFileName(syntaxReference.SyntaxTree.FilePath) } : null }; ParserOptions.SDRepository.AddMember(sdField); return(sdField); }
private SDField GetParsedField(IFieldSymbol field) { var sdField = new SDField(field.GetIdentifier()) { Name = field.Name, DeclaringType = _typeRefParser.GetParsedTypeReference(field.ContainingType), Accessibility = field.DeclaredAccessibility.ToString().ToLower(), ReturnType = _typeRefParser.GetParsedTypeReference(field.Type), ConstantValue = field.ConstantValue != null ? field.ConstantValue.ToString() : string.Empty, IsConst = field.IsConst, IsReadonly = field.IsReadOnly, Documentations = DocumentationParser.ParseDocumentation(field) }; ParserOptions.SDRepository.AddMember(sdField); return sdField; }
private SDField GetParsedField(IFieldSymbol field) { var sdField = new SDField(field.GetIdentifier()) { Name = field.Name, DeclaringType = _typeRefParser.GetParsedTypeReference(field.ContainingType), Accessibility = field.DeclaredAccessibility.ToString().ToLower(), ReturnType = _typeRefParser.GetParsedTypeReference(field.Type), ConstantValue = field.ConstantValue != null?field.ConstantValue.ToString() : string.Empty, IsConst = field.IsConst, IsReadonly = field.IsReadOnly, Documentations = DocumentationParser.ParseDocumentation(field) }; ParserOptions.SDRepository.AddMember(sdField); return(sdField); }
public static InstanceMemberInfo CreateFrom(IFieldSymbol field) { return(new(field, field.Type, field.GetIdentifier(), field.DeclaredAccessibility, field.IsStatic)); }