/// <summary> /// Gets an expression which is used for accessing this slot. If the slot lookup fails the error expression /// is used again. /// /// The default implementation just calls the TryGetValue method. Subtypes of PythonTypeSlot can override /// this and provide a more optimal implementation. /// </summary> internal virtual void MakeGetExpression(PythonBinder /*!*/ binder, Expression /*!*/ codeContext, DynamicMetaObject instance, DynamicMetaObject /*!*/ owner, ConditionalBuilder /*!*/ builder) { ParameterExpression tmp = Ast.Variable(typeof(object), "slotTmp"); Expression call = Ast.Call( typeof(PythonOps).GetMethod("SlotTryGetValue"), codeContext, AstUtils.Convert(AstUtils.WeakConstant(this), typeof(PythonTypeSlot)), instance != null ? instance.Expression : AstUtils.Constant(null), owner.Expression, tmp ); builder.AddVariable(tmp); if (!GetAlwaysSucceeds) { builder.AddCondition( call, tmp ); } else { builder.FinishCondition(Ast.Block(call, tmp)); } }