public FieldInfo ResolveFieldInfo(VariableDeclaratorSyntax node) { if (!TryResolveFieldInfo(node, out FieldInfo result)) { throw new Exception($"Failed to resolve FieldInfo: {node.ToString()}"); } return(result); }
private static Diag GetDiagnostic(VariableDeclaratorSyntax syntax, ContractCategory contractCategory) { var fieldDeclarationSyntax = syntax?.Ancestors().OfType <FieldDeclarationSyntax>().FirstOrDefault(); if (fieldDeclarationSyntax?.AttributeLists.ContainsNotNullAttribute() != false) { return(null); } return(new Diag(fieldDeclarationSyntax.GetLocation(), syntax.ToString(), contractCategory)); }
public override void VisitVariableDeclarator(VariableDeclaratorSyntax node) { var s = ""; var up = node.HasParent<VariableDeclarationSyntax, FieldDeclarationSyntax>(); if (up == null) { } else { s = node.ToString(); } _2JS.Append(s); base.VisitVariableDeclarator(node); }