public void semantic_check_assign_tuple(addressed_value_list vars, expression ex) { // Проверить, что справа - Tuple var expr = convert_strong(ex); expr = convert_if_typed_expression_to_function_call(expr); var t = ConvertSemanticTypeNodeToNETType(expr.type); if (t == null) { AddError(expr.location, "TUPLE_EXPECTED"); } if (!t.FullName.StartsWith("System.Tuple")) { AddError(expr.location, "TUPLE_EXPECTED"); } var n = vars.variables.Count(); if (n > t.GetGenericArguments().Count()) { AddError(get_location(vars), "TOO_MANY_ELEMENTS_ON_LEFT_SIDE_OF_TUPLE_ASSIGNMRNT"); } }
public void semantic_check_assign_tuple(addressed_value_list vars, expression ex) { // Почти полностью идентичный код в двух проверках var expr = convert_strong(ex); expr = convert_if_typed_expression_to_function_call(expr); var t = ConvertSemanticTypeNodeToNETType(expr.type); if (t == null) { AddError(expr.location, "TUPLE_OR_SEQUENCE_EXPECTED"); } var IsTuple = false; var IsSequence = false; if (t.FullName.StartsWith("System.Tuple")) { IsTuple = true; } if (!IsTuple) { if (t.Name.Equals("IEnumerable`1") || t.GetInterface("IEnumerable`1") != null) { IsSequence = true; } } if (!IsTuple && !IsSequence) { AddError(expr.location, "TUPLE_OR_SEQUENCE_EXPECTED"); } if (IsTuple) { var n = vars.variables.Count(); if (n > t.GetGenericArguments().Count()) { AddError(get_location(vars), "TOO_MANY_ELEMENTS_ON_LEFT_SIDE_OF_TUPLE_ASSIGNMRNT"); } } }
public virtual void visit(addressed_value_list _addressed_value_list) { DefaultVisit(_addressed_value_list); }
public override void visit(addressed_value_list _addressed_value_list) { DefaultVisit(_addressed_value_list); pre_do_visit(_addressed_value_list); for (int i = 0; i < variables.Count; i++) visit(addressed_value_list.variables[i]); post_do_visit(_addressed_value_list); }
public virtual void post_do_visit(addressed_value_list _addressed_value_list) { }