static (Block, string) firstComparisand(Parameters parameters) { var selectedParameter = parameters.GetParameters().FirstOrDefault(p => p.Comparisand != null); RejectNull(selectedParameter, LOCATION, $"No comparisands in parameters {parameters}"); return(selectedParameter.Comparisand, selectedParameter.Name); }
protected static (Block, string) firstComparisand(Parameters parameters) { var selectedParameter = parameters.GetParameters().FirstOrDefault(p => p.Comparisand != null); selectedParameter.Must().Not.BeNull().OrThrow(LOCATION, () => $"No comparisands in parameters {parameters}"); return(selectedParameter.Comparisand, selectedParameter.Name); }
protected static void setPlaceholderNames(Parameters parameters) { foreach (var parameter in parameters.GetParameters().Where(p => (p.Comparisand?.Count ?? 0) != 0)) { var comparisandAsAdded = parameter.Comparisand.AsAdded[0]; switch (comparisandAsAdded) { case FunctionInvoke functionInvoke: parameter.PlaceholderName = functionInvoke.Arguments.Blocks .Where(b => b.Count > 0) .Select(b => b[0]) .Where(v => v is Push) .Cast <Push>() .Where(p => p.Value is Placeholder) .Select(p => p.Value) .Select(v => v.Text) .ToString(","); continue; case Push push: switch (push.Value) { case Placeholder placeholder: parameter.PlaceholderName = placeholder.Text; break; case Array array: parameter.PlaceholderName = array.Values.Where(v => v is Placeholder).Select(v => v.Text).ToString(","); break; case List list: parameter.PlaceholderName = list.ComparisonValues().Where(v => v is Placeholder).Select(v => v.Text).ToString(":"); break; } break; } } }