internal static Identifier Identifier(IdentifierExpression expression) { return(new Identifier() { Name = expression.Name, }.Apply(n => n.TypeHint = expression.TryType().Null(t => TypeRef.Serialize(t)))); }
internal static Serialized Serialized(SerializedExpression expression) { return(new Serialized() { Node = expression.Node, }.Apply(n => n.Type = TypeRef.Serialize(expression.Type))); }
internal static Quote Quote(UnaryExpression expression) { return(new Quote() { Operand = Serialize(expression.Operand), }.Apply(n => n.Type = TypeRef.Serialize(expression.Type))); }
internal static ClearDebugInfo ClearDebugInfo(DebugInfoExpression expression) { return(new ClearDebugInfo() { Document = SymbolDocumentInfo.Serialize(expression.Document), }.Apply(n => n.Type = TypeRef.Serialize(expression.Type))); }
internal static Quasiquoted Quasiquoted(QuotedExpression expression) { return(new Quasiquoted() { Expression = Serialize(expression.Expression), }.Apply(n => n.TypeHint = expression.TryType().Null(t => TypeRef.Serialize(t)))); }
internal static Number Number(NumberExpression expression) { return(new Number() { SourceText = expression.SourceText, }.Apply(n => n.TypeHint = expression.TryType().Null(t => TypeRef.Serialize(t)))); }
internal static Vector Vector(VectorExpression expression) { return(new Vector() { Elements = expression.Elements.Select(Serialize).ToArray(), }.Apply(n => n.TypeHint = expression.TryType().Null(t => TypeRef.Serialize(t)))); }
internal static RuntimeVariables RuntimeVariables(RuntimeVariablesExpression expression) { return(new RuntimeVariables() { Variables = expression.Variables.Select(Parameter).ToArray(), }.Apply(n => n.Type = TypeRef.Serialize(expression.Type))); }
internal static ArrayLength ArrayLength(UnaryExpression expression) { return(new ArrayLength() { Operand = Serialize(expression.Operand), }.Apply(n => n.Type = TypeRef.Serialize(expression.Type))); }
internal static LambdaList LambdaList(LambdaListExpression expression) { return(new LambdaList() { Elements = expression.Elements.Select(Serialize).ToArray(), }.Apply(n => n.TypeHint = expression.TryType().Null(t => TypeRef.Serialize(t)))); }
internal static Contextful Contextful(ContextfulExpression expression) { return(new Contextful() { Expression = Serialize(expression.Expression), ContextType = expression.ContextType, }.Apply(n => n.TypeHint = expression.TryType().Null(t => TypeRef.Serialize(t)))); }
internal static TypeEqual TypeEqual(TypeBinaryExpression expression) { return(new TypeEqual() { Expression = Serialize(expression.Expression), TypeOperand = TypeRef.Serialize(expression.TypeOperand), }.Apply(n => n.Type = TypeRef.Serialize(expression.Type))); }
internal static MemberAccess MemberAccess(MemberExpression expression) { return(new MemberAccess() { Expression = expression.Expression.Null(e => Serialize(e)), Member = MemberRef.Serialize(expression.Member), }.Apply(n => n.Type = TypeRef.Serialize(expression.Type))); }
internal static Invoke Invoke(InvocationExpression expression) { return(new Invoke() { Expression = Serialize(expression.Expression), Arguments = expression.Arguments.Select(Serialize).ToArray(), }.Apply(n => n.Type = TypeRef.Serialize(expression.Type))); }
internal static TypeAs TypeAs(UnaryExpression expression) { return(new TypeAs() { Operand = Serialize(expression.Operand), Type = TypeRef.Serialize(expression.Type), }); }
internal static Increment Increment(UnaryExpression expression) { return(new Increment() { Operand = Serialize(expression.Operand), Method = expression.Method.Null(m => MethodRef.Serialize(m)), }.Apply(n => n.Type = TypeRef.Serialize(expression.Type))); }
internal static ListInit ListInit(ListInitExpression expression) { return(new ListInit() { NewExpression = New(expression.NewExpression), Initializers = expression.Initializers.Select(ElementInit.Serialize).ToArray(), }.Apply(n => n.Type = TypeRef.Serialize(expression.Type))); }
/// <summary> /// Returns the property reference which refers specified property. /// </summary> /// <param name="property">The property to refer.</param> /// <returns>The property reference which refers specified property.</returns> public static PropertyRef Serialize(PropertyInfo property) { return(_reverseCache.GetValue(property) ?? new PropertyRef( TypeRef.Serialize(property.ReflectedType), property.Name ).Apply(p => _reverseCache.Add(property, p))); }
internal static DynamicConvert DynamicConvert(DynamicExpression expression) { return(new DynamicConvert() { Type = TypeRef.Serialize(expression.Type), Arguments = expression.Arguments.Select(Serialize).ToArray(), }); }
internal static Assign Assign(BinaryExpression expression) { return(new Assign() { Left = Serialize(expression.Left), Right = Serialize(expression.Right) }.Apply(n => n.Type = TypeRef.Serialize(expression.Type))); }
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))); }
internal static Text Text(TextExpression expression) { return(new Text() { QuoteChar = expression.QuoteChar, SourceText = expression.SourceText, }.Apply(n => n.TypeHint = expression.TryType().Null(t => TypeRef.Serialize(t)))); }
internal static Unbox Unbox(UnaryExpression expression) { return(new Unbox() { Operand = Serialize(expression.Operand), Type = TypeRef.Serialize(expression.Type), }); }
internal static AmbiguousParameter AmbiguousParameter(AmbiguousParameterExpression expression) { return(new AmbiguousParameter() { Type = expression.Type().Null(t => TypeRef.Serialize(t)), Name = expression.Name, }); }
internal static ReferenceEqual ReferenceEqual(BinaryExpression expression) { return(new ReferenceEqual() { Left = Serialize(expression.Left), Right = Serialize(expression.Right), }.Apply(n => n.Type = TypeRef.Serialize(expression.Type))); }
/// <summary> /// Returns the field reference which refers specified field. /// </summary> /// <param name="field">The field to refer.</param> /// <returns>The field reference which refers specified field.</returns> public static FieldRef Serialize(FieldInfo field) { return(_reverseCache.GetValue(field) ?? new FieldRef( TypeRef.Serialize(field.ReflectedType), field.Name ).Apply(f => _reverseCache.Add(field, f))); }
internal static MemberInit MemberInit(MemberInitExpression expression) { return(new MemberInit() { NewExpression = New(expression.NewExpression), Bindings = expression.Bindings.Select(MemberBinding.Serialize).ToArray(), }.Apply(n => n.Type = TypeRef.Serialize(expression.Type))); }
internal static ArrayIndex ArrayIndex(BinaryExpression expression) { return(new ArrayIndex() { Array = Serialize(expression.Left), Index = Serialize(expression.Right), }.Apply(n => n.Type = TypeRef.Serialize(expression.Type))); }
internal static NegateChecked NegateChecked(UnaryExpression expression) { return(new NegateChecked() { Operand = Serialize(expression.Operand), Method = expression.Method.Null(m => MethodRef.Serialize(m)), }.Apply(n => n.Type = TypeRef.Serialize(expression.Type))); }
/// <summary> /// Returns the event reference which refers specified event. /// </summary> /// <param name="event">The event to refer.</param> /// <returns>The event reference which refers specified event.</returns> public static EventRef Serialize(EventInfo @event) { return(_reverseCache.GetValue(@event) ?? new EventRef( TypeRef.Serialize(@event.ReflectedType), @event.Name ).Apply(e => _reverseCache.Add(@event, e))); }