private DynamicMetaObject TryBindGetMember(string name) { if (_lib.HasMember(name)) { BindingRestrictions restrictions = BindingRestrictions.GetTypeRestriction( Expression, typeof(ComTypeLibDesc) ).Merge( BindingRestrictions.GetExpressionRestriction( Expression.Equal( Expression.Property( AstUtils.Convert( Expression, typeof(ComTypeLibDesc) ), typeof(ComTypeLibDesc).GetProperty("Guid") ), AstUtils.Constant(_lib.Guid) ) ) ); return(new DynamicMetaObject( AstUtils.Constant( ((ComTypeLibDesc)Value).GetTypeLibObjectDesc(name) ), restrictions )); } return(null); }
public override MetaObject BindGetMember(GetMemberBinder binder) { if (_lib.HasMember(binder.Name)) { Restrictions restrictions = Restrictions.GetTypeRestriction( Expression, typeof(ComTypeLibDesc) ).Merge( Restrictions.GetExpressionRestriction( Expression.Equal( Expression.Property( AstUtils.Convert( Expression, typeof(ComTypeLibDesc) ), typeof(ComTypeLibDesc).GetProperty("Guid") ), Expression.Constant(_lib.Guid) ) ) ); return(new MetaObject( Expression.Constant( ((ComTypeLibDesc)Value).GetTypeLibObjectDesc(binder.Name) ), restrictions )); } return(base.BindGetMember(binder)); }