Serialize() public static method

Returns the type reference which refers specified type.
public static Serialize ( Type type ) : TypeRef
type System.Type The type to refer.
return TypeRef
Beispiel #1
0
 internal static Identifier Identifier(IdentifierExpression expression)
 {
     return(new Identifier()
     {
         Name = expression.Name,
     }.Apply(n => n.TypeHint = expression.TryType().Null(t => TypeRef.Serialize(t))));
 }
Beispiel #2
0
 internal static Serialized Serialized(SerializedExpression expression)
 {
     return(new Serialized()
     {
         Node = expression.Node,
     }.Apply(n => n.Type = TypeRef.Serialize(expression.Type)));
 }
Beispiel #3
0
 internal static Quote Quote(UnaryExpression expression)
 {
     return(new Quote()
     {
         Operand = Serialize(expression.Operand),
     }.Apply(n => n.Type = TypeRef.Serialize(expression.Type)));
 }
Beispiel #4
0
 internal static ClearDebugInfo ClearDebugInfo(DebugInfoExpression expression)
 {
     return(new ClearDebugInfo()
     {
         Document = SymbolDocumentInfo.Serialize(expression.Document),
     }.Apply(n => n.Type = TypeRef.Serialize(expression.Type)));
 }
Beispiel #5
0
 internal static Quasiquoted Quasiquoted(QuotedExpression expression)
 {
     return(new Quasiquoted()
     {
         Expression = Serialize(expression.Expression),
     }.Apply(n => n.TypeHint = expression.TryType().Null(t => TypeRef.Serialize(t))));
 }
Beispiel #6
0
 internal static Number Number(NumberExpression expression)
 {
     return(new Number()
     {
         SourceText = expression.SourceText,
     }.Apply(n => n.TypeHint = expression.TryType().Null(t => TypeRef.Serialize(t))));
 }
Beispiel #7
0
 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))));
 }
Beispiel #8
0
 internal static RuntimeVariables RuntimeVariables(RuntimeVariablesExpression expression)
 {
     return(new RuntimeVariables()
     {
         Variables = expression.Variables.Select(Parameter).ToArray(),
     }.Apply(n => n.Type = TypeRef.Serialize(expression.Type)));
 }
Beispiel #9
0
 internal static ArrayLength ArrayLength(UnaryExpression expression)
 {
     return(new ArrayLength()
     {
         Operand = Serialize(expression.Operand),
     }.Apply(n => n.Type = TypeRef.Serialize(expression.Type)));
 }
Beispiel #10
0
 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))));
 }
Beispiel #11
0
 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))));
 }
Beispiel #12
0
 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)));
 }
Beispiel #13
0
 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)));
 }
Beispiel #14
0
 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)));
 }
Beispiel #15
0
 internal static TypeAs TypeAs(UnaryExpression expression)
 {
     return(new TypeAs()
     {
         Operand = Serialize(expression.Operand),
         Type = TypeRef.Serialize(expression.Type),
     });
 }
Beispiel #16
0
 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)));
 }
Beispiel #17
0
 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)));
 }
Beispiel #18
0
 /// <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)));
 }
Beispiel #19
0
 internal static DynamicConvert DynamicConvert(DynamicExpression expression)
 {
     return(new DynamicConvert()
     {
         Type = TypeRef.Serialize(expression.Type),
         Arguments = expression.Arguments.Select(Serialize).ToArray(),
     });
 }
Beispiel #20
0
 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)));
 }
Beispiel #21
0
 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)));
 }
Beispiel #22
0
 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))));
 }
Beispiel #23
0
 internal static Unbox Unbox(UnaryExpression expression)
 {
     return(new Unbox()
     {
         Operand = Serialize(expression.Operand),
         Type = TypeRef.Serialize(expression.Type),
     });
 }
Beispiel #24
0
 internal static AmbiguousParameter AmbiguousParameter(AmbiguousParameterExpression expression)
 {
     return(new AmbiguousParameter()
     {
         Type = expression.Type().Null(t => TypeRef.Serialize(t)),
         Name = expression.Name,
     });
 }
Beispiel #25
0
 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)));
 }
Beispiel #26
0
 /// <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)));
 }
Beispiel #27
0
 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)));
 }
Beispiel #28
0
 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)));
 }
Beispiel #29
0
 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)));
 }
Beispiel #30
0
 /// <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)));
 }