IronPython.Runtime.Binding.ConditionalBuilder.GetMetaObject C# (CSharp) Method

GetMetaObject() public method

Gets the resulting meta object for the full body. FinishCondition must have been called.
public GetMetaObject ( ) : DynamicMetaObject
return System.Dynamic.DynamicMetaObject
        public DynamicMetaObject/*!*/ GetMetaObject(params DynamicMetaObject/*!*/[]/*!*/ types) {
            if (_body == null) {
                throw new InvalidOperationException("FinishCondition not called before GetMetaObject");
            }

            Expression body = _body;
            for (int i = _bodies.Count - 1; i >= 0; i--) {

                body = Ast.Condition(
                    _conditions[i],
                    AstUtils.Convert(_bodies[i], _retType),
                    AstUtils.Convert(body, _retType)
                );
            }

            body = Ast.Block(_variables, body);

            return new DynamicMetaObject(
                body,
                BindingRestrictions.Combine(types)
            );
        }

Usage Example

Beispiel #1
0
            protected override DynamicMetaObject /*!*/ Finish(bool metaOnly)
            {
                DynamicMetaObject res = _cb.GetMetaObject(_restrictedSelf);

                if (metaOnly)
                {
                    res = BindingHelpers.AddDynamicTestAndDefer(
                        _member,
                        res,
                        new DynamicMetaObject[] { _type },
                        _metaValInfo
                        );
                }
                else if (!Value.IsSystemType)
                {
                    res = BindingHelpers.AddDynamicTestAndDefer(
                        _member,
                        res,
                        new DynamicMetaObject[] { _type },
                        _valInfo
                        );
                }

                return(res);
            }
All Usage Examples Of IronPython.Runtime.Binding.ConditionalBuilder::GetMetaObject