Exemplo n.º 1
0
        private static void Analyzer(SyntaxNodeAnalysisContext context)
        {
            if (context.IsGenerated()) return;
            var mainConstrutor = new MethodInformation(
                nameof(Uri),
                "System.Uri.Uri(string)",
                args =>
                {
                    {
                        if (args[0] == null)
                        {
                            return;
                        }
                        new Uri(args[0].ToString());
                    }
                }
            );
            var constructorWithUriKind = new MethodInformation(
                nameof(Uri),
                "System.Uri.Uri(string, System.UriKind)",
                args =>
                {
                    if (args[0] == null)
                    {
                        return;
                    }
                    new Uri(args[0].ToString(), (UriKind)args[1]);
                }
            );

            var checker = new MethodChecker(context, Rule);
            checker.AnalyzeConstructor(mainConstrutor);
            checker.AnalyzeConstructor(constructorWithUriKind);
        }