private void DumpLabel(LabelTarget target) { Out(string.Format(CultureInfo.CurrentCulture, ".LabelTarget {0}:", GetLabelTargetName(target))); }
/// <summary> /// Creates a <see cref="GotoExpression"/> representing a jump of the specified <see cref="GotoExpressionKind"/>. /// The value passed to the label upon jumping can also be specified. /// </summary> /// <param name="kind">The <see cref="GotoExpressionKind"/> of the <see cref="GotoExpression"/>.</param> /// <param name="target">The <see cref="LabelTarget"/> that the <see cref="GotoExpression"/> will jump to.</param> /// <param name="value">The value that will be passed to the associated label upon jumping.</param> /// <param name="type">An <see cref="System.Type"/> to set the <see cref="P:Expression.Type"/> property equal to.</param> /// <returns> /// A <see cref="GotoExpression"/> with <see cref="P:GotoExpression.Kind"/> equal to <paramref name="kind"/>, /// the <see cref="P:GotoExpression.Target"/> property set to <paramref name="target"/>, /// the <see cref="P:Expression.Type"/> property set to <paramref name="type"/>, /// and <paramref name="value"/> to be passed to the target label upon jumping. /// </returns> public static GotoExpression MakeGoto(GotoExpressionKind kind, LabelTarget target, Expression value, Type type) { ValidateGoto(target, ref value, "target", "value"); return(new GotoExpression(kind, target, value, type)); }
private int GetLabelTargetId(LabelTarget target) { Debug.Assert(string.IsNullOrEmpty(target.Name)); return(GetId(target, ref _labelIds)); }
/// <summary> /// Creates a <see cref="GotoExpression"/> representing a goto with the specified type. /// The value passed to the label upon jumping can be specified. /// </summary> /// <param name="target">The <see cref="LabelTarget"/> that the <see cref="GotoExpression"/> will jump to.</param> /// <param name="value">The value that will be passed to the associated label upon jumping.</param> /// <param name="type">An <see cref="System.Type"/> to set the <see cref="P:Expression.Type"/> property equal to.</param> /// <returns> /// A <see cref="GotoExpression"/> with <see cref="P:GotoExpression.Kind"/> equal to Goto, /// the <see cref="P:GotoExpression.Target"/> property set to <paramref name="target"/>, /// the <see cref="P:Expression.Type"/> property set to <paramref name="type"/>, /// and <paramref name="value"/> to be passed to the target label upon jumping. /// </returns> public static GotoExpression Goto(LabelTarget target, Expression value, Type type) { return(MakeGoto(GotoExpressionKind.Goto, target, value, type)); }
/// <summary> /// Creates a <see cref="GotoExpression"/> representing a goto. /// </summary> /// <param name="target">The <see cref="LabelTarget"/> that the <see cref="GotoExpression"/> will jump to.</param> /// <returns> /// A <see cref="GotoExpression"/> with <see cref="P:GotoExpression.Kind"/> equal to Goto, /// the <see cref="P:GotoExpression.Target"/> property set to the specified value, /// and a null value to be passed to the target label upon jumping. /// </returns> public static GotoExpression Goto(LabelTarget target) { return(MakeGoto(GotoExpressionKind.Goto, target, null, typeof(void))); }
/// <summary> /// Creates a <see cref="GotoExpression"/> representing a return statement. The value passed to the label upon jumping can be specified. /// </summary> /// <param name="target">The <see cref="LabelTarget"/> that the <see cref="GotoExpression"/> will jump to.</param> /// <param name="value">The value that will be passed to the associated label upon jumping.</param> /// <returns> /// A <see cref="GotoExpression"/> with <see cref="P:GotoExpression.Kind"/> equal to Continue, /// the <see cref="P:GotoExpression.Target"/> property set to <paramref name="target"/>, /// and <paramref name="value"/> to be passed to the target label upon jumping. /// </returns> public static GotoExpression Return(LabelTarget target, Expression value) { return(MakeGoto(GotoExpressionKind.Return, target, value, typeof(void))); }
/// <summary> /// Creates a <see cref="GotoExpression"/> representing a return statement with the specified type. /// </summary> /// <param name="target">The <see cref="LabelTarget"/> that the <see cref="GotoExpression"/> will jump to.</param> /// <param name="type">An <see cref="System.Type"/> to set the <see cref="P:Expression.Type"/> property equal to.</param> /// <returns> /// A <see cref="GotoExpression"/> with <see cref="P:GotoExpression.Kind"/> equal to Return, /// the <see cref="P:GotoExpression.Target"/> property set to <paramref name="target"/>, /// the <see cref="P:Expression.Type"/> property set to <paramref name="type"/>, /// and a null value to be passed to the target label upon jumping. /// </returns> public static GotoExpression Return(LabelTarget target, Type type) { return(MakeGoto(GotoExpressionKind.Return, target, null, type)); }
/// <summary> /// Creates a <see cref="GotoExpression"/> representing a continue statement with the specified type. /// </summary> /// <param name="target">The <see cref="LabelTarget"/> that the <see cref="GotoExpression"/> will jump to.</param> /// <param name="type">An <see cref="System.Type"/> to set the <see cref="P:Expression.Type"/> property equal to.</param> /// <returns> /// A <see cref="GotoExpression"/> with <see cref="P:GotoExpression.Kind"/> equal to Continue, /// the <see cref="P:GotoExpression.Target"/> property set to <paramref name="target"/>, /// the <see cref="P:Expression.Type"/> property set to <paramref name="type"/>, /// and a null value to be passed to the target label upon jumping. /// </returns> public static GotoExpression Continue(LabelTarget target, Type type) { return(MakeGoto(GotoExpressionKind.Continue, target, null, type)); }