public static ExpressionPairCollection FromArray(params Boo.Lang.Compiler.Ast.ExpressionPair[] items) { var collection = new ExpressionPairCollection(); collection.AddRange(items); return(collection); }
void ResolveNamedArguments(IType type, ExpressionPairCollection arguments) { foreach (ExpressionPair arg in arguments) { if (!ProcessNamedArgument(arg)) continue; ResolveNamedArgument(type, (ReferenceExpression)arg.First, arg.Second); } }
private void AddResolvedNamedArgumentsToEval(MethodInvocationExpression eval, ExpressionPairCollection namedArguments, ReferenceExpression instance) { foreach (ExpressionPair pair in namedArguments) { if (TypeSystemServices.IsError(pair.First)) continue; AddResolvedNamedArgumentToEval(eval, pair, instance); } }
protected bool PropertiesToExpressionPairs(Expression expression, ExpressionPairCollection pairs) { BinaryExpression assignment; if (EnsureAssignment(expression, out assignment) == false) return false; ArrayLiteralExpression properties; if (MacroHelper.IsCompoundAssignment(assignment.Right, out properties)) { foreach (var item in properties.Items) { if (item == properties.Items[0]) { pairs.Add(new ExpressionPair(assignment.Left, item)); } else { BinaryExpression property; if (EnsureAssignment(item, out property) == false) return false; pairs.Add(new ExpressionPair(property.Left, property.Right)); } } } else { pairs.Add(new ExpressionPair(assignment.Left, assignment.Right)); } return true; }
void GetNamedValues(ExpressionPairCollection values, out PropertyInfo[] outNamedProperties, out object[] outPropertyValues, out FieldInfo[] outNamedFields, out object[] outFieldValues) { List namedProperties = new List(); List propertyValues = new List(); List namedFields = new List(); List fieldValues = new List(); foreach (ExpressionPair pair in values) { ITypedEntity entity = (ITypedEntity)GetEntity(pair.First); object value = GetValue(entity.Type, pair.Second); if (EntityType.Property == entity.EntityType) { namedProperties.Add(GetPropertyInfo(entity)); propertyValues.Add(value); } else { namedFields.Add(GetFieldInfo((IField)entity)); fieldValues.Add(value); } } outNamedProperties = (PropertyInfo[])namedProperties.ToArray(typeof(PropertyInfo)); outPropertyValues = propertyValues.ToArray(); outNamedFields = (FieldInfo[])namedFields.ToArray(typeof(FieldInfo)); outFieldValues = fieldValues.ToArray(); }
public Boo.Lang.Compiler.Ast.ExpressionPairCollection PopRange(int begin) { Boo.Lang.Compiler.Ast.ExpressionPairCollection range = new Boo.Lang.Compiler.Ast.ExpressionPairCollection(_parent); range.InnerList.Extend(InternalPopRange(begin)); return(range); }