public Expression Update(Expression body, LabelExpression @break, LabelExpression @continue) { if (Body.Equals(body) && BreakExpression == @break && ContinueExpression == @continue) { return this; } return AstExpression.ForEach(_foreachStatement, this, Visitor); }
internal static Label Label(LabelExpression expression) { return new Label() { Target = LabelTarget.Serialize(expression.Target), DefaultValue = expression.DefaultValue.Null(e => Serialize(e)), }.Apply(n => n.Type = TypeRef.Serialize(expression.Type)); }
private MSAst.LambdaExpression CreateOuterGeneratorFactory(Type lambdaType) { MSAst.LabelTarget returnLabelTarget = Ast.Label(lambdaType.GetMethod("Invoke").ReturnType); MSAst.Expression body = Ast.Return( returnLabelTarget, Ast.Call( typeof(RuntimeOps), "CreateDebugGenerator", new[] { _generatorLabelTarget.Type }, Ast.Call( typeof(RuntimeOps).GetMethod("CreateFrameForGenerator"), _debugContextExpression, _functionInfo ) ) ); MSAst.LabelExpression returnLabel = null; if (returnLabelTarget.Type == typeof(void)) { returnLabel = Ast.Label(returnLabelTarget, AstUtils.Void(body)); } else { returnLabel = Ast.Label(returnLabelTarget, AstUtils.Convert(body, returnLabelTarget.Type)); } return(Ast.Lambda( lambdaType, Ast.Block( _lambdaVars, returnLabel ), _alias, _lambdaParams)); }
public LabelExpressionProxy(LabelExpression node) { _node = node; }
/// <summary> /// Creates the lambda's return target label with the specified type. /// </summary> /// <param name="type">The target's type.</param> protected void CreateReturnTarget(Type type) { exitTarget = Expression.Label(type, "exit"); exitLabel = Expression.Label(exitTarget, Expression.Default(type)); defaultReturnExpression = Expression.Return(exitTarget, Expression.Default(type)); }
/// <summary> /// Creates the lambda's return target label with void type. /// </summary> protected void CreateReturnTarget() { exitTarget = Expression.Label("exit"); exitLabel = Expression.Label(exitTarget); defaultReturnExpression = Expression.Return(exitTarget); }
public virtual bool IsEvaluatableLabel (LabelExpression node) { ArgumentUtility.CheckNotNull ("node", node); return true; }
private Variable VisitLabel(LabelExpression node) { throw new NotSupportedException("Expression of type " + node.NodeType + " is not supported"); //this.Out("{ ... } "); //this.DumpLabel(node.Target); //this.Out(":"); }
protected internal virtual new Expression VisitLabel(LabelExpression node) { Contract.Requires(node != null); return(default(Expression)); }
/// <summary> /// Makes an expression slim representing a LabelExpression with the given children. /// </summary> /// <param name="node">Original expression.</param> /// <param name="target">Target label slim.</param> /// <param name="defaultValue">Default value expression slim.</param> /// <returns>Slim representation of the original expression.</returns> protected override ExpressionSlim MakeLabel(LabelExpression node, LabelTargetSlim target, ExpressionSlim defaultValue) { return(_factory.Label(target, defaultValue)); }
protected virtual Expression VisitLabel(LabelExpression node) { throw new NotImplementedException(); }
protected internal virtual new Expression VisitLabel(LabelExpression node) { return(default(Expression)); }
public LabelExpressionProxy(LabelExpression node) { ContractUtils.RequiresNotNull(node, nameof(node)); _node = node; }
protected override Expression VisitLabel(LabelExpression node) { var info = default(LabelInfo); if (TryGetLabelInfo(node.Target, out info)) { var variable = info.Value; var newTarget = info.Target; var res = Expression.Block( Expression.Assign(variable, node.DefaultValue), Expression.Label(newTarget), variable ); return res; } return base.VisitLabel(node); }
protected override Expression VisitLabel(LabelExpression node) { Labels.Add(node.Target); return base.VisitLabel(node); }
/// <summary> /// Visits the children of the <see cref="LabelExpression" />. /// </summary> /// <param name="node">The expression to visit.</param> /// <returns> /// The modified expression, if it or any subexpression was modified; /// otherwise, returns the original expression. /// </returns> protected internal virtual Expression VisitLabel(LabelExpression node) { return(node.Update(VisitLabelTarget(node.Target), Visit(node.DefaultValue))); }
protected override Expression VisitLabel(LabelExpression expression) { LabelExpression current; if (!TryGetCurrent(expression, out current)) { return expression; } if (!(this.result &= current.Type == expression.Type)) { return expression; } if (!(this.result &= current.NodeType == expression.NodeType)) { return expression; } this.currentObject = current.Target; this.VisitLabelTarget(expression.Target); if (!this.result) { return expression; } this.currentObject = current.DefaultValue; this.Visit(expression.DefaultValue); if (!this.result) { return expression; } this.currentObject = current; return expression; }
protected override Expression VisitLabel(LabelExpression node) { throw new NotSupportedException(); }
}//end static method internal XElement LabelExpressionToXElement(LabelExpression e) { object value; string xName = "LabelExpression"; object[] XElementValues = new object[5]; value = ((LabelExpression)e).Type; XElementValues[0] = GenerateXmlFromProperty(typeof(System.Type), "Type", value ?? string.Empty); value = ((LabelExpression)e).NodeType; XElementValues[1] = GenerateXmlFromProperty(typeof(System.Linq.Expressions.ExpressionType), "NodeType", value ?? string.Empty); value = ((LabelExpression)e).Target; XElementValues[2] = GenerateXmlFromProperty(typeof(System.Linq.Expressions.LabelTarget), "Target", value ?? string.Empty); value = ((LabelExpression)e).DefaultValue; XElementValues[3] = GenerateXmlFromProperty(typeof(System.Linq.Expressions.Expression), "DefaultValue", value ?? string.Empty); value = ((LabelExpression)e).CanReduce; XElementValues[4] = GenerateXmlFromProperty(typeof(System.Boolean), "CanReduce", value ?? string.Empty); return new XElement(xName, XElementValues); }//end static method
private static string VisitLabel(LabelExpression node) { throw new NotImplementedException(); }
protected override Expression VisitLabel(LabelExpression expression) { this.hashCode ^= expression.Target?.GetHashCode() ?? 0; return base.VisitLabel(expression); }