GetValue() public method

Gets the expression that creates the value. Returns null if it's an error to get the value. The caller can then call GetErrorForGet to get the correct error Expression (or null if they should provide a default).
public GetValue ( Microsoft.Scripting.Actions.Calls.OverloadResolverFactory resolverFactory, ActionBinder binder, Type type ) : DynamicMetaObject
resolverFactory Microsoft.Scripting.Actions.Calls.OverloadResolverFactory
binder ActionBinder
type System.Type
return System.Dynamic.DynamicMetaObject
        private void MakeGenericBodyWorker(GetMemberInfo getMemInfo, Type instanceType, MemberTracker tracker, DynamicMetaObject instance)
        {
            if (instance != null)
            {
                tracker = tracker.BindToInstance(instance);
            }

            DynamicMetaObject val = tracker.GetValue(getMemInfo.ResolutionFactory, this, instanceType);

            if (val != null)
            {
                getMemInfo.Body.FinishCondition(val);
            }
            else
            {
                ErrorInfo ei = tracker.GetError(this, instanceType);
                if (ei.Kind != ErrorInfoKind.Success && getMemInfo.IsNoThrow)
                {
                    getMemInfo.Body.FinishError(MakeOperationFailed());
                }
                else
                {
                    getMemInfo.Body.FinishError(MakeError(ei, typeof(object)));
                }
            }
        }
Beispiel #2
0
        private void MakeGenericBodyWorker(GetMemberInfo getMemInfo, Type type, MemberTracker tracker, Expression instance)
        {
            if (instance != null)
            {
                tracker = tracker.BindToInstance(instance);
            }

            Expression val = tracker.GetValue(getMemInfo.CodeContext, this, type);

            getMemInfo.Body.FinishCondition(
                val != null ?
                val :
                MakeError(tracker.GetError(this))
                );
        }
        private void MakeGenericBodyWorker(Type type, MemberTracker tracker, Expression instance)
        {
            if (!_isStatic)
            {
                tracker = tracker.BindToInstance(instance ?? Instance);
            }

            Expression val = tracker.GetValue(Binder, type);
            Statement  newBody;

            if (val != null)
            {
                newBody = Rule.MakeReturn(Binder, val);
            }
            else
            {
                newBody = tracker.GetError(Binder).MakeErrorForRule(Rule, Binder);
            }

            AddToBody(newBody);
        }
        private void MakeGenericBodyWorker(GetMemberInfo getMemInfo, Type type, MemberTracker tracker, Expression instance) {
            if (instance != null) {
                tracker = tracker.BindToInstance(instance);
            }

            Expression val = tracker.GetValue(getMemInfo.CodeContext, this, type);

            if (val != null) {
                getMemInfo.Body.FinishCondition(val);
            } else {
                ErrorInfo ei = tracker.GetError(this);
                if (ei.Kind != ErrorInfoKind.Success && getMemInfo.IsNoThrow) {
                    getMemInfo.Body.FinishCondition(MakeOperationFailed());
                } else {
                    getMemInfo.Body.FinishCondition(MakeError(tracker.GetError(this), typeof(object)));
                }
            }
        }
        private void MakeGenericBodyWorker(GetMemberInfo getMemInfo, Type type, MemberTracker tracker, Expression instance) {
            if (instance != null) {
                tracker = tracker.BindToInstance(instance);
            }

            Expression val = tracker.GetValue(getMemInfo.CodeContext, this, type);

            getMemInfo.Body.FinishCondition(
                val != null ?
                    val :
                    MakeError(tracker.GetError(this))
            );
        }
        private void MakeGenericBodyWorker(GetMemberInfo getMemInfo, Type type, MemberTracker tracker, DynamicMetaObject instance) {
            if (instance != null) {
                tracker = tracker.BindToInstance(instance);
            }

            DynamicMetaObject val = tracker.GetValue(getMemInfo.ResolutionFactory, this, type);

            if (val != null) {
                getMemInfo.Body.FinishCondition(val);
            } else {
                ErrorInfo ei = tracker.GetError(this);
                if (ei.Kind != ErrorInfoKind.Success && getMemInfo.IsNoThrow) {
                    getMemInfo.Body.FinishError(MakeOperationFailed());
                } else {
                    getMemInfo.Body.FinishError(MakeError(tracker.GetError(this), typeof(object)));
                }
            }
        }