예제 #1
0
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            base.GetObjectData(info, context);
            info.AddArray("Arguments", Arguments);
            info.AddValue("Ctor", Constructor.ToSerializableForm());
            var memberNames = new string[Members.Length];

            for (int i = 0; i < memberNames.Length; i++)
            {
                memberNames[i] = Members[i].ToSerializableForm();
            }
            info.AddArray("Members", memberNames);
        }
예제 #2
0
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            CommonGetObjectData(options, info, context);

            info.AddValue("LanguageVersion", options.LanguageVersion, typeof(LanguageVersion));
            info.AddArray("PreprocessorSymbols", options.PreprocessorSymbols);
        }
 public override void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     base.GetObjectData(info, context);
     info.AddArray("Arguments", Arguments);
     info.AddValue("Method", Method.ToSerializableForm());
     info.AddValue("Object", Object);
 }
예제 #4
0
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            base.GetObjectData(info, context);

            //public readonly LanguageVersion LanguageVersion;
            info.AddValue("LanguageVersion", this.LanguageVersion, typeof(LanguageVersion));

            //internal readonly ImmutableArray<string> PreprocessorSymbols;
            info.AddArray("PreprocessorSymbols", this.PreprocessorSymbols);
        }
예제 #5
0
            public override void GetObjectData(Method method, SerializationInfo info)
            {
                if (mdDecoder.Equal(method, CurrentMethod))
                {
                    info.AddValue("Kind", MethodKind.CurrentMethod);
                }
                else
                {
                    IIndexable <Typ> methodTypeArguments;
                    Method           genericMethod;
                    if (mdDecoder.IsSpecialized(method, out genericMethod, out methodTypeArguments))
                    {
                        // I actually haven't encounter any specialized method different from the current method
                        info.AddValue("Kind", MethodKind.Specialized);
                        info.AddValue("GenericMethod", genericMethod);
                        info.AddArray("MethodTypeArguments", methodTypeArguments.Enumerate().ToArray());
                    }
                    else
                    {
                        info.AddValue("Kind", MethodKind.Path);
                        info.AddValue("Static", mdDecoder.IsStatic(method));
                        info.AddValue("FullName", mdDecoder.FullName(method));
                        info.AddValue("DeclaringType", mdDecoder.DeclaringType(method));

                        IIndexable <Typ> formals;

                        if (mdDecoder.IsGeneric(method, out formals))
                        {
                            info.AddValue("GenericArity", formals.Count);
                        }
                        else
                        {
                            info.AddValue("GenericArity", 0);
                        }
                    }
                }
            }
예제 #6
0
 public override void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     base.GetObjectData(info, context);
     info.AddValue("NewExpression", NewExpression);
     info.AddArray("Bindings", Bindings);
 }
 public override void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     base.GetObjectData(info, context);
     info.AddValue("Expression", Expression);
     info.AddArray("Arguments", Arguments);
 }
 public override void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     base.GetObjectData(info, context);
     info.AddValue("Body", Body);
     info.AddArray("Parameters", Parameters);
 }
예제 #9
0
            public override void GetObjectData(Typ type, SerializationInfo info)
            {
                Contract.Assume(type != null);
                // we need this because CCI2 uses a struct, so this function is always called, even for "(null)" (however it is not called for null when Typ is a class)
                // note: the Equals of CCI2 has been modified so that the test below makes sense for structs
                if (type.Equals(null))
                {
                    info.AddValue("Kind", TypeKind.Default);
                    return;
                }

                Typ _t;
                IIndexable <Pair <bool, Typ> > _ipbt;
                IIndexable <Typ> typeArguments;

                if (mdDecoder.IsModified(type, out _t, out _ipbt))
                {
                    throw new NotImplementedException();
                }
                else if (mdDecoder.IsVoid(type))
                {
                    info.AddValue("Kind", TypeKind.SystemVoid);
                }
                else if (mdDecoder.IsPrimitive(type))
                {
                    info.AddValue("Kind", TypeKind.Primitive);
                    info.AddValue("FullName", mdDecoder.FullName(type));
                }
                else if (mdDecoder.Equal(type, mdDecoder.System_Object))
                {
                    info.AddValue("Kind", TypeKind.SystemObject);
                }
                else if (mdDecoder.IsFormalTypeParameter(type))
                {
                    info.AddValue("Kind", TypeKind.FormalTypeParameter);
                    info.AddValue("Index", mdDecoder.NormalizedFormalTypeParameterIndex(type));
                    info.AddValue("Type", mdDecoder.FormalTypeParameterDefiningType(type));
                }
                else if (mdDecoder.IsMethodFormalTypeParameter(type))
                {
                    info.AddValue("Kind", TypeKind.MethodFormalTypeParameter);
                    info.AddValue("Index", mdDecoder.MethodFormalTypeParameterIndex(type));
                    info.AddValue("Method", mdDecoder.MethodFormalTypeDefiningMethod(type));
                }
                else if (mdDecoder.IsManagedPointer(type))
                {
                    info.AddValue("Kind", TypeKind.ManagedPointer);
                    info.AddValue("ElementType", mdDecoder.ElementType(type));
                }
                else if (mdDecoder.IsUnmanagedPointer(type))
                {
                    info.AddValue("Kind", TypeKind.UnmanagedPointer);
                    info.AddValue("ElementType", mdDecoder.ElementType(type));
                }
                else if (mdDecoder.IsArray(type))
                {
                    info.AddValue("Kind", TypeKind.Array);
                    info.AddValue("ElementType", mdDecoder.ElementType(type));
                    info.AddValue("Rank", mdDecoder.Rank(type));
                }
                else if (mdDecoder.NormalizedIsSpecialized(type, out typeArguments))
                {
                    // NormalizedIsSpecialized must return false if Unspecialized would return the same type
                    // otherwise we would have cycle and an exception would occur on deserialization
                    info.AddValue("Kind", TypeKind.Specialized);
                    info.AddValue("ElementType", mdDecoder.Unspecialized(type));
                    info.AddArray("TypeArguments", typeArguments.Enumerate().ToArray());
                }
                else
                {
                    // Not specialized
                    info.AddValue("Kind", TypeKind.Path);
                    Typ parentType;
                    if (mdDecoder.IsNested(type, out parentType))
                    {
                        info.AddValue("NestedIn", parentType);
                    }
                    else
                    {
                        info.AddValue("NestedIn", default(Typ)); // do not use null, won't work with CCI2
                        info.AddValue("Module", this.TranslateModuleName(mdDecoder.DeclaringModuleName(type)));
                        info.AddValue("Namespace", mdDecoder.Namespace(type));
                    }
                    info.AddValue("Name", mdDecoder.Name(type)); // since the type is not specialized, there is no generic parameter in the name

                    if (mdDecoder.IsGeneric(type, out typeArguments, false))
                    {
                        info.AddValue("GenericArity", typeArguments.Count);
                    }
                    else
                    {
                        info.AddValue("GenericArity", 0);
                    }
                }
            }
예제 #10
0
 public void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     info.AddValue("kind", kind, typeof(MetadataImageKind));
     info.AddArray("aliases", aliases);
     info.AddValue("embedInteropTypes", embedInteropTypes);
 }
예제 #11
0
 protected override void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     base.GetObjectData(info, context);
     info.AddArray("additionalLocations", additionalLocations);
 }
 public override void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     base.GetObjectData(info, context);
     info.AddArray("Initializers", Initializers);
 }
예제 #13
0
 public void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     info.AddValue("AddMethod", AddMethod.ToSerializableForm());
     info.AddArray("Arguments", Arguments);
 }