private expression DesugarRecursiveParameters(expression expression, pattern_node pattern) { List <pattern_parameter> parameters = pattern.parameters; expression conjunction = new is_pattern_expr(expression, pattern, pattern.source_context); for (int i = 0; i < parameters.Count; i++) { if (parameters[i] is recursive_pattern_parameter parameter) { //var parameterType = (parameter.pattern as deconstructor_pattern).type; var newName = NewGeneralName(); pattern_parameter varParameter = null; if (pattern is deconstructor_pattern) { varParameter = new var_deconstructor_parameter(newName, null, false); } else if (pattern is collection_pattern) { varParameter = new collection_pattern_var_parameter(newName, null); } else if (pattern is tuple_pattern) { varParameter = new tuple_pattern_var_parameter(newName, null); } parameters[i] = varParameter; varParameter.Parent = parameters[i]; conjunction = bin_expr.LogicalAnd(conjunction, DesugarRecursiveParameters(newName, parameter.pattern)); } } return(conjunction); }
public virtual void visit(collection_pattern_var_parameter _collection_pattern_var_parameter) { DefaultVisit(_collection_pattern_var_parameter); }