private StandardRule <T> MakeGetMemberRule <T>(GetMemberAction action, CodeContext context)
        {
            object value;

            if (TryGetValue(action.Name, out value))
            {
                Debug.Assert(value is MemberTracker);
                MemberTracker memValue = (MemberTracker)value;

                StandardRule <T> rule = new StandardRule <T>();
                rule.MakeTest(typeof(NamespaceTracker));
                rule.AddTest(
                    Ast.Ast.Equal(
                        Ast.Ast.ReadProperty(
                            Ast.Ast.Convert(rule.Parameters[0], typeof(NamespaceTracker)),
                            typeof(NamespaceTracker).GetProperty("Id")
                            ),
                        Ast.Ast.Constant(Id)
                        )
                    );


                Expression target = context.LanguageContext.Binder.ReturnMemberTracker(memValue.DeclaringType, memValue);

                rule.SetTarget(rule.MakeReturn(context.LanguageContext.Binder, target));
                return(rule);
            }
            return(null);
        }
Exemple #2
0
 public static GetMemberAction GetMember(string name)
 {
     return(GetMemberAction.Make(name));
 }
 public GetMemberBinderHelper(CodeContext context, GetMemberAction action, object[] args)
     : base(context, action, args)
 {
 }