2 writes to _ilg
dotnet-svcutil-lib (2)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlFormatWriterGenerator.cs (2)
82
_ilg
= new CodeGenerator();
106
_ilg
= new CodeGenerator();
159 references to _ilg
dotnet-svcutil-lib (159)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlFormatWriterGenerator.cs (159)
86
_ilg
.BeginMethod("Write" + classContract.StableName.Name + "ToXml", Globals.TypeOfXmlFormatClassWriterDelegate, memberAccessFlag);
101
return (XmlFormatClassWriterDelegate)
_ilg
.EndMethod();
110
_ilg
.BeginMethod("Write" + collectionContract.StableName.Name + "ToXml", Globals.TypeOfXmlFormatCollectionWriterDelegate, memberAccessFlag);
125
return (XmlFormatCollectionWriterDelegate)
_ilg
.EndMethod();
130
_xmlWriterArg =
_ilg
.GetArg(0);
131
_contextArg =
_ilg
.GetArg(2);
132
_dataContractArg =
_ilg
.GetArg(3);
134
_objectLocal =
_ilg
.DeclareLocal(objType, "objSerialized");
135
ArgBuilder objectArg =
_ilg
.GetArg(1);
136
_ilg
.Load(objectArg);
144
_ilg
.ConvertValue(objectArg.ArgType, Globals.TypeOfDateTimeOffset);
145
_ilg
.Call(XmlFormatGeneratorStatics.GetDateTimeOffsetAdapterMethod);
151
_ilg
.ConvertValue(objectArg.ArgType, Globals.TypeOfKeyValuePair.MakeGenericType(dc.KeyValuePairGenericArguments));
152
_ilg
.New(dc.KeyValuePairAdapterConstructorInfo);
156
_ilg
.ConvertValue(objectArg.ArgType, objType);
158
_ilg
.Stloc(_objectLocal);
168
_ilg
.LoadAddress(_objectLocal);
169
_ilg
.Load(_contextArg);
170
_ilg
.Call(XmlFormatGeneratorStatics.GetStreamingContextMethod);
171
_ilg
.Call(classContract.OnSerializing);
181
_ilg
.LoadAddress(_objectLocal);
182
_ilg
.Load(_contextArg);
183
_ilg
.Call(XmlFormatGeneratorStatics.GetStreamingContextMethod);
184
_ilg
.Call(classContract.OnSerialized);
195
_contractNamespacesLocal =
_ilg
.DeclareLocal(typeof(XmlDictionaryString[]), "contractNamespaces");
196
_ilg
.Load(_dataContractArg);
197
_ilg
.LoadMember(XmlFormatGeneratorStatics.ContractNamespacesField);
198
_ilg
.Store(_contractNamespacesLocal);
201
_memberNamesLocal =
_ilg
.DeclareLocal(typeof(XmlDictionaryString[]), "memberNames");
202
_ilg
.Load(_dataContractArg);
203
_ilg
.LoadMember(XmlFormatGeneratorStatics.MemberNamesField);
204
_ilg
.Store(_memberNamesLocal);
210
_childElementNamespacesLocal =
_ilg
.DeclareLocal(typeof(XmlDictionaryString[]), "childElementNamespaces");
211
_ilg
.Load(_dataContractArg);
212
_ilg
.LoadMember(XmlFormatGeneratorStatics.ChildElementNamespacesProperty);
213
_ilg
.Store(_childElementNamespacesLocal);
227
LocalBuilder namespaceLocal =
_ilg
.DeclareLocal(typeof(XmlDictionaryString), "ns");
230
_ilg
.Load(_dataContractArg);
231
_ilg
.LoadMember(XmlFormatGeneratorStatics.NamespaceProperty);
234
_ilg
.LoadArrayElement(_contractNamespacesLocal, _typeIndex - 1);
235
_ilg
.Store(namespaceLocal);
237
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, classContract.Members.Count);
246
_ilg
.Load(_contextArg);
247
_ilg
.Call(XmlFormatGeneratorStatics.StoreIsGetOnlyCollectionMethod);
252
_ilg
.IfNotDefaultValue(memberValue);
260
_ilg
.Load(_xmlWriterArg);
261
_ilg
.LoadArrayElement(_childElementNamespacesLocal, i + _childElementIndex);
262
_ilg
.Call(XmlFormatGeneratorStatics.WriteNamespaceDeclMethod);
273
_ilg
.Else();
274
_ilg
.Call(null, XmlFormatGeneratorStatics.ThrowRequiredMemberMustBeEmittedMethod, member.Name, classContract.UnderlyingType);
276
_ilg
.EndIf();
287
_ilg
.LoadAddress(_objectLocal);
288
_ilg
.LoadMember(member.MemberInfo);
289
LocalBuilder memberValue =
_ilg
.DeclareLocal(member.MemberType, member.Name + "Value");
290
_ilg
.Stloc(memberValue);
296
LocalBuilder itemNamespace =
_ilg
.DeclareLocal(typeof(XmlDictionaryString), "itemNamespace");
297
_ilg
.Load(_dataContractArg);
298
_ilg
.LoadMember(XmlFormatGeneratorStatics.NamespaceProperty);
299
_ilg
.Store(itemNamespace);
301
LocalBuilder itemName =
_ilg
.DeclareLocal(typeof(XmlDictionaryString), "itemName");
302
_ilg
.Load(_dataContractArg);
303
_ilg
.LoadMember(XmlFormatGeneratorStatics.CollectionItemNameProperty);
304
_ilg
.Store(itemName);
308
_ilg
.Load(_xmlWriterArg);
309
_ilg
.Load(_dataContractArg);
310
_ilg
.LoadMember(XmlFormatGeneratorStatics.ChildElementNamespaceProperty);
311
_ilg
.Call(XmlFormatGeneratorStatics.WriteNamespaceDeclMethod);
317
LocalBuilder i =
_ilg
.DeclareLocal(Globals.TypeOfInt, "i");
319
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.IncrementArrayCountMethod, _xmlWriterArg, _objectLocal);
323
_ilg
.For(i, 0, _objectLocal);
327
_ilg
.LoadArrayElement(_objectLocal, i);
328
LocalBuilder memberValue =
_ilg
.DeclareLocal(itemType, "memberValue");
329
_ilg
.Stloc(memberValue);
333
_ilg
.EndFor();
356
_ilg
.Call(_contextArg, incrementCollectionCountMethod, _xmlWriterArg, _objectLocal);
414
LocalBuilder currentValue =
_ilg
.DeclareLocal(elementType, "currentValue");
416
LocalBuilder enumerator =
_ilg
.DeclareLocal(enumeratorType, "enumerator");
417
_ilg
.Call(_objectLocal, collectionContract.GetEnumeratorMethod);
420
_ilg
.ConvertValue(collectionContract.GetEnumeratorMethod.ReturnType, Globals.TypeOfIDictionaryEnumerator);
421
_ilg
.New(XmlFormatGeneratorStatics.DictionaryEnumeratorCtor);
427
_ilg
.ConvertValue(collectionContract.GetEnumeratorMethod.ReturnType, ctorParam);
428
_ilg
.New(dictEnumCtor);
430
_ilg
.Stloc(enumerator);
432
_ilg
.ForEach(currentValue, elementType, enumeratorType, enumerator, getCurrentMethod);
435
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, 1);
443
_ilg
.Call(_dataContractArg, XmlFormatGeneratorStatics.GetItemContractMethod);
444
_ilg
.Load(_xmlWriterArg);
445
_ilg
.Load(currentValue);
446
_ilg
.ConvertValue(currentValue.LocalType, Globals.TypeOfObject);
447
_ilg
.Load(_contextArg);
448
_ilg
.Call(XmlFormatGeneratorStatics.WriteXmlValueMethod);
456
_ilg
.EndForEach(moveNextMethod);
469
_ilg
.Load(_xmlWriterArg);
473
_ilg
.Load(_contextArg);
474
_ilg
.Load(_xmlWriterArg);
479
_ilg
.Load(value);
483
_ilg
.LoadAddress(_objectLocal);
484
_ilg
.LoadMember(memberInfo);
488
_ilg
.LoadArrayElement(_objectLocal, arrayItemIndex);
493
_ilg
.Load(name);
497
_ilg
.LoadArrayElement(_memberNamesLocal, nameIndex);
500
_ilg
.Load(ns);
502
_ilg
.Call(primitiveContract.XmlFormatWriterMethod);
541
_ilg
.Load(_xmlWriterArg);
542
_ilg
.Load(value);
543
_ilg
.Load(itemName);
544
_ilg
.Load(itemNamespace);
545
_ilg
.Call(typeof(XmlWriterDelegator).GetMethod(writeArrayMethod, Globals.ScanAllMembers, new Type[] { type, typeof(XmlDictionaryString), typeof(XmlDictionaryString) }));
560
_ilg
.Call(_xmlWriterArg, primitiveContract.XmlFormatContentWriterMethod, memberValue);
573
_ilg
.Load(memberValue);
574
_ilg
.Load(null);
575
_ilg
.Ceq();
577
_ilg
.If();
578
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.WriteNullMethod, _xmlWriterArg, memberType, DataContract.IsTypeSerializable(memberType));
579
_ilg
.Else();
585
_ilg
.Call(_xmlWriterArg, primitiveContract.XmlFormatContentWriterMethod, memberValue);
589
_ilg
.Call(_contextArg, primitiveContract.XmlFormatContentWriterMethod, _xmlWriterArg, memberValue);
598
_ilg
.Load(memberValue);
599
_ilg
.ConvertValue(memberValue.LocalType, Globals.TypeOfObject);
600
memberValue =
_ilg
.DeclareLocal(Globals.TypeOfObject, "unwrappedMemberValue");
602
_ilg
.Stloc(memberValue);
603
_ilg
.If(memberValue, Cmp.EqualTo, null);
604
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.WriteNullMethod, _xmlWriterArg, memberType, DataContract.IsTypeSerializable(memberType));
605
_ilg
.Else();
611
_ilg
.EndIf();
613
_ilg
.EndIf();
619
_ilg
.Load(_contextArg);
620
_ilg
.Load(_xmlWriterArg);
621
_ilg
.Load(memberValue);
622
_ilg
.ConvertValue(memberValue.LocalType, Globals.TypeOfObject);
626
_ilg
.Call(null, XmlFormatGeneratorStatics.IsMemberTypeSameAsMemberValue, memberValue, memberType);
627
_ilg
.Load(writeXsiType);
628
_ilg
.Load(DataContract.GetId(memberType.TypeHandle));
629
_ilg
.Ldtoken(memberType);
630
_ilg
.Call(methodInfo);
637
Label onNull =
_ilg
.DefineLabel();
638
Label end =
_ilg
.DefineLabel();
639
_ilg
.Load(memberValue);
643
_ilg
.Dup();
644
_ilg
.Call(XmlFormatGeneratorStatics.GetHasValueMethod.MakeGenericMethod(innerType));
645
_ilg
.Brfalse(onNull);
646
_ilg
.Call(XmlFormatGeneratorStatics.GetNullableValueMethod.MakeGenericMethod(innerType));
649
memberValue =
_ilg
.DeclareLocal(memberType, "nullableUnwrappedMemberValue");
650
_ilg
.Stloc(memberValue);
651
_ilg
.Load(false); //isNull
652
_ilg
.Br(end);
653
_ilg
.MarkLabel(onNull);
654
_ilg
.Pop();
655
_ilg
.Call(XmlFormatGeneratorStatics.GetDefaultValueMethod.MakeGenericMethod(memberType));
656
_ilg
.Stloc(memberValue);
657
_ilg
.Load(true);//isNull
658
_ilg
.MarkLabel(end);
670
_ilg
.Load(_xmlWriterArg);
673
_ilg
.Load(Globals.ElementPrefix);
677
_ilg
.LoadArrayElement(_memberNamesLocal, nameIndex);
679
_ilg
.Load(nameLocal);
682
_ilg
.Load(namespaceLocal);
684
_ilg
.Call(needsPrefix ? XmlFormatGeneratorStatics.WriteStartElementMethod3 : XmlFormatGeneratorStatics.WriteStartElementMethod2);
689
_ilg
.Call(_xmlWriterArg, XmlFormatGeneratorStatics.WriteEndElementMethod);