public FactoryParameter(FactoryParameter other) { Name = other.Name; OriginalType = other.OriginalType; Type = other.Type; IsList = other.IsList; IsParams = other.IsParams; IsOptional = other.IsOptional; ParseNameType = other.ParseNameType; }
private void SeedParseNameFactories(Dictionary<SyntaxType, List<Factory>> factories) { foreach (var item in factories) { var newFactories = new List<Factory>(); foreach (var factory in item.Value) { if (factory.Parameters.All(p => !typeof(TypeSyntax).IsAssignableFrom(p.OriginalType))) continue; var newFactory = new Factory(factory.Name); foreach (var parameter in factory.Parameters) { FactoryParameter newParameter; if (typeof(TypeSyntax).IsAssignableFrom(parameter.OriginalType)) { newParameter = new FactoryParameter( parameter.Name, parameter.OriginalType, "String", parameter.IsList, parameter.IsParams, parameter.IsOptional ) { ParseNameType = parameter.OriginalType.Name }; } else { newParameter = new FactoryParameter(parameter); } newFactory.Parameters.Add(newParameter); } newFactories.Add(newFactory); } newFactories.RemoveAll(p => item.Value.Any(p1 => p1.Equals(p))); item.Value.AddRange(newFactories); } }
private string EscapeParameterName(FactoryParameter parameter) { switch (parameter.Name) { case "else": case "finally": case "operator": case "default": return "@" + parameter.Name; default: return parameter.Name; } }