Exemple #1
0
        Dictionary <string, Identifier> GenerateIdentifierFromGenerics(Dictionary <string, object> generics)
        {
            var result = new Dictionary <string, Identifier>();

            foreach (var genericPair in generics)
            {
                var generic = genericPair.Value;
                if (generic is Identifier)
                {
                    result.Add(genericPair.Key, (Identifier)generic);
                }
                else //if (generic is string)
                {
                    var stringGeneric = generic.ToString();// generic as string;
                    var stringParts   = stringGeneric.Split('.');
                    if (stringParts.Length == 1)
                    {
                        result.Add(genericPair.Key, new Identifier(stringGeneric));
                    }
                    else
                    {
                        var dotIdentifier = new IdentifierDot();
                        dotIdentifier.Identifiers = stringParts.Select(x => new Identifier(x)).ToList();
                        result.Add(genericPair.Key, dotIdentifier);
                    }
                }
                //else
                //    throw new Exception("Unsupported generic.");
            }
            return(result);
        }
Exemple #2
0
 /// <summary>
 /// Visits the specified composite identifier.
 /// </summary>
 /// <param name="compositeIdentifier">The composite identifier.</param>
 public override void Visit(IdentifierDot compositeIdentifier)
 {
     Write((Identifier)compositeIdentifier);
 }