Пример #1
0
 public GotoExpression(GotoExpressionKind kind, LabelTarget target, TypeInfo type, Expression value)
 {
     Kind   = kind;
     Target = target;
     Type   = type;
     Value  = value;
 }
Пример #2
0
 internal GotoExpression(GotoExpressionKind kind, LabelTarget target, Expression value, Type type)
 {
     Kind   = kind;
     Value  = value;
     Target = target;
     Type   = type;
 }
Пример #3
0
 internal GotoExpressionSlim(GotoExpressionKind kind, LabelTargetSlim target, ExpressionSlim value, TypeSlim type)
 {
     Kind   = kind;
     Value  = value;
     Target = target;
     Type   = type;
 }
Пример #4
0
 public GotoExpression(GotoExpressionKind kind, LabelTarget target, TypeInfo?type, Expression?value)
 {
     Kind   = kind;
     Target = target.CheckNotNull(nameof(target));
     Type   = type;
     Value  = value;
 }
Пример #5
0
 internal GotoExpression(GotoExpressionKind kind, LabelTarget target, Expression value, Type type)
 {
     _kind = kind;
     _value = value;
     _target = target;
     _type = type;
 }
Пример #6
0
        public Expression Update(GotoExpressionKind kind, LabelTarget target, Expression value) {
            if (Target.Equals(target) && ReferenceEquals(Value, value) && Kind == kind) {
                return this;
            }

            return AstExpression.Return(_returnStatement, ParentScope, Visitor);
        }
Пример #7
0
 internal GotoExpression(GotoExpressionKind kind, LabelTarget target, XzaarExpression value, XzaarType type)
 {
     this.kind   = kind;
     this.value  = value;
     this.target = target;
     this.type   = type;
 }
 internal GotoExpression(GotoExpressionKind kind, LabelTarget target, Expression value, System.Type type)
 {
     this._kind   = kind;
     this._value  = value;
     this._target = target;
     this._type   = type;
 }
Пример #9
0
 public SerializableGotoExpression(GotoExpression expression, SerializableExpressionConverter converter)
     : base(expression)
 {
     Kind       = expression.Kind;
     TargetName = expression.Target.Name;
     TargetType = expression.Target.Type;
     Value      = converter.Convert(expression.Value);
 }
Пример #10
0
        public Expression Update(GotoExpressionKind kind, LabelTarget target, Expression value)
        {
            if (Target.Equals(target) && ReferenceEquals(Value, value) && Kind == kind)
            {
                return(this);
            }

            return(AstExpression.Return(_returnStatement, ParentScope, Visitor));
        }
Пример #11
0
 public static void TypeContainsGenericParameters(GotoExpressionKind kind)
 {
     Assert.Throws <ArgumentException>(
         "type", () => Expression.MakeGoto(kind, Expression.Label(typeof(void)), null, typeof(List <> .Enumerator)));
     Assert.Throws <ArgumentException>(
         "type",
         () =>
         Expression.MakeGoto(
             kind, Expression.Label(typeof(void)), null, typeof(List <>).MakeGenericType(typeof(List <>))));
 }
Пример #12
0
 public static void TypeContainsGenericParameters(GotoExpressionKind kind)
 {
     Assert.Throws<ArgumentException>(
         "type", () => Expression.MakeGoto(kind, Expression.Label(typeof(void)), null, typeof(List<>.Enumerator)));
     Assert.Throws<ArgumentException>(
         "type",
         () =>
             Expression.MakeGoto(
                 kind, Expression.Label(typeof(void)), null, typeof(List<>).MakeGenericType(typeof(List<>))));
 }
Пример #13
0
        public static GotoExpression MakeGoto(GotoExpressionKind kind, LabelTarget?target, Expression?value, Type type)
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

            ValidateGoto(target, ref value, nameof(value), type);

            return(new GotoExpression(kind, target, value, type));
        }
        public SerializableGotoExpression(GotoExpression expression, SerializableExpressionConverter converter)
            : base(expression)
        {
            Contract.Requires(expression != null);
            Contract.Requires(converter != null);

            Kind       = expression.Kind;
            TargetName = expression.Target.Name;
            TargetType = expression.Target.Type;
            Value      = converter.TryConvert(expression.Value);
        }
Пример #15
0
 public static void Deconstruct(
     this GotoExpression expr,
     out ExpressionType operation,
     out GotoExpressionKind kind,
     out LabelTarget target)
 {
     kind = expr?.Kind
            ?? throw new ArgumentNullException(nameof(expr));
     operation = expr.NodeType;
     target    = expr.Target;
 }
 public ParsedGotoExpression(
     GotoExpressionKind kind,
     ParsedLabelTarget target,
     ParsedType type,
     ParsedExpression value)
     : base()
 {
     this.Kind   = kind;
     this.Target = target;
     this.Type   = type;
     this.Value  = value;
 }
Пример #17
0
 private void Append(GotoExpressionKind kind) => _sb.Append(s_gotoExpressionKindToString[(int)kind]);
Пример #18
0
 public GotoExpression(GotoExpressionKind kind, LabelTarget target, Type?type, Expression?value)
     : this(kind, target, type.AsTypeInfo(), value)
 {
 }
Пример #19
0
 /// <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);
 }
Пример #20
0
 public void ByRefType(GotoExpressionKind kind)
 {
     Assert.Throws <ArgumentException>(
         "type",
         () => Expression.MakeGoto(kind, Expression.Label(typeof(void)), null, typeof(int).MakeByRefType()));
 }
Пример #21
0
 public void OpenGenericType(GotoExpressionKind kind)
 {
     Assert.Throws<ArgumentException>(
         "type", () => Expression.MakeGoto(kind, Expression.Label(typeof(void)), null, typeof(List<>)));
 }
Пример #22
0
 public void OpenGenericType(GotoExpressionKind kind)
 {
     Assert.Throws <ArgumentException>(
         "type", () => Expression.MakeGoto(kind, Expression.Label(typeof(void)), null, typeof(List <>)));
 }
Пример #23
0
 public static GotoExpression MakeGoto(GotoExpressionKind kind, LabelTarget target, Expression value, Type type = null) =>
 new GotoExpression(kind, target, value, type ?? typeof(void));
Пример #24
0
 /// <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">A <see cref="System.Type" /> to set the <see cref="Type" /> property equal to.</param>
 /// <returns>
 ///     A <see cref="GotoExpression" /> with <see cref="GotoExpression.Kind" /> equal to <paramref name="kind" />,
 ///     the <see cref="GotoExpression.Target" /> property set to <paramref name="target" />,
 ///     the <see cref="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, nameof(target), nameof(value), type);
     return(new GotoExpression(kind, target, value, type));
 }
Пример #25
0
 public static GotoExpression MakeGoto(GotoExpressionKind kind, LabelTarget target, XzaarExpression value, XzaarType type)
 {
     ValidateGoto(target, ref value, "target", "value");
     return(new GotoExpression(kind, target, value, type));
 }
Пример #26
0
 internal GotoExpression(GotoExpressionKind kind, LabelTarget target, Expression value)
 {
     _kind   = kind;
     _value  = value;
     _target = target;
 }
Пример #27
0
 public GotoExpression(GotoExpressionKind kind, LabelTarget target, Type type, Expression value)
     : this(kind, target, ReferenceEquals(null, type) ? null : new TypeInfo(type, false, false), value)
 {
 }
Пример #28
0
 public void ByRefType(GotoExpressionKind kind)
 {
     Assert.Throws<ArgumentException>(
         "type",
         () => Expression.MakeGoto(kind, Expression.Label(typeof(void)), null, typeof(int).MakeByRefType()));
 }
Пример #29
0
 public GotoExpression(GotoExpressionKind kind, LabelTarget target, Type type, Expression value)
     : this(kind, target, type is null ? null : new TypeInfo(type, false, false), value)
 {
 }
 private static int CalcHashCode(GotoExpressionKind kind)
 {
     return((int)kind);
 }