internal CatchBlockSlim(TypeSlim test, ParameterExpressionSlim variable, ExpressionSlim body, ExpressionSlim filter) { Test = test; Variable = variable; Body = body; Filter = filter; }
/// <summary> /// Creates a new expression that is like this one, but using the supplied children. If all of the children are the same, it will return this expression. /// </summary> /// <param name="variable">The <see cref="Variable" /> property of the result.</param> /// <param name="filter">The <see cref="Filter" /> property of the result.</param> /// <param name="body">The <see cref="Body" /> property of the result.</param> /// <returns>This expression if no children changed, or an expression with the updated children.</returns> public CatchBlockSlim Update(ParameterExpressionSlim variable, ExpressionSlim filter, ExpressionSlim body) { if (variable == Variable && filter == Filter && body == Body) { return(this); } return(new CatchBlockSlim(Test, variable, body, filter)); }
protected internal override ExpressionSlim VisitParameter(ParameterExpressionSlim node) { Append("Parameter("); Append(node.Type); Append(", "); Append(node.Name ?? "Param"); Append(')'); return(node); }
/// <summary> /// Visits a parameter expression slim tree node, produces a parameter expression. /// </summary> /// <param name="node">Node to visit.</param> /// <returns>The parameter expression represented by the expression slim node.</returns> protected override ParameterExpression MakeParameter(ParameterExpressionSlim node) { if (!_variables.TryGetValue(node, out ParameterExpression res)) { var type = MakeType(node.Type); res = _factory.Parameter(type, node.Name); _variables[node] = res; } return(res); }
/// <summary> /// Gets the hash code for a global <paramref name="parameter"/>. /// </summary> /// <param name="parameter">The global parameter to get the hash code for.</param> /// <returns>A hash code for the specified global <paramref name="parameter"/>.</returns> /// <remarks> /// The expression type (<see cref="ExpressionType.Parameter"/>) and the type of the expression /// (see <see cref="ParameterExpressionSlim.Type"/> will be added to the hash code returned by /// the overridden method. It is recommended to base the hash code of a global parameter either /// on object identity or the name. The default implementation uses the name. /// </remarks> protected virtual int GetHashCode(ParameterExpressionSlim parameter) => GetHashCode(parameter.Name);
/// <summary> /// Visits a parameter expression tree node. /// </summary> /// <param name="node">Node to visit.</param> /// <returns>Result of visiting the node.</returns> protected internal virtual ExpressionSlim VisitParameter(ParameterExpressionSlim node) { return(node); }