4 writes to _ilg
dotnet-svcutil-lib (4)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlFormatReaderGenerator.cs (4)
91
_ilg
= new CodeGenerator();
147
_ilg
= GenerateCollectionReaderHelper(collectionContract, false /*isGetOnlyCollection*/);
156
_ilg
= GenerateCollectionReaderHelper(collectionContract, true /*isGetOnlyCollection*/);
163
_ilg
= new CodeGenerator();
240 references to _ilg
dotnet-svcutil-lib (240)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlFormatReaderGenerator.cs (240)
95
_ilg
.BeginMethod("Read" + classContract.StableName.Name + "FromXml", Globals.TypeOfXmlFormatClassReaderDelegate, memberAccessFlag);
111
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectMethod, _objectLocal);
119
_ilg
.Load(_objectLocal);
127
_ilg
.ConvertValue(_objectLocal.LocalType, Globals.TypeOfDateTimeOffsetAdapter);
128
_ilg
.Call(XmlFormatGeneratorStatics.GetDateTimeOffsetMethod);
129
_ilg
.ConvertValue(Globals.TypeOfDateTimeOffset,
_ilg
.CurrentMethod.ReturnType);
134
_ilg
.Call(classContract.GetKeyValuePairMethodInfo);
135
_ilg
.ConvertValue(Globals.TypeOfKeyValuePair.MakeGenericType(classContract.KeyValuePairGenericArguments),
_ilg
.CurrentMethod.ReturnType);
139
_ilg
.ConvertValue(_objectLocal.LocalType,
_ilg
.CurrentMethod.ReturnType);
142
return (XmlFormatClassReaderDelegate)
_ilg
.EndMethod();
149
_ilg
.Load(_objectLocal);
150
_ilg
.ConvertValue(_objectLocal.LocalType,
_ilg
.CurrentMethod.ReturnType);
151
return (XmlFormatCollectionReaderDelegate)
_ilg
.EndMethod();
158
return (XmlFormatGetOnlyCollectionReaderDelegate)
_ilg
.EndMethod();
169
_ilg
.BeginMethod("Read" + collectionContract.StableName.Name + "FromXml" + "IsGetOnly", Globals.TypeOfXmlFormatGetOnlyCollectionReaderDelegate, memberAccessFlag);
173
_ilg
.BeginMethod("Read" + collectionContract.StableName.Name + "FromXml" + string.Empty, Globals.TypeOfXmlFormatCollectionReaderDelegate, memberAccessFlag);
188
_collectionContractArg =
_ilg
.GetArg(4);
189
return
_ilg
;
194
_xmlReaderArg =
_ilg
.GetArg(0);
195
_contextArg =
_ilg
.GetArg(1);
196
_memberNamesArg =
_ilg
.GetArg(2);
197
_memberNamespacesArg =
_ilg
.GetArg(3);
207
_objectLocal =
_ilg
.DeclareLocal(type, "objectDeserialized");
211
_ilg
.LoadMember(Globals.TypeOfDBNull.GetField("Value"));
212
_ilg
.Stloc(_objectLocal);
218
_ilg
.Ldloca(_objectLocal);
219
_ilg
.InitObj(type);
223
_ilg
.New(classContract.GetNonAttributedTypeConstructor());
224
_ilg
.Stloc(_objectLocal);
229
_ilg
.Call(null, XmlFormatGeneratorStatics.GetUninitializedObjectMethod, DataContract.GetIdForInitialization(classContract));
230
_ilg
.ConvertValue(Globals.TypeOfObject, type);
231
_ilg
.Stloc(_objectLocal);
241
_ilg
.LoadAddress(_objectLocal);
242
_ilg
.ConvertAddress(_objectLocal.LocalType, _objectType);
243
_ilg
.Load(_contextArg);
244
_ilg
.LoadMember(XmlFormatGeneratorStatics.GetStreamingContextMethod);
245
_ilg
.Call(classContract.OnDeserializing);
255
_ilg
.LoadAddress(_objectLocal);
256
_ilg
.ConvertAddress(_objectLocal.LocalType, _objectType);
257
_ilg
.Load(_contextArg);
258
_ilg
.LoadMember(XmlFormatGeneratorStatics.GetStreamingContextMethod);
259
_ilg
.Call(classContract.OnDeserialized);
272
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, memberCount);
274
LocalBuilder memberIndexLocal =
_ilg
.DeclareLocal(Globals.TypeOfInt, "memberIndex", -1);
279
LocalBuilder requiredIndexLocal = hasRequiredMembers ?
_ilg
.DeclareLocal(Globals.TypeOfInt, "requiredIndex", firstRequiredMember) : null;
281
object forReadElements =
_ilg
.For(null, null, null);
282
_ilg
.Call(null, XmlFormatGeneratorStatics.MoveToNextElementMethod, _xmlReaderArg);
283
_ilg
.IfFalseBreak(forReadElements);
285
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.GetMemberIndexWithRequiredMembersMethod, _xmlReaderArg, _memberNamesArg, _memberNamespacesArg, memberIndexLocal, requiredIndexLocal, extensionDataLocal);
287
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.GetMemberIndexMethod, _xmlReaderArg, _memberNamesArg, _memberNamespacesArg, memberIndexLocal, extensionDataLocal);
288
Label[] memberLabels =
_ilg
.Switch(memberCount);
290
_ilg
.EndSwitch();
291
_ilg
.EndFor();
294
_ilg
.If(requiredIndexLocal, Cmp.LessThan, memberCount);
295
_ilg
.Call(null, XmlFormatGeneratorStatics.ThrowRequiredMemberMissingExceptionMethod, _xmlReaderArg, memberIndexLocal, requiredIndexLocal, _memberNamesArg);
296
_ilg
.EndIf();
309
_ilg
.Case(memberLabels[memberCount], dataMember.Name);
316
_ilg
.Set(requiredIndexLocal, nextRequiredIndex);
323
_ilg
.LoadAddress(_objectLocal);
324
_ilg
.LoadMember(dataMember.MemberInfo);
325
value =
_ilg
.DeclareLocal(memberType, dataMember.Name + "Value");
326
_ilg
.Stloc(value);
327
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.StoreCollectionMemberInfoMethod, value);
333
_ilg
.LoadAddress(_objectLocal);
334
_ilg
.ConvertAddress(_objectLocal.LocalType, _objectType);
335
_ilg
.Ldloc(value);
336
_ilg
.StoreMember(dataMember.MemberInfo);
349
_ilg
.Set(memberIndexLocal, memberCount);
351
_ilg
.EndCase();
381
LocalBuilder value =
_ilg
.DeclareLocal(type, "valueRead");
393
LocalBuilder objectId =
_ilg
.DeclareLocal(Globals.TypeOfString, "objectIdRead");
394
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.ReadAttributesMethod, _xmlReaderArg);
395
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.ReadIfNullOrRefMethod, _xmlReaderArg, type, DataContract.IsTypeSerializable(type));
396
_ilg
.Stloc(objectId);
398
_ilg
.If(objectId, Cmp.EqualTo, Globals.NullObjectId);
401
_ilg
.LoadAddress(value);
402
_ilg
.InitObj(value.LocalType);
408
_ilg
.Load(null);
409
_ilg
.Stloc(value);
415
_ilg
.ElseIfIsEmptyString(objectId);
416
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.GetObjectIdMethod);
417
_ilg
.Stloc(objectId);
420
_ilg
.IfNotIsEmptyString(objectId);
422
_ilg
.EndIf();
427
value =
_ilg
.DeclareLocal(type, "innerValueRead");
432
_ilg
.Call(_xmlReaderArg, primitiveContract.XmlFormatReaderMethod);
433
_ilg
.Stloc(value);
435
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectMethod, value);
442
_ilg
.Else();
447
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.GetExistingObjectMethod, objectId, type, name, ns);
448
_ilg
.ConvertValue(Globals.TypeOfObject, type);
449
_ilg
.Stloc(value);
451
_ilg
.EndIf();
455
_ilg
.If(objectId, Cmp.NotEqualTo, Globals.NullObjectId);
457
_ilg
.EndIf();
471
_ilg
.Load(_contextArg);
472
_ilg
.Load(_xmlReaderArg);
474
_ilg
.Load(DataContract.GetId(declaredType.TypeHandle));
475
_ilg
.Ldtoken(declaredType);
476
_ilg
.Load(name);
477
_ilg
.Load(ns);
478
_ilg
.Call(XmlFormatGeneratorStatics.InternalDeserializeMethod);
480
_ilg
.ConvertValue(Globals.TypeOfObject, type);
481
_ilg
.Stloc(value);
487
_ilg
.LoadAddress(outerValue);
488
_ilg
.Load(innerValue);
492
_ilg
.New(type.GetConstructor(new Type[] { innerType }));
495
_ilg
.Call(outerType.GetConstructor(new Type[] { innerType }));
532
_objectLocal =
_ilg
.DeclareLocal(type, "objectDeserialized");
537
_ilg
.Ldloca(_objectLocal);
538
_ilg
.InitObj(type);
542
_ilg
.New(constructor);
543
_ilg
.Stloc(_objectLocal);
544
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectMethod, _objectLocal);
548
LocalBuilder size =
_ilg
.DeclareLocal(Globals.TypeOfInt, "arraySize");
549
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.GetArraySizeMethod);
550
_ilg
.Stloc(size);
552
LocalBuilder objectId =
_ilg
.DeclareLocal(Globals.TypeOfString, "objectIdRead");
553
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.GetObjectIdMethod);
554
_ilg
.Stloc(objectId);
560
_ilg
.IfNot();
563
_ilg
.If(size, Cmp.EqualTo, -1);
568
growingCollection =
_ilg
.DeclareLocal(type, "growingCollection");
569
_ilg
.NewArray(itemType, 32);
570
_ilg
.Stloc(growingCollection);
572
LocalBuilder i =
_ilg
.DeclareLocal(Globals.TypeOfInt, "i");
573
object forLoop =
_ilg
.For(i, 0, Int32.MaxValue);
575
_ilg
.If();
576
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, 1);
581
_ilg
.Call(null, ensureArraySizeMethod, growingCollection, i);
582
_ilg
.Stloc(growingCollection);
583
_ilg
.StoreArrayElement(growingCollection, i, value);
587
_ilg
.Else();
589
_ilg
.If();
590
_ilg
.Break(forLoop);
591
_ilg
.Else();
593
_ilg
.EndIf();
594
_ilg
.EndIf();
596
_ilg
.EndFor();
600
_ilg
.Call(null, trimArraySizeMethod, growingCollection, i);
601
_ilg
.Stloc(_objectLocal);
602
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectWithIdMethod, objectId, _objectLocal);
604
_ilg
.Else();
606
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, size);
609
_ilg
.NewArray(itemType, size);
610
_ilg
.Stloc(_objectLocal);
611
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectMethod, _objectLocal);
613
LocalBuilder j =
_ilg
.DeclareLocal(Globals.TypeOfInt, "j");
614
_ilg
.For(j, 0, size);
616
_ilg
.If();
619
_ilg
.StoreArrayElement(_objectLocal, j, itemValue);
622
_ilg
.Else();
624
_ilg
.EndIf();
625
_ilg
.EndFor();
626
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.CheckEndOfArrayMethod, _xmlReaderArg, size, _memberNamesArg, _memberNamespacesArg);
627
_ilg
.EndIf();
631
_ilg
.Else();
632
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectWithIdMethod, objectId, _objectLocal);
633
_ilg
.EndIf();
645
_objectLocal =
_ilg
.DeclareLocal(type, "objectDeserialized");
646
_ilg
.Load(_contextArg);
647
_ilg
.LoadMember(XmlFormatGeneratorStatics.GetCollectionMemberMethod);
648
_ilg
.ConvertValue(Globals.TypeOfObject, type);
649
_ilg
.Stloc(_objectLocal);
653
_ilg
.If();
654
_ilg
.If(_objectLocal, Cmp.EqualTo, null);
655
_ilg
.Call(null, XmlFormatGeneratorStatics.ThrowNullValueReturnedForGetOnlyCollectionExceptionMethod, type);
657
_ilg
.Else();
658
LocalBuilder size =
_ilg
.DeclareLocal(Globals.TypeOfInt, "arraySize");
661
_ilg
.Load(_objectLocal);
662
_ilg
.Call(XmlFormatGeneratorStatics.GetArrayLengthMethod);
663
_ilg
.Stloc(size);
666
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectMethod, _objectLocal);
668
LocalBuilder i =
_ilg
.DeclareLocal(Globals.TypeOfInt, "i");
669
object forLoop =
_ilg
.For(i, 0, Int32.MaxValue);
671
_ilg
.If();
672
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, 1);
676
_ilg
.If(size, Cmp.EqualTo, i);
677
_ilg
.Call(null, XmlFormatGeneratorStatics.ThrowArrayExceededSizeExceptionMethod, size, type);
678
_ilg
.Else();
679
_ilg
.StoreArrayElement(_objectLocal, i, value);
680
_ilg
.EndIf();
684
_ilg
.Else();
686
_ilg
.If();
687
_ilg
.Break(forLoop);
688
_ilg
.Else();
690
_ilg
.EndIf();
691
_ilg
.EndIf();
692
_ilg
.EndFor();
693
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.CheckEndOfArrayMethod, _xmlReaderArg, size, _memberNamesArg, _memberNamespacesArg);
695
_ilg
.EndIf();
696
_ilg
.EndIf();
734
_ilg
.Load(_xmlReaderArg);
735
_ilg
.Load(_contextArg);
736
_ilg
.Load(_memberNamesArg);
737
_ilg
.Load(_memberNamespacesArg);
738
_ilg
.Load(size);
739
_ilg
.Ldloca(_objectLocal);
740
_ilg
.Call(typeof(XmlReaderDelegator).GetMethod(readArrayMethod, Globals.ScanAllMembers));
750
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.ResetAttributesMethod);
751
LocalBuilder value =
_ilg
.DeclareLocal(itemType, "valueRead");
752
_ilg
.Load(_collectionContractArg);
753
_ilg
.Call(XmlFormatGeneratorStatics.GetItemContractMethod);
754
_ilg
.Load(_xmlReaderArg);
755
_ilg
.Load(_contextArg);
756
_ilg
.Call(XmlFormatGeneratorStatics.ReadXmlValueMethod);
757
_ilg
.ConvertValue(Globals.TypeOfObject, itemType);
758
_ilg
.Stloc(value);
778
LocalBuilder pairKey =
_ilg
.DeclareLocal(keyMember.MemberType, keyMember.Name);
779
LocalBuilder pairValue =
_ilg
.DeclareLocal(valueMember.MemberType, valueMember.Name);
780
_ilg
.LoadAddress(value);
781
_ilg
.LoadMember(keyMember.MemberInfo);
782
_ilg
.Stloc(pairKey);
783
_ilg
.LoadAddress(value);
784
_ilg
.LoadMember(valueMember.MemberInfo);
785
_ilg
.Stloc(pairValue);
787
_ilg
.Call(collection, collectionContract.AddMethod, pairKey, pairValue);
789
_ilg
.Pop();
793
_ilg
.Call(collection, collectionContract.AddMethod, value);
795
_ilg
.Pop();
802
_ilg
.If();
803
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.SkipUnknownElementMethod, _xmlReaderArg);
804
_ilg
.Dec(iterator);
805
_ilg
.Else();
807
_ilg
.EndIf();
812
_ilg
.Call(_xmlReaderArg, XmlFormatGeneratorStatics.IsStartElementMethod2, nameArg, nsArg);
817
_ilg
.Call(_xmlReaderArg, XmlFormatGeneratorStatics.IsStartElementMethod0);
822
_ilg
.Load(_xmlReaderArg);
823
_ilg
.LoadMember(XmlFormatGeneratorStatics.NodeTypeProperty);
824
_ilg
.Load(XmlNodeType.EndElement);
825
_ilg
.Ceq();
830
_ilg
.Call(null, XmlFormatGeneratorStatics.CreateUnexpectedStateExceptionMethod, expectedState, _xmlReaderArg);
831
_ilg
.Throw();
837
_ilg
.Load(msg);
846
_ilg
.Call(XmlFormatGeneratorStatics.CreateSerializationExceptionMethod);
847
_ilg
.Throw();