本文整理汇总了C#中Boo.Lang.Compiler.Ast.ExpressionCollection.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# ExpressionCollection.AddRange方法的具体用法?C# ExpressionCollection.AddRange怎么用?C# ExpressionCollection.AddRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Boo.Lang.Compiler.Ast.ExpressionCollection
的用法示例。
在下文中一共展示了ExpressionCollection.AddRange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMethodInvocationExpression
public override void OnMethodInvocationExpression(MethodInvocationExpression node)
{
var target = (MemberReferenceExpression)node.Target;
_methodsStack.Push(new CurrentMethod() { Target = target, Name = target.Name });
base.OnMethodInvocationExpression(node);
var currentMethod = _methodsStack.Pop();
var ga = (currentMethod.Target.Entity as IMethod).ConstructedInfo.GenericArguments ?? new IType[0];
ExpressionCollection methodGenericArguments = new ExpressionCollection();
methodGenericArguments.AddRange(ga.Select(a => new TypeofExpression { Type = _codeBuilder.CreateTypeReference(a) } as Expression));
Expression exprCallTypeArgs = methodGenericArguments.Count > 0
? _codeBuilder.CreateArray(_codeBuilder.TypeSystemServices.Map(typeof(Type[])), methodGenericArguments)
: new NullLiteralExpression() as Expression;
Expression exprTarget = node.Target.Entity.EntityType == TypeSystem.EntityType.Type
? new TypeofExpression { Type = _codeBuilder.CreateTypeReference(node.Target.Entity as IType) }
: node.Target;
var expressionCallInvocation = new MethodInvocationExpression(
ReferenceExpression.Lift("System.Linq.Expressions.Expression.Call"),
exprTarget,
new StringLiteralExpression(currentMethod.Name),
exprCallTypeArgs);
expressionCallInvocation.Arguments.AddRange(node.Arguments);
ReplaceCurrentNode(expressionCallInvocation);
}