예제 #1
0
        private string GetMethodName(BaseMethodDeclarationSyntax node)
        {
            string result;

            var type = node.GetType();

            if (type == typeof(MethodDeclarationSyntax))
            {
                var method = node as MethodDeclarationSyntax;
                result = method.Identifier.ToString();
            }
            else if (type == typeof(OperatorDeclarationSyntax))
            {
                var op = node as OperatorDeclarationSyntax;
                result = op.UnderlyingMethodName();
            }
            else if (type == typeof(ConversionOperatorDeclarationSyntax))
            {
                var conv = node as ConversionOperatorDeclarationSyntax;
                result = conv.UnderlyingMethodName();
            }
            else
            {
                throw new NotSupportedException($"Unsupported node type. ({node.GetType()})");
            }

            result = result + "_InnerIterator";
            result = IdentifierFactory.CreateUnique(UsedIdentifiers, result);
            UsedIdentifiers.Add(result);
            return(result);
        }
예제 #2
0
        private string GetFieldName(PropertyDeclarationSyntax node)
        {
            var propertyName = node.Identifier.ToString();
            var result       = IdentifierFactory.CreateUnique(UsedIdentifiers, $"_{propertyName}");

            UsedIdentifiers.Add(result);
            return(result);
        }