public Expression CreateCallSiteBinder (ResolveContext ec, Arguments args) { Arguments binder_args = new Arguments (4); MemberAccess sle = new MemberAccess (new MemberAccess ( new QualifiedAliasMember (QualifiedAliasMember.GlobalAlias, "System", loc), "Linq", loc), "Expressions", loc); var flags = ec.HasSet (ResolveContext.Options.CheckedScope) ? CSharpBinderFlags.CheckedContext : 0; binder_args.Add (new Argument (new BinderFlags (flags, this))); binder_args.Add (new Argument (new MemberAccess (new MemberAccess (sle, "ExpressionType", loc), name, loc))); binder_args.Add (new Argument (new TypeOf (ec.CurrentType, loc))); binder_args.Add (new Argument (new ImplicitlyTypedArrayCreation (args.CreateDynamicBinderArguments (ec), loc))); return new Invocation (GetBinder ("UnaryOperation", loc), binder_args); }
public Expression CreateCallSiteBinder (ResolveContext ec, Arguments args) { Arguments binder_args = new Arguments (member != null ? 5 : 3); bool is_member_access = member is MemberAccess; CSharpBinderFlags call_flags; if (!is_member_access && member is SimpleName) { call_flags = CSharpBinderFlags.InvokeSimpleName; is_member_access = true; } else { call_flags = 0; } binder_args.Add (new Argument (new BinderFlags (call_flags, this))); if (is_member_access) binder_args.Add (new Argument (new StringLiteral (ec.BuiltinTypes, member.Name, member.Location))); if (member != null && member.HasTypeArguments) { TypeArguments ta = member.TypeArguments; if (ta.Resolve (ec)) { var targs = new ArrayInitializer (ta.Count, loc); foreach (TypeSpec t in ta.Arguments) targs.Add (new TypeOf (t, loc)); binder_args.Add (new Argument (new ImplicitlyTypedArrayCreation (targs, loc))); } } else if (is_member_access) { binder_args.Add (new Argument (new NullLiteral (loc))); } binder_args.Add (new Argument (new TypeOf (ec.CurrentType, loc))); Expression real_args; if (args == null) { // Cannot be null because .NET trips over real_args = new ArrayCreation ( new MemberAccess (GetBinderNamespace (loc), "CSharpArgumentInfo", loc), new ArrayInitializer (0, loc), loc); } else { real_args = new ImplicitlyTypedArrayCreation (args.CreateDynamicBinderArguments (ec), loc); } binder_args.Add (new Argument (real_args)); return new Invocation (GetBinder (is_member_access ? "InvokeMember" : "Invoke", loc), binder_args); }
protected override Expression CreateCallSiteBinder (ResolveContext ec, Arguments args, bool isSet) { Arguments binder_args = new Arguments (4); binder_args.Add (new Argument (new BinderFlags (flags, this))); binder_args.Add (new Argument (new StringLiteral (ec.BuiltinTypes, name, loc))); binder_args.Add (new Argument (new TypeOf (ec.CurrentType, loc))); binder_args.Add (new Argument (new ImplicitlyTypedArrayCreation (args.CreateDynamicBinderArguments (ec), loc))); isSet |= (flags & CSharpBinderFlags.ValueFromCompoundAssignment) != 0; return new Invocation (GetBinder (isSet ? "SetMember" : "GetMember", loc), binder_args); }
public Expression CreateCallSiteBinder (ResolveContext ec, Arguments args) { Arguments binder_args = new Arguments (3); binder_args.Add (new Argument (new BinderFlags (0, this))); binder_args.Add (new Argument (new TypeOf (ec.CurrentType, loc))); binder_args.Add (new Argument (new ImplicitlyTypedArrayCreation (args.CreateDynamicBinderArguments (ec), loc))); return new Invocation (GetBinder ("InvokeConstructor", loc), binder_args); }