/// <summary> /// Provides a way for the binder to provide a custom error message when lookup fails. Just /// doing this for the time being until we get a more robust error return mechanism. /// </summary> public virtual Expression MakeReadOnlyMemberError(RuleBuilder rule, Type type, string name) { return(rule.MakeError( Expression.New( typeof(MissingMemberException).GetConstructor(new Type[] { typeof(string) }), Expression.Constant(name) ) )); }
private void SetErrorTarget(OperatorInfo info) { _rule.Target = _rule.MakeError( AstUtils.ComplexCallHelper( typeof(BinderOps).GetMethod("BadArgumentsForOperation"), ArrayUtils.Insert((Expression)Ast.Constant(info.Operator), _rule.Parameters) ) ); }
protected virtual void MakeCannotCallRule(Type type) { _rule.Target = _rule.MakeError( Ast.New( typeof(ArgumentTypeException).GetConstructor(new Type[] { typeof(string) }), Ast.Constant(type.Name + " is not callable") ) ); }
/// <summary> /// Internal helper to produce the actual expression used for the error when emitting /// the error into a rule. /// </summary> public Expression MakeErrorForRule(RuleBuilder rule, ActionBinder binder) { switch (_kind) { case ErrorInfoKind.Error: rule.IsError = true; return(rule.MakeReturn(binder, _value)); case ErrorInfoKind.Success: return(rule.MakeReturn(binder, _value)); case ErrorInfoKind.Exception: return(rule.MakeError(_value)); default: throw new InvalidOperationException(); } }
/// <summary> /// Provides a way for the binder to provide a custom error message when lookup fails. Just /// doing this for the time being until we get a more robust error return mechanism. /// </summary> public virtual Expression MakeReadOnlyMemberError(RuleBuilder rule, Type type, string name) { return rule.MakeError( Expression.New( typeof(MissingMemberException).GetConstructor(new Type[] { typeof(string) }), AstUtils.Constant(name) ) ); }
/// <summary> /// Internal helper to produce the actual expression used for the error when emitting /// the error into a rule. /// </summary> public Expression MakeErrorForRule(RuleBuilder rule, ActionBinder binder) { switch (_kind) { case ErrorInfoKind.Error: rule.IsError = true; return rule.MakeReturn(binder, _value); case ErrorInfoKind.Success: return rule.MakeReturn(binder, _value); case ErrorInfoKind.Exception: return rule.MakeError(_value); default: throw new InvalidOperationException(); } }