23 writes to ilg
System.Private.Xml (23)
System\Xml\Serialization\XmlSerializationILGen.cs (10)
152ilg = new CodeGenerator(serializerContractTypeBuilder); 232ilg = new CodeGenerator(serializerContractTypeBuilder); 283ilg = new CodeGenerator(baseSerializerTypeBuilder); 325ilg = new CodeGenerator(typedSerializerTypeBuilder); 360ilg = new CodeGenerator(typedSerializerTypeBuilder); 384ilg = new CodeGenerator(typedSerializerTypeBuilder); 436ilg = new CodeGenerator(serializerContractTypeBuilder); 489ilg = new CodeGenerator(serializerContractTypeBuilder); 509ilg = new CodeGenerator(serializerContractTypeBuilder); 540ilg = new CodeGenerator(serializerContractTypeBuilder);
System\Xml\Serialization\XmlSerializationReaderILGen.cs (8)
228ilg = new CodeGenerator(this.typeBuilder); 343ilg = new CodeGenerator(this.typeBuilder); 389ilg = new CodeGenerator(this.typeBuilder); 632ilg = new CodeGenerator(this.typeBuilder); 961ilg = new CodeGenerator(this.typeBuilder); 1033ilg = new CodeGenerator(this.typeBuilder); 1278ilg = new CodeGenerator(this.typeBuilder); 1329ilg = new CodeGenerator(this.typeBuilder);
System\Xml\Serialization\XmlSerializationWriterILGen.cs (5)
88ilg = new CodeGenerator(this.typeBuilder); 356ilg = new CodeGenerator(this.typeBuilder); 547ilg = new CodeGenerator(this.typeBuilder); 604ilg = new CodeGenerator(this.typeBuilder); 914ilg = new CodeGenerator(this.typeBuilder);
1636 references to ilg
System.Private.Xml (1636)
System\Xml\Serialization\XmlSerializationILGen.cs (123)
160ilg.BeginMethod( 166propertyBuilder.SetGetMethod(ilg.MethodBuilder!); 168ilg.Ldarg(0); 169ilg.LoadMember(fieldBuilder); 170ilg.Load(null); 172ilg.If(Cmp.EqualTo); 178LocalBuilder _tmpLoc = ilg.DeclareLocal(typeof(Hashtable), "_tmp"); 179ilg.New(Hashtable_ctor); 180ilg.Stloc(_tmpLoc); 187ilg!.Ldarg(0); 188ilg.LoadMember(fieldBuilder); 189ilg.Load(null); 190ilg.If(Cmp.EqualTo); 192ilg.Ldarg(0); 193ilg.Ldloc(typeof(Hashtable), "_tmp"); 194ilg.StoreMember(fieldBuilder); 196ilg.EndIf(); 198ilg.EndIf(); 200ilg.Ldarg(0); 201ilg.LoadMember(fieldBuilder); 202ilg.GotoMethodEnd(); 204ilg.EndMethod(); 220ilg!.Ldloc(typeof(Hashtable), "_tmp"); 221ilg.Ldstr(GetCSharpString(xmlMappings[i].Key)); 222ilg.Ldstr(GetCSharpString(methods[i])); 223ilg.Call(Hashtable_set_Item); 233ilg.BeginMethod( 253ilg.Ldarg("type"); 254ilg.Ldc(type); 255ilg.If(Cmp.EqualTo); 257ilg.Ldc(true); 258ilg.GotoMethodEnd(); 260ilg.EndIf(); 262ilg.Ldc(false); 263ilg.GotoMethodEnd(); 264ilg.EndMethod(); 284ilg.BeginMethod(typeof(XmlSerializationReader), 289ilg.New(readerCtor); 290ilg.EndMethod(); 296ilg.BeginMethod(typeof(XmlSerializationWriter), 301ilg.New(writerCtor); 302ilg.EndMethod(); 326ilg.BeginMethod( 336ilg.Ldc(true); 337ilg.Stloc(ilg.ReturnLocal); 338ilg.Br(ilg.ReturnLabel); 347ilg.Ldarg(ilg.GetArg("xmlReader")); 348ilg.Ldstr(GetCSharpString(mapping.Accessor.Name)); 349ilg.Ldstr(GetCSharpString(mapping.Accessor.Namespace)); 350ilg.Call(XmlReader_IsStartElement); 351ilg.Stloc(ilg.ReturnLocal); 352ilg.Br(ilg.ReturnLabel); 354ilg.MarkLabel(ilg.ReturnLabel); 355ilg.Ldloc(ilg.ReturnLocal); 356ilg.EndMethod(); 361ilg.BeginMethod( 372ilg.Ldarg("writer"); 373ilg.Castclass(CreatedTypes[writerClass]); 374ilg.Ldarg("objectToSerialize"); 377ilg.ConvertValue(typeof(object), typeof(object[])); 379ilg.Call(writerType_writeMethod); 380ilg.EndMethod(); 385ilg.BeginMethod( 396ilg.Ldarg("reader"); 397ilg.Castclass(CreatedTypes[readerClass]); 398ilg.Call(readerType_readMethod); 399ilg.EndMethod(); 424ilg!.Ldloc(typeof(Hashtable), "_tmp"); 425ilg.Ldstr(GetCSharpString(key)); 426ilg.New(ctor); 427ilg.Call(Hashtable_Add); 437ilg.BeginMethod( 456ilg.Ldarg("type"); 457ilg.Ldc(type); 458ilg.If(Cmp.EqualTo); 464ilg.New(ctor); 465ilg.Stloc(ilg.ReturnLocal); 466ilg.Br(ilg.ReturnLabel); 468ilg.EndIf(); 471ilg.Load(null); 472ilg.Stloc(ilg.ReturnLocal); 473ilg.Br(ilg.ReturnLabel); 474ilg.MarkLabel(ilg.ReturnLabel); 475ilg.Ldloc(ilg.ReturnLocal); 476ilg.EndMethod(); 495ilg.BeginMethod( 501propertyBuilder.SetGetMethod(ilg.MethodBuilder!); 506ilg.New(ctor); 507ilg.EndMethod(); 515ilg.BeginMethod( 521propertyBuilder.SetGetMethod(ilg.MethodBuilder!); 526ilg.New(ctor); 527ilg.EndMethod(); 541ilg.BeginMethod( 548ilg.Ldarg(0); 549ilg.Load(null); 550ilg.StoreMember(readMethodsField); 551ilg.Ldarg(0); 552ilg.Load(null); 553ilg.StoreMember(writeMethodsField); 554ilg.Ldarg(0); 555ilg.Load(null); 556ilg.StoreMember(typedSerializersField); 557ilg.Ldarg(0); 558ilg.Call(baseCtor); 559ilg.EndMethod(); 583ilg!.LoadMember(ilg.GetVariable("o"), memInfo); 587ilg.ConvertValue(memType, type); 592SourceInfo info = new SourceInfo(source, null, null, null, ilg!);
System\Xml\Serialization\XmlSerializationReaderILGen.cs (925)
229ilg.BeginMethod(typeof(void), "InitIDs", Type.EmptyTypes, Array.Empty<string>(), 248ilg.Ldarg(0); 249ilg.Ldarg(0); 250ilg.Call(XmlSerializationReader_get_Reader); 251ilg.Call(XmlReader_get_NameTable); 252ilg.Ldstr(GetCSharpString(id)); 253ilg.Call(XmlNameTable_Add); 255ilg.StoreMember(_idNameFields[id]); 257ilg.EndMethod(); 293ilg.Ldarg(0); 294ilg.Call(XmlSerializationReader_get_Reader); 295ilg.Ldarg(0); 296ilg.LoadMember(_idNameFields[name ?? string.Empty]); 297ilg.Ldarg(0); 298ilg.LoadMember(_idNameFields[ns ?? string.Empty]); 299ilg.Call(XmlReader_IsStartElement); 300ilg.If(); 307ilg.Else(); 310ilg.Ldarg(0); 313ilg.Load(null); 316object pVar = ilg.GetVariable("p"); 317ilg.Load(pVar); 318ilg.ConvertValue(CodeGenerator.GetVariableType(pVar), typeof(object)); 326ilg.Ldstr(ReflectionAwareILGen.GetCSharpString(expectedElement)); 334ilg.Call(method); 337ilg.EndIf(); 344ilg.BeginMethod(typeof(void), "InitCallbacks", Type.EmptyTypes, Array.Empty<string>(), 346ilg.EndMethod(); 390ilg.BeginMethod( 397ilg.Load(null); 398ilg.Stloc(ilg.ReturnLocal); 409ilg.Ldarg(0); 410ilg.Call(XmlSerializationReader_get_Reader); 411ilg.Call(XmlReader_MoveToContent); 412ilg.Pop(); 414LocalBuilder localP = ilg.DeclareLocal(typeof(object[]), "p"); 415ilg.NewArray(typeof(object), mappings.Length); 416ilg.Stloc(localP); 506ilg.Ldarg(0); 507ilg.Ldc(true); 508ilg.Call(XmlSerializationReader_set_IsReturnValue); 524ilg.Ldarg(0); 525ilg.Call(XmlSerializationReader_get_Reader); 526ilg.Call(XmlReader_MoveToElement); 527ilg.Pop(); 539ilg.Ldarg(0); 540ilg.Call(XmlSerializationReader_get_Reader); 541ilg.Call(XmlReader_get_IsEmptyElement); 542ilg.If(); 549ilg.Ldarg(0); 550ilg.Call(XmlSerializationReader_get_Reader); 551ilg.Call(XmlReader_Skip); 552ilg.Ldarg(0); 553ilg.Call(XmlSerializationReader_get_Reader); 554ilg.Call(XmlReader_MoveToContent); 555ilg.Pop(); 556ilg.WhileContinue(); 558ilg.EndIf(); 564ilg.Ldarg(0); 565ilg.Call(XmlSerializationReader_get_Reader); 566ilg.Call(XmlReader_ReadStartElement); 570ilg.Ldc(0); 571ilg.Stloc(typeof(int), "state"); 578ilg.Ldarg(0); 579ilg.Call(XmlSerializationReader_get_Reader); 580ilg.Call(XmlReader_MoveToContent); 581ilg.Pop(); 593ilg.Ldarg(0); 594ilg.Call(XmlSerializationReader_ReadEndElement); 599ilg.Ldarg(0); 600ilg.Call(XmlSerializationReader_get_Reader); 601ilg.Call(XmlReader_MoveToContent); 602ilg.Pop(); 606ilg.Ldloc(ilg.GetLocal("p")); 607ilg.EndMethod(); 618LocalBuilder arrayLoc = ilg.GetLocal(arrayName); 619ilg.Ldloc(arrayLoc); 620ilg.Ldc(i); 621ReflectionAwareILGen.ILGenForCreateInstance(ilg, mappings[i].TypeDesc!.Type!, false, false); 622ilg.ConvertValue(mappings[i].TypeDesc!.Type!, typeof(object)); 623ilg.Stelem(arrayLoc.LocalType.GetElementType()!); 633ilg.BeginMethod( 640LocalBuilder oLoc = ilg.DeclareLocal(typeof(object), "o"); 641ilg.Load(null); 642ilg.Stloc(oLoc); 658ilg.Ldarg(0); 659ilg.Call(XmlSerializationReader_get_Reader); 660ilg.Call(XmlReader_MoveToContent); 661ilg.Pop(); 664ilg.Ldloc(oLoc); 666ilg.Stloc(ilg.ReturnLocal); 667ilg.Ldloc(ilg.ReturnLocal); 668ilg.EndMethod(); 694ilg.Ldarg(0); 707ilg.Ldarg(0); 708ilg.Call(XmlSerializationReader_get_Reader); 709ilg.Call(XmlReader_ReadXXXString); 723ilg.Ldarg(0); 724ilg.Call(XmlSerializationReader_get_Reader); 725ilg.Call(XmlReader_get_Value); 729LocalBuilder locVals = ilg.GetLocal("vals"); 730LocalBuilder locI = ilg.GetLocal("i"); 731ilg.LoadArrayElement(locVals, locI); 735ilg.Ldc(false); 741ilg.Call(methodBuilder); 757ilg.Ldarg(0); 758ilg.Call(XmlSerializationReader_get_Reader); 759ilg.Call(XmlReader_ReadXXXString); 773ilg.Ldarg(0); 774ilg.Call(XmlSerializationReader_get_Reader); 775ilg.Call(XmlReader_get_Value); 779LocalBuilder locVals = ilg.GetLocal("vals"); 780LocalBuilder locI = ilg.GetLocal("i"); 781ilg.LoadArrayElement(locVals, locI); 794ilg.Ldarg(0); 795LocalBuilder locVals = ilg.GetLocal("vals"); 796LocalBuilder locI = ilg.GetLocal("i"); 797ilg.LoadArrayElement(locVals, locI); 807ilg.Call(XmlSerializationReader_CollapseWhitespace); 823ilg.Ldarg(0); 824ilg.Ldarg(0); 825ilg.Call(XmlSerializationReader_get_Reader); 826ilg.Call(XmlReader_method); 834ilg.Call(XmlSerializationReader_CollapseWhitespace); 851ilg.Ldarg(0); 880ilg.Ldarg(0); 881ilg.Call(XmlSerializationReader_get_Reader); 882ilg.Call(XmlReader_ReadXXXString); 896ilg.Ldarg(0); 897ilg.Call(XmlSerializationReader_get_Reader); 898ilg.Call(XmlReader_get_Value); 902LocalBuilder locVals = ilg.GetLocal("vals"); 903LocalBuilder locI = ilg.GetLocal("i"); 904ilg.LoadArrayElement(locVals, locI); 909ilg.Ldc(false); 911ilg.Call(ToXXX); 962ilg.BeginMethod( 969ilg.Ldarg(0); 970ilg.LoadMember(fieldBuilder); 971ilg.Load(null); 972ilg.If(Cmp.EqualTo); 978LocalBuilder hLoc = ilg.DeclareLocal(typeof(Hashtable), "h"); 979ilg.New(Hashtable_ctor); 980ilg.Stloc(hLoc); 991ilg.Ldloc(hLoc); 992ilg.Ldstr(GetCSharpString(constants[i].XmlName)); 993ilg.Ldc(Enum.ToObject(mapping.TypeDesc!.Type!, constants[i].Value)); 994ilg.ConvertValue(mapping.TypeDesc.Type!, typeof(long)); 995ilg.ConvertValue(typeof(long), typeof(object)); 997ilg.Call(Hashtable_Add); 1000ilg.Ldarg(0); 1001ilg.Ldloc(hLoc); 1002ilg.StoreMember(fieldBuilder); 1004ilg.EndIf(); 1006ilg.Ldarg(0); 1007ilg.LoadMember(fieldBuilder); 1009get_TableName = ilg.EndMethod(); 1034ilg.BeginMethod( 1050ilg.Ldarg("s"); 1051ilg.Ldarg(0); 1053ilg.Call(get_TableName); 1054ilg.Ldstr(GetCSharpString(fullTypeName)); 1055ilg.Call(XmlSerializationReader_ToEnum); 1059ilg.ConvertValue(typeof(long), underlyingType); 1061ilg.Stloc(ilg.ReturnLocal); 1062ilg.Br(ilg.ReturnLabel); 1069Label defaultLabel = ilg.DefineLabel(); 1070Label endSwitchLabel = ilg.DefineLabel(); 1072LocalBuilder localTmp = ilg.GetTempLocal(typeof(string)); 1073ilg.Ldarg("s"); 1074ilg.Stloc(localTmp); 1075ilg.Ldloc(localTmp); 1076ilg.Brfalse(defaultLabel); 1085Label caseLabel = ilg.DefineLabel(); 1086ilg.Ldloc(localTmp); 1087ilg.Ldstr(GetCSharpString(c.XmlName)); 1093ilg.Call(String_op_Equality); 1094ilg.Brtrue(caseLabel); 1100ilg.Br(defaultLabel); 1104ilg.MarkLabel(caseLabels[i]); 1105ilg.Ldc(retValues[i]); 1106ilg.Stloc(ilg.ReturnLocal); 1107ilg.Br(ilg.ReturnLabel); 1115ilg.MarkLabel(defaultLabel); 1116ilg.Ldarg(0); 1117ilg.Ldarg("s"); 1119ilg.Ldc(mapping.TypeDesc.Type!); 1120ilg.Call(XmlSerializationReader_CreateUnknownConstantException); 1121ilg.Throw(); 1123ilg.MarkLabel(endSwitchLabel); 1126ilg.MarkLabel(ilg.ReturnLabel); 1127ilg.Ldloc(ilg.ReturnLocal); 1128ilg.EndMethod(); 1135ilg.InitElseIf(); 1137ilg.AndIf(); 1146ilg.Ldarg(0); 1149ilg.Ldarg("isNullable"); 1152ilg.Ldc(false); 1161ilg.Call(methodBuilder); 1162ilg.ConvertValue(methodBuilder.ReturnType, ilg.ReturnLocal.LocalType); 1163ilg.Stloc(ilg.ReturnLocal); 1164ilg.Br(ilg.ReturnLabel); 1178ilg.InitElseIf(); 1180ilg.AndIf(); 1191ilg.Ldarg(0); 1192ilg.Call(XmlSerializationReader_get_Reader); 1193ilg.Call(XmlReader_ReadStartElement); 1199LocalBuilder eLoc = ilg.DeclareOrGetLocal(typeof(object), "e"); 1216ilg.Ldarg(0); 1217ilg.Ldarg(0); 1218ilg.Ldarg(0); 1219ilg.Call(XmlSerializationReader_get_Reader); 1220ilg.Call(XmlReader_ReadString); 1221ilg.Call(XmlSerializationReader_CollapseWhitespace); 1222ilg.Call(methodBuilder); 1223ilg.ConvertValue(methodBuilder.ReturnType, eLoc.LocalType); 1224ilg.Stloc(eLoc); 1230ilg.Ldarg(0); 1231ilg.Call(XmlSerializationReader_ReadEndElement); 1232ilg.Ldloc(eLoc); 1233ilg.Stloc(ilg.ReturnLocal); 1234ilg.Br(ilg.ReturnLabel); 1241ilg.InitElseIf(); 1243ilg.AndIf(); 1244ilg.EnterScope(); 1253LocalBuilder aLoc = ilg.DeclareLocal(arrayMapping.TypeDesc.Type!, aVar); 1256ReflectionAwareILGen.ILGenForCreateInstance(ilg, td.Type!, false, false); 1259ilg.Load(null); 1260ilg.Stloc(aLoc); 1263ilg.Ldloc(aLoc); 1264ilg.Stloc(ilg.ReturnLocal); 1265ilg.Br(ilg.ReturnLabel); 1266ilg.ExitScope(); 1279ilg.BeginMethod( 1286LocalBuilder oLoc = ilg.DeclareLocal(nullableMapping.TypeDesc.Type!, "o"); 1288ilg.LoadAddress(oLoc); 1289ilg.InitObj(nullableMapping.TypeDesc.Type!); 1294ilg.Ldarg(0); 1295ilg.Call(XmlSerializationReader_ReadNull); 1296ilg.If(); 1298ilg.Ldloc(oLoc); 1299ilg.Stloc(ilg.ReturnLocal); 1300ilg.Br(ilg.ReturnLabel); 1302ilg.EndIf(); 1310ilg.Ldloc(oLoc); 1311ilg.Stloc(ilg.ReturnLocal); 1312ilg.Br(ilg.ReturnLabel); 1314ilg.MarkLabel(ilg.ReturnLabel); 1315ilg.Ldloc(ilg.ReturnLocal); 1316ilg.EndMethod(); 1339ilg.BeginMethod( 1346LocalBuilder locXsiType = ilg.DeclareLocal(typeof(XmlQualifiedName), "xsiType"); 1347LocalBuilder locIsNull = ilg.DeclareLocal(typeof(bool), "isNull"); 1358Label labelTrue = ilg.DefineLabel(); 1359Label labelEnd = ilg.DefineLabel(); 1360ilg.Ldarg("checkType"); 1361ilg.Brtrue(labelTrue); 1362ilg.Load(null); 1363ilg.Br_S(labelEnd); 1364ilg.MarkLabel(labelTrue); 1365ilg.Ldarg(0); 1366ilg.Call(XmlSerializationReader_GetXsiType); 1367ilg.MarkLabel(labelEnd); 1368ilg.Stloc(locXsiType); 1369ilg.Ldc(false); 1370ilg.Stloc(locIsNull); 1373ilg.Ldarg("isNullable"); 1374ilg.If(); 1376ilg.Ldarg(0); 1377ilg.Call(XmlSerializationReader_ReadNull); 1378ilg.Stloc(locIsNull); 1380ilg.EndIf(); 1383ilg.Ldarg("checkType"); 1384ilg.If(); // if (checkType) 1387ilg.Ldloc(locIsNull); 1388ilg.If(); 1389ilg.Ldloc(locXsiType); 1390ilg.Load(null); 1391ilg.If(Cmp.NotEqualTo); 1397ilg.Ldarg(0); 1398ilg.Ldloc(locXsiType); 1399ilg.Call(XmlSerializationReader_ReadTypedNull); 1400ilg.Stloc(ilg.ReturnLocal); 1401ilg.Br(ilg.ReturnLabel); 1402ilg.Else(); 1409ilg.Load(null); 1410ilg.Stloc(ilg.ReturnLocal); 1411ilg.Br(ilg.ReturnLabel); 1413ilg.EndIf(); // if (xsiType != null) 1415ilg.EndIf(); // if (isNull) 1417ilg.Ldloc(typeof(XmlQualifiedName), "xsiType"); 1418ilg.Load(null); 1419ilg.Ceq(); 1422labelTrue = ilg.DefineLabel(); 1423labelEnd = ilg.DefineLabel(); 1425ilg.Brtrue(labelTrue); 1428ilg.Br_S(labelEnd); 1429ilg.MarkLabel(labelTrue); 1430ilg.Ldc(true); 1431ilg.MarkLabel(labelEnd); 1433ilg.If(); // if (xsiType == null 1445ilg.Ldarg(0); 1446ilg.Ldstr(Soap.UrType); 1447ilg.Ldstr(XmlSchema.Namespace); 1448ilg.New(XmlQualifiedName_ctor); 1449ilg.Call(XmlSerializationReader_ReadTypedPrimitive); 1450ilg.Stloc(ilg.ReturnLocal); 1451ilg.Br(ilg.ReturnLabel); 1455ilg.Else(); // if (xsiType == null 1463ilg.Ldarg(0); 1464ilg.Ldloc(locXsiType); 1465ilg.Call(XmlSerializationReader_ReadTypedPrimitive); 1466ilg.Stloc(ilg.ReturnLocal); 1467ilg.Br(ilg.ReturnLabel); 1476ilg.Ldarg(0); 1477ilg.Ldloc(locXsiType); 1478ilg.Call(XmlSerializationReader_CreateUnknownTypeException); 1479ilg.Throw(); 1481ilg.EndIf(); // if (xsiType == null 1482ilg.EndIf(); // checkType 1486ilg.Ldloc(typeof(bool), "isNull"); 1487ilg.If(); 1489ilg.Load(null); 1490ilg.Stloc(ilg.ReturnLocal); 1491ilg.Br(ilg.ReturnLabel); 1493ilg.EndIf(); 1503ilg.Ldarg(0); 1504ilg.Ldstr(GetCSharpString(structMapping.TypeName)); 1505ilg.Ldstr(GetCSharpString(structMapping.Namespace)); 1506ilg.Call(XmlSerializationReader_CreateAbstractTypeException); 1507ilg.Throw(); 1518ilg.Ldarg(0); 1519ilg.Ldc(false); 1520ilg.Call(XmlSerializationReader_set_DecodeName); 1523LocalBuilder oLoc = ilg.GetLocal("o"); 1622ilg.Ldarg(0); 1623ilg.Call(XmlSerializationReader_get_Reader); 1624ilg.Call(XmlReader_MoveToElement); 1625ilg.Pop(); 1632ilg.Ldarg(0); 1633ilg.Call(XmlSerializationReader_get_Reader); 1634ilg.Call(XmlReader_get_IsEmptyElement); 1635ilg.If(); 1641ilg.Ldarg(0); 1642ilg.Call(XmlSerializationReader_get_Reader); 1643ilg.Call(XmlReader_Skip); 1645ilg.Ldloc(oLoc); 1646ilg.Stloc(ilg.ReturnLocal); 1647ilg.Br(ilg.ReturnLabel); 1648ilg.EndIf(); 1655ilg.Ldarg(0); 1656ilg.Call(XmlSerializationReader_get_Reader); 1657ilg.Call(XmlReader_ReadStartElement); 1660ilg.Ldc(0); 1661ilg.Stloc(typeof(int), "state"); 1671ilg.Ldarg(0); 1672ilg.Call(XmlSerializationReader_get_Reader); 1673ilg.Call(XmlReader_MoveToContent); 1674ilg.Pop(); 1684ilg.Ldarg(0); 1685ilg.Call(XmlSerializationReader_ReadEndElement); 1686ilg.Ldloc(structMapping.TypeDesc.Type!, "o"); 1687ilg.Stloc(ilg.ReturnLocal); 1689ilg.MarkLabel(ilg.ReturnLabel); 1690ilg.Ldloc(ilg.ReturnLocal); 1691ilg.EndMethod(); 1710Label labelEnd = ilg.DefineLabel(); 1711Label labelFalse = ilg.DefineLabel(); 1712LocalBuilder sLoc = ilg.GetLocal(source); 1713ilg.Ldloc(sLoc); 1714ilg.Call(XmlQualifiedName_get_Name); 1715ilg.Ldarg(0); 1716ilg.LoadMember(_idNameFields[name ?? string.Empty]); 1717ilg.Bne(labelFalse); 1718ilg.Ldloc(sLoc); 1719ilg.Call(XmlQualifiedName_get_Namespace); 1720ilg.Ldarg(0); 1721ilg.LoadMember(_idNameFields[ns ?? string.Empty]); 1722ilg.Ceq(); 1723ilg.Br_S(labelEnd); 1724ilg.MarkLabel(labelFalse); 1725ilg.Ldc(false); 1726ilg.MarkLabel(labelEnd); 1759Label labelFalse = ilg.DefineLabel(); 1760Label labelEnd = ilg.DefineLabel(); 1764ilg.Ldarg(0); 1765ilg.Call(XmlSerializationReader_get_Reader); 1766ilg.Call(XmlReader_get_LocalName); 1767ilg.Ldarg(0); 1768ilg.LoadMember(_idNameFields[name ?? string.Empty]); 1769ilg.Bne(labelFalse); 1772ilg.Ldarg(0); 1773ilg.Call(XmlSerializationReader_get_Reader); 1774ilg.Call(XmlReader_get_NamespaceURI); 1775ilg.Ldarg(0); 1776ilg.LoadMember(_idNameFields[ns ?? string.Empty]); 1777ilg.Ceq(); 1781ilg.Br_S(labelEnd); 1782ilg.MarkLabel(labelFalse); 1783ilg.Ldc(false); 1784ilg.MarkLabel(labelEnd); 1787ilg.AndIf(); 1818ilg.WhileBegin(); 1839ilg.InitElseIf(); 1841ilg.InitIf(); 1846ilg.Ldc(false); 1847ilg.AndIf(Cmp.EqualTo); 1861ilg.InitElseIf(); 1863ilg.InitIf(); 1887ilg.Ldarg(0); 1888ilg.Ldarg(0); 1889ilg.Call(XmlSerializationReader_get_Reader); 1890ilg.Call(XmlReader_get_Name); 1891ilg.Call(XmlSerializationReader_IsXmlnsAttribute); 1892ilg.Ldc(true); 1893ilg.AndIf(Cmp.EqualTo); 1896ilg.Load(null); 1897ilg.If(Cmp.EqualTo); 1903ilg.New(ctor); 1905ilg.EndIf(); // if (xmlnsMember.Source == null 1907Label labelEqual5 = ilg.DefineLabel(); 1908Label labelEndLength = ilg.DefineLabel(); 1920ilg.Ldarg(0); 1921ilg.Call(XmlSerializationReader_get_Reader); 1922ilg.Call(XmlReader_get_Name); 1923ilg.Call(String_get_Length); 1924ilg.Ldc(5); 1925ilg.Beq(labelEqual5); 1926ilg.Ldarg(0); 1927ilg.Call(XmlSerializationReader_get_Reader); 1928ilg.Call(XmlReader_get_LocalName); 1929ilg.Br(labelEndLength); 1930ilg.MarkLabel(labelEqual5); 1931ilg.Ldstr(string.Empty); 1932ilg.MarkLabel(labelEndLength); 1933ilg.Ldarg(0); 1934ilg.Call(XmlSerializationReader_get_Reader); 1935ilg.Call(XmlReader_get_Value); 1936ilg.Call(Add); 1938ilg.Else(); 1952ilg.Ldarg(0); 1953ilg.Ldarg(0); 1954ilg.Call(XmlSerializationReader_get_Reader); 1955ilg.Call(XmlReader_get_Name); 1956ilg.Call(XmlSerializationReader_IsXmlnsAttribute); 1957ilg.Ldc(false); 1958ilg.AndIf(Cmp.EqualTo); 1962LocalBuilder localAttr = ilg.DeclareOrGetLocal(typeof(XmlAttribute), "attr"); 1973ilg.Ldarg(0); 1974ilg.Call(XmlSerializationReader_get_Document); 1975ilg.Ldarg(0); 1976ilg.Call(XmlSerializationReader_get_Reader); 1977ilg.Call(XmlDocument_ReadNode); 1978ilg.ConvertValue(XmlDocument_ReadNode.ReturnType, localAttr.LocalType); 1979ilg.Stloc(localAttr); 1985ilg.Ldarg(0); 1986ilg.Ldloc(localAttr); 1987ilg.Call(XmlSerializationReader_ParseWsdlArrayType); 1993ilg.Ldarg(0); 1995ilg.Ldloc(firstParam); 1996ilg.ConvertValue(firstParam.LocalType, typeof(object)); 2009ilg.Ldstr(qnames); 2017ilg.Call(elseCallMethod); 2019ilg.EndIf(); 2021ilg.WhileBeginCondition(); 2023ilg.Ldarg(0); 2024ilg.Call(XmlSerializationReader_get_Reader); 2025ilg.Call(XmlReader_MoveToNextAttribute); 2027ilg.WhileEndCondition(); 2028ilg.WhileEnd(); 2040ilg.Ldloc("attr"); 2045LocalBuilder attrLoc = ilg.GetLocal("attr"); 2046ilg.Ldloc(attrLoc); 2050ilg.Load(null); 2051ilg.Cne(); 2054ilg.IsInst(typeof(XmlAttribute)); 2055ilg.If(); 2057ilg.Ldloc(attrLoc); 2058ilg.ConvertValue(attrLoc.LocalType, typeof(XmlAttribute)); 2060ilg.EndIf(); 2069LocalBuilder locListValues = ilg.DeclareOrGetLocal(typeof(string), "listValues"); 2070LocalBuilder locVals = ilg.DeclareOrGetLocal(typeof(string[]), "vals"); 2086ilg.Ldarg(0); 2087ilg.Call(XmlSerializationReader_get_Reader); 2088ilg.Call(XmlReader_get_Value); 2089ilg.Stloc(locListValues); 2090ilg.Ldloc(locListValues); 2091ilg.Load(null); 2092ilg.Call(String_Split); 2093ilg.Stloc(locVals); 2094LocalBuilder localI = ilg.DeclareOrGetLocal(typeof(int), "i"); 2095ilg.For(localI, 0, locVals); 2102ilg.EndFor(); 2138ilg.Ldc(0); 2139ilg.Stloc(typeof(int), c); 2146ilg.Ldc(0); 2147ilg.Stloc(typeof(int), $"c{member.ChoiceArrayName}"); 2156ilg.Ldloc(ilg.GetLocal(a)); 2165ilg.Load(null); 2166ilg.If(Cmp.EqualTo); 2174ilg.Ldarg(0); 2175ilg.Ldstr(GetCSharpString(member.Mapping.TypeDesc.CSharpName)); 2176ilg.Call(XmlSerializationReader_CreateReadOnlyCollectionException); 2177ilg.Throw(); 2182ReflectionAwareILGen.ILGenForCreateInstance(ilg, member.Mapping.TypeDesc.Type!, typeDesc.CannotNew, true); 2185ilg.EndIf(); // if ((object)(member.Source) == null 2187WriteLocalDecl(a, new SourceInfo(member.Source, member.Source, member.Mapping.MemberInfo, member.Mapping.TypeDesc.Type, ilg)); 2231ilg.Load(null); 2232ilg.Stloc(typeof(string), "tmp"); 2246ilg.Ldarg(0); 2247ilg.Call(XmlSerializationReader_get_Reader); 2248ilg.Call(XmlReader_get_NodeType); 2249ilg.Ldc(XmlNodeType_Element); 2250ilg.If(Cmp.EqualTo); 2257ilg.Else(); 2259ilg.EndIf(); 2264ilg.InitElseIf(); 2265Label labelTrue = ilg.DefineLabel(); 2266Label labelEnd = ilg.DefineLabel(); 2277ilg.Ldarg(0); 2278ilg.Call(XmlSerializationReader_get_Reader); 2279ilg.Call(XmlReader_get_NodeType); 2280ilg.Ldc(XmlNodeType.Text); 2281ilg.Ceq(); 2282ilg.Brtrue(labelTrue); 2283ilg.Ldarg(0); 2284ilg.Call(XmlSerializationReader_get_Reader); 2285ilg.Call(XmlReader_get_NodeType); 2286ilg.Ldc(XmlNodeType.CDATA); 2287ilg.Ceq(); 2288ilg.Brtrue(labelTrue); 2289ilg.Ldarg(0); 2290ilg.Call(XmlSerializationReader_get_Reader); 2291ilg.Call(XmlReader_get_NodeType); 2292ilg.Ldc(XmlNodeType.Whitespace); 2293ilg.Ceq(); 2294ilg.Brtrue(labelTrue); 2295ilg.Ldarg(0); 2296ilg.Call(XmlSerializationReader_get_Reader); 2297ilg.Call(XmlReader_get_NodeType); 2298ilg.Ldc(XmlNodeType.SignificantWhitespace); 2299ilg.Ceq(); 2300ilg.Br(labelEnd); 2301ilg.MarkLabel(labelTrue); 2302ilg.Ldc(true); 2303ilg.MarkLabel(labelEnd); 2304ilg.AndIf(); 2343ilg.Ldarg(0); 2344ilg.Call(XmlSerializationReader_get_Document); 2345ilg.Ldarg(0); 2346ilg.Call(XmlSerializationReader_get_Reader); 2347ilg.Call(XmlReader_ReadString); 2348ilg.Call(XmlDocument_CreateTextNode); 2362ilg.Ldarg(0); // for calling CollapseWhitespace 2377ilg.Ldarg(0); 2378ilg.Call(XmlSerializationReader_get_Reader); 2379ilg.Call(XmlReader_ReadString); 2387ilg.Call(XmlSerializationReader_CollapseWhitespace); 2394LocalBuilder tmpLoc = ilg.GetLocal("tmp"); 2400ilg.Ldarg(0); 2401ilg.Ldloc(tmpLoc); 2402ilg.Ldc(text.Mapping.TypeDesc!.CollapseWhitespace); 2403ilg.Call(XmlSerializationReader_ReadString); 2404ilg.Stloc(tmpLoc); 2407ilg.Ldloc(tmpLoc); 2478ilg.InitElseIf(); 2483ilg.InitElseIf(); 2485ilg.InitIf(); 2486ilg.Ldloc("state"); 2487ilg.Ldc(cases); 2488ilg.AndIf(Cmp.EqualTo); 2489ilg.InitIf(); 2493ilg.InitIf(); 2500ilg.Ldc(false); 2501ilg.AndIf(Cmp.EqualTo); 2503Label labelTrue = ilg.DefineLabel(); 2504Label labelEnd = ilg.DefineLabel(); 2512ilg.Ldarg(0); 2513ilg.Call(XmlSerializationReader_get_IsReturnValue); 2514ilg.Brtrue(labelTrue); 2518ilg.Ldc(true); 2526ilg.Br_S(labelEnd); 2527ilg.MarkLabel(labelTrue); 2528ilg.Ldc(true); 2529ilg.MarkLabel(labelEnd); 2531ilg.AndIf(); 2541ilg.Ldarg(0); 2542ilg.Ldc(false); 2543ilg.Call(XmlSerializationReader_set_IsReturnValue); 2554ilg.Else(); 2558ilg.EndIf(); 2561ilg.Ldc(cases); 2562ilg.Stloc(ilg.GetLocal("state")); 2565ilg.EndIf(); 2571ilg.Else(); 2576ilg.EndIf(); 2641ilg.Ldarg(0); 2642ilg.Ldloc(ilg.GetLocal(a)); 2643ilg.Ldloc(ilg.GetLocal(c)); 2644ilg.Ldc(typeDesc.ArrayElementTypeDesc!.Type!); 2645ilg.Ldc(member.IsNullable); 2646ilg.Call(XmlSerializationReader_ShrinkArray); 2647ilg.ConvertValue(XmlSerializationReader_ShrinkArray.ReturnType, typeDesc.Type!); 2656ilg.Ldarg(0); 2657ilg.Ldloc(ilg.GetLocal(a)); 2658ilg.Ldloc(ilg.GetLocal(c)); 2659ilg.Ldc(member.Mapping.ChoiceIdentifier.Mapping!.TypeDesc!.Type!); 2660ilg.Ldc(member.IsNullable); 2661ilg.Call(XmlSerializationReader_ShrinkArray); 2662ilg.ConvertValue(XmlSerializationReader_ShrinkArray.ReturnType, member.Mapping.ChoiceIdentifier.Mapping.TypeDesc.Type!.MakeArrayType()); 2668LocalBuilder arrayLoc = ilg.GetLocal(member.ArrayName); 2670ilg.Ldloc(arrayLoc); 2691if (ilg.TryGetVariable(source, out variable)) 2697ilg.LoadAddress(variable); 2704ilg.LdlocAddress(ilg.GetLocal("o")); 2715LocalBuilder localA = ilg.GetLocal(match.Groups["locA1"].Value); 2716LocalBuilder localI = ilg.GetLocal(match.Groups["locI1"].Value); 2723ilg.Ldarg(0); 2724ilg.Ldloc(localA); 2725ilg.Ldloc(localI); 2726ilg.Ldc(arrayElementType); 2727ilg.Call(XmlSerializationReader_EnsureArrayIndex); 2728ilg.Castclass(localA.LocalType); 2729ilg.Stloc(localA); 2732ilg.Ldloc(localA); 2733ilg.Ldloc(localI); 2734ilg.Dup(); 2735ilg.Ldc(1); 2736ilg.Add(); 2737ilg.Stloc(localI); 2740ilg.Ldelema(arrayElementType); 2748LocalBuilder localA = ilg.GetLocal(source.Substring(0, index)); 2749ilg.LdlocAddress(localA); 2757System.Diagnostics.Debug.Assert(CodeGenerator.GetVariableType(ilg.GetVariable(match.Groups["a"].Value)).IsArray); 2758ilg.Load(ilg.GetVariable(match.Groups["a"].Value)); 2759ilg.Load(ilg.GetVariable(match.Groups["ia"].Value)); 2772if (ilg.TryGetVariable(source, out variable)) 2777ilg.Call(varType.GetConstructor(varType.GetGenericArguments())!); 2782ilg.ConvertValue(stackType, elementType); 2783ilg.ConvertValue(elementType, varType); 2784ilg.Stloc((LocalBuilder)variable); 2793ilg.ConvertValue(stackType, memInfo is FieldInfo ? ((FieldInfo)memInfo).FieldType : ((PropertyInfo)memInfo).PropertyType); 2794ilg.StoreMember(memInfo); 2801object oVar = ilg.GetVariable(match.Groups["locA1"].Value); 2803ilg.ConvertValue(elementType, arrayElementType); 2806ilg.Stobj(arrayElementType); 2810ilg.Stelem(arrayElementType); 2818LocalBuilder localA = ilg.GetLocal(source.Substring(0, index)); 2827ilg.ConvertValue(stackType, addParameterType); 2828ilg.Call(Add); 2830ilg.Pop(); 2837Type varType = CodeGenerator.GetVariableType(ilg.GetVariable(match.Groups["a"].Value)); 2840ilg.ConvertValue(stackType, varElementType); 2841ilg.Stelem(varElementType); 2854ilg.Ldarg(0); 2855ilg.Call(XmlSerializationReader_ReadNull); 2856ilg.IfNot(); // if (!ReadNull()) { // EnterScope 2857ilg.EnterScope(); 2873Label labelTrue = ilg.DefineLabel(); 2874Label labelEnd = ilg.DefineLabel(); 2878ilg.Load(ilg.GetVariable(member.ArrayName)); 2879ilg.Load(null); 2880ilg.Beq(labelTrue); 2895ilg.Ldarg(0); 2896ilg.Call(XmlSerializationReader_get_Reader); 2897ilg.Call(XmlReader_get_IsEmptyElement); 2900ilg.Br_S(labelEnd); 2901ilg.MarkLabel(labelTrue); 2902ilg.Ldc(true); 2903ilg.MarkLabel(labelEnd); 2905ilg.If(); 2911ilg.Ldarg(0); 2912ilg.Call(XmlSerializationReader_get_Reader); 2913ilg.Call(XmlReader_Skip); 2914ilg.Else(); 2921ilg.Ldarg(0); 2922ilg.Call(XmlSerializationReader_get_Reader); 2923ilg.Call(XmlReader_ReadStartElement); 2933ilg.Ldarg(0); 2934ilg.Call(XmlSerializationReader_get_Reader); 2935ilg.Call(XmlReader_MoveToContent); 2936ilg.Pop(); 2944ilg.Ldarg(0); 2945ilg.Call(XmlSerializationReader_ReadEndElement); 2946ilg.EndIf(); 2952ilg.ExitScope(); // if(!ReadNull()) { ExitScope 2953ilg.Else(); // } else { EnterScope 2954ilg.EnterScope(); 2959ilg.ExitScope(); // if(!ReadNull())/else ExitScope 2960ilg.EndIf(); 2982ilg.Ldarg(0); 2983ilg.Ldc(true); 2991ilg.Call(methodBuilder); 3004ilg.Ldarg(0); 3005ilg.Call(XmlSerializationReader_ReadNull); 3006ilg.If(); 3014ilg.Load(null); 3017ilg.Else(); 3032ilg.Ldarg(0); 3033ilg.Call(XmlSerializationReader_get_Reader); 3034ilg.Call(XmlReader_get_IsEmptyElement); 3035ilg.If(); 3041ilg.Ldarg(0); 3042ilg.Call(XmlSerializationReader_get_Reader); 3043ilg.Call(XmlReader_Skip); 3044ilg.Else(); 3063ilg.Ldarg(0); 3064ilg.Call(XmlSerializationReader_get_Reader); 3065ilg.Call(XmlReader_get_IsEmptyElement); 3066ilg.If(); 3073ilg.Ldarg(0); 3074ilg.Call(XmlSerializationReader_get_Reader); 3075ilg.Call(XmlReader_Skip); 3076LocalBuilder tmpLoc = ilg.GetTempLocal(element.Mapping.TypeDesc!.Type); 3077ilg.Ldloca(tmpLoc); 3078ilg.InitObj(element.Mapping.TypeDesc!.Type); 3079ilg.Ldloc(tmpLoc); 3081ilg.Else(); 3085ilg.EndIf(); 3097ilg.Ldarg(0); 3098ilg.Call(XmlSerializationReader_ReadElementQualifiedName); 3120ilg.EndIf(); 3143ilg.Ldloc(arrayName!); 3144ilg.Load(null); 3145ilg.If(Cmp.EqualTo); 3146ilg.Ldarg(0); 3147ilg.Call(XmlSerializationReader_get_Reader); 3148ilg.Call(XmlReader_Skip); 3149ilg.Else(); 3153ilg.Ldarg(0); 3156ilg.Load(element.IsNullable); 3159ilg.Ldc(true); 3167ilg.Call(methodBuilder); 3171ilg.EndIf(); 3185ilg.Ldarg(0); 3186ilg.Ldc(element.Any ? false : true); 3187ilg.Call(XmlSerializationReader_ReadXmlXXX); 3190ilg.Castclass(special.TypeDesc.Type!); 3203Label labelTrue = ilg.DefineLabel(); 3204Label labelEnd = ilg.DefineLabel(); 3205LocalBuilder tserLoc = ilg.DeclareOrGetLocal(typeof(XmlQualifiedName), "tser"); 3206ilg.Ldarg(0); 3207ilg.Call(XmlSerializationReader_GetXsiType); 3208ilg.Stloc(tserLoc); 3209ilg.Ldloc(tserLoc); 3210ilg.Load(null); 3211ilg.Ceq(); 3212ilg.Brtrue(labelTrue); 3215ilg.Br_S(labelEnd); 3216ilg.MarkLabel(labelTrue); 3217ilg.Ldc(true); 3218ilg.MarkLabel(labelEnd); 3219ilg.If(); 3228ilg.Ldarg(0); 3229ReflectionAwareILGen.ILGenForCreateInstance(ilg, sm.TypeDesc!.Type!, sm.TypeDesc.CannotNew, false); 3231ilg.ConvertValue(typeof(object), typeof(IXmlSerializable)); 3233ilg.Ldc(true); 3234ilg.Call(XmlSerializationReader_ReadSerializable); 3237ilg.ConvertValue(typeof(IXmlSerializable), sm.TypeDesc.Type!); 3262ReflectionAwareILGen.ILGenForEnumMember(ilg, choice.Mapping!.TypeDesc!.Type!, choice.MemberIds[elementIndex]); 3273Label labelTrue = ilg.DefineLabel(); 3274Label labelEnd = ilg.DefineLabel(); 3275LocalBuilder tserLoc = ilg.GetLocal("tser"); 3276ilg.InitElseIf(); 3277ilg.Ldloc(tserLoc); 3278ilg.Load(null); 3279ilg.Ceq(); 3280ilg.Brtrue(labelTrue); 3283ilg.Br_S(labelEnd); 3284ilg.MarkLabel(labelTrue); 3285ilg.Ldc(true); 3286ilg.MarkLabel(labelEnd); 3287ilg.AndIf(); 3299ilg.Ldarg(0); 3300ReflectionAwareILGen.ILGenForCreateInstance(ilg, derived.TypeDesc!.Type!, derived.TypeDesc.CannotNew, false); 3302ilg.ConvertValue(typeof(object), typeof(IXmlSerializable)); 3304ilg.Ldc(true); 3305ilg.Call(XmlSerializationReader_ReadSerializable); 3308ilg.ConvertValue(typeof(IXmlSerializable), head.TypeDesc.Type!); 3318ilg.Ldarg(0); 3319ilg.Ldstr(GetCSharpString(derived.XsiType.Name)); 3320ilg.Ldstr(GetCSharpString(derived.XsiType.Namespace)); 3321ilg.Ldstr(GetCSharpString(head.XsiType!.Name)); 3322ilg.Ldstr(GetCSharpString(head.XsiType.Namespace)); 3323ilg.Ldstr(GetCSharpString(derived.Type.FullName)); 3324ilg.Ldstr(GetCSharpString(head.Type.FullName)); 3325ilg.Call(XmlSerializationReader_CreateBadDerivationException); 3326ilg.Throw(); 3336ilg.Ldarg(0); 3337ilg.Ldstr(GetCSharpString(derived.XsiType.Name)); 3338ilg.Ldstr(GetCSharpString(derived.XsiType.Namespace)); 3339ilg.Ldstr(GetCSharpString(head.Type!.FullName)); 3340ilg.Call(XmlSerializationReader_CreateMissingIXmlSerializableType); 3341ilg.Throw(); 3361ilg.Ldarg(0); 3362ilg.Call(XmlSerializationReader_get_Reader); 3363ilg.Call(XmlReader_MoveToContent); 3364ilg.Pop(); 3365ilg.WhileBegin(); 3370ilg.WhileBeginCondition(); 3386Label labelFalse = ilg.DefineLabel(); 3387Label labelEnd = ilg.DefineLabel(); 3388ilg.Ldarg(0); 3389ilg.Call(XmlSerializationReader_get_Reader); 3390ilg.Call(XmlReader_get_NodeType); 3391ilg.Ldc(XmlNodeType_EndElement); 3392ilg.Beq(labelFalse); 3393ilg.Ldarg(0); 3394ilg.Call(XmlSerializationReader_get_Reader); 3395ilg.Call(XmlReader_get_NodeType); 3396ilg.Ldc(XmlNodeType_None); 3397ilg.Cne(); 3398ilg.Br_S(labelEnd); 3399ilg.MarkLabel(labelFalse); 3400ilg.Ldc(false); 3401ilg.MarkLabel(labelEnd); 3403ilg.WhileEndCondition(); 3404ilg.WhileEnd(); 3415LocalBuilder paramsRead = ilg.DeclareLocal(typeof(Span<bool>), "paramsRead"); 3418ilg.StackallocSpan(typeof(bool), length); 3422ilg.NewArray(typeof(bool), length); 3423ilg.New(typeof(Span<bool>).GetConstructor(new[] { typeof(bool[]) })!); 3425ilg.Stloc(paramsRead); 3433LocalBuilder loc = ilg.DeclareLocal( 3439ilg.BeginExceptionBlock(); 3441ReflectionAwareILGen.ILGenForCreateInstance(ilg, mapping.TypeDesc.Type!, mapping.TypeDesc.CannotNew, true); 3442ilg.Stloc(loc); 3445ilg.Leave(); 3452ilg.Ldarg(0); 3453ilg.Ldstr(GetCSharpString(fullTypeName)); 3454ilg.Call(XmlSerializationReader_CreateInaccessibleConstructorException); 3455ilg.Throw(); 3463ilg.Ldarg(0); 3464ilg.Ldstr(GetCSharpString(fullTypeName)); 3465ilg.Call(XmlSerializationReader_CreateCtorHasSecurityException); 3466ilg.Throw(); 3468ilg.EndExceptionBlock(); 3474ilg.BeginCatchBlock(exceptionType); 3475ilg.Pop(); 3480ReflectionAwareILGen.WriteArrayLocalDecl(typeName, variableName, new SourceInfo(initValue, initValue, null, arrayTypeDesc.Type, ilg), arrayTypeDesc); 3485ReflectionAwareILGen.WriteCreateInstance(source, ctorInaccessible, type, ilg); 3524ilg.Ldarg(0); 3525ilg.Load(null); 3526ilg.Ldstr(match.Groups["qnames"].Value); 3527ilg.Call(XmlSerializationReader_UnknownNode2); 3534ilg.Ldarg(0); 3535LocalBuilder localO = ilg.GetLocal(match.Groups["o"].Value); 3536ilg.Ldloc(localO); 3537ilg.ConvertValue(localO.LocalType, typeof(object)); 3538ilg.Ldstr(match.Groups["qnames"].Value); 3539ilg.Call(XmlSerializationReader_UnknownNode2); 3546ilg.Ldarg(0); 3547LocalBuilder localO = ilg.GetLocal(match.Groups["o"].Value); 3548ilg.Ldloc(localO); 3549ilg.ConvertValue(localO.LocalType, typeof(object)); 3550ilg.Load(null); 3551ilg.Call(XmlSerializationReader_UnknownNode2); 3558ilg.Ldarg(0); 3559LocalBuilder localO = ilg.GetLocal(match.Groups["o"].Value); 3560ilg.Ldloc(localO); 3561ilg.ConvertValue(localO.LocalType, typeof(object)); 3562ilg.Call(XmlSerializationReader_UnknownNode1); 3572ilg.Ldloca(ilg.GetLocal("paramsRead")); 3573ilg.Ldc(int.Parse(match.Groups["index"].Value, CultureInfo.InvariantCulture)); 3574ilg.Call(typeof(Span<bool>).GetMethod("get_Item")!); 3575ilg.LdindU1(); 3585ilg.Ldloca(ilg.GetLocal("paramsRead")); 3586ilg.Ldc(int.Parse(match.Groups["index"].Value, CultureInfo.InvariantCulture)); 3587ilg.Call(typeof(Span<bool>).GetMethod("get_Item")!); 3588ilg.Ldc(value); 3589ilg.StindI1(); 3603ilg.Ldarg(0); 3604ilg.Call(XmlSerializationReader_CreateUnknownNodeException); 3605ilg.Throw(); 3619ilg.Load(value);
System\Xml\Serialization\XmlSerializationWriterILGen.cs (588)
89ilg.BeginMethod(typeof(void), "InitCallbacks", Type.EmptyTypes, Array.Empty<string>(), 91ilg.EndMethod(); 102ilg.Ldarg(0); 103ilg.Ldstr(GetCSharpString(name)); 107ilg.Ldstr(GetCSharpString(ns)); 118ilg.Call(XmlSerializationWriter_WriteXXX); 137ilg.Ldarg(0); 139ilg.Call(methodBuilder); 167ilg.Call(XmlConvert_ToString); 177ilg.Ldarg(0); 185ilg.Call(FromXXX); 222ilg.Ldc(Enum.Parse(mapping.TypeDesc.Type!, enumDefaultValue!, false)); 223ilg.If(Cmp.NotEqualTo); // " != " 231ilg.Ldarg(0); 233ilg.Ldstr(GetCSharpString(name)); 237ilg.Ldstr(GetCSharpString(ns)); 259ilg.Ldstr(GetCSharpString(mapping.TypeName)); 260ilg.Ldstr(GetCSharpString(mapping.Namespace)); 261ilg.New(XmlQualifiedName_ctor); 269ilg.Call(XmlSerializationWriter_method); 273ilg.EndIf(); 284ilg.Ldarg(0); 285ilg.Ldstr(GetCSharpString(name)); 286ilg.Ldstr(GetCSharpString(ns)); 287ilg.Call(XmlSerializationWriter_Method); 297ilg.Ldarg(0); 298ilg.Ldstr(GetCSharpString(name)); 299ilg.Ldstr(GetCSharpString(ns)); 300ilg.Load(null); 301ilg.Ldc(writePrefixed); 302ilg.Call(XmlSerializationWriter_Method); 317ilg.Ldarg(0); 318ilg.Call(XmlSerializationWriter_WriteEndElement); 327object oVar = ilg.GetVariable(source); 328ilg.Ldarg(0); 329ilg.Load(oVar); 330ilg.ConvertValue(CodeGenerator.GetVariableType(oVar), typeof(object)); 331ilg.Call(XmlSerializationWriter_WriteEndElement); 357ilg.BeginMethod( 370ilg.Ldarg(0); 371ilg.Call(XmlSerializationWriter_WriteStartDocument); 378ilg.Ldarg(0); 379ilg.Call(XmlSerializationWriter_TopLevelElement); 384LocalBuilder pLengthLoc = ilg.DeclareLocal(typeof(int), "pLength"); 385ilg.Ldarg("p"); 386ilg.Ldlen(); 387ilg.Stloc(pLengthLoc); 398ilg.Ldloc(pLengthLoc); 399ilg.Ldc(xmlnsMember); 400ilg.If(Cmp.GreaterThan); 402ilg.EndIf(); 411SourceInfo source = new SourceInfo($"p[{i}]", null, null, pLengthLoc.LocalType.GetElementType()!, ilg); 422specifiedSource = new SourceInfo($"((bool)p[{j}])", null, null, typeof(bool), ilg); 429ilg.Ldloc(pLengthLoc); 430ilg.Ldc(i); 431ilg.If(Cmp.GreaterThan); 435Label labelTrue = ilg.DefineLabel(); 436Label labelEnd = ilg.DefineLabel(); 437ilg.Ldloc(pLengthLoc); 438ilg.Ldc(specifiedPosition); 439ilg.Ble(labelTrue); 441ilg.Br_S(labelEnd); 442ilg.MarkLabel(labelTrue); 443ilg.Ldc(true); 444ilg.MarkLabel(labelEnd); 445ilg.If(); 452ilg.EndIf(); 455ilg.EndIf(); 478specifiedSource = new SourceInfo($"((bool)p[{j}])", null, null, typeof(bool), ilg); 485ilg.Ldloc(pLengthLoc); 486ilg.Ldc(i); 487ilg.If(Cmp.GreaterThan); 491Label labelTrue = ilg.DefineLabel(); 492Label labelEnd = ilg.DefineLabel(); 493ilg.Ldloc(pLengthLoc); 494ilg.Ldc(specifiedPosition); 495ilg.Ble(labelTrue); 497ilg.Br_S(labelEnd); 498ilg.MarkLabel(labelTrue); 499ilg.Ldc(true); 500ilg.MarkLabel(labelEnd); 501ilg.If(); 524WriteMember(new SourceInfo(source, source, null, null, ilg), enumSource, member.ElementsSortedByDerivation!, member.Text, member.ChoiceIdentifier, member.TypeDesc!, writeAccessors || hasWrapperElement); 528ilg.EndIf(); 531ilg.EndIf(); 538ilg.EndMethod(); 548ilg.BeginMethod( 561ilg.Ldarg(0); 562ilg.Call(XmlSerializationWriter_WriteStartDocument); 564ilg.If(ilg.GetArg("o"), Cmp.EqualTo, null); 571ilg.GotoMethodEnd(); 572ilg.EndIf(); 581ilg.Ldarg(0); 582ilg.Call(XmlSerializationWriter_TopLevelElement); 585WriteMember(new SourceInfo("o", "o", null, typeof(object), ilg), null, new ElementAccessor[] { element }, null, null, mapping.TypeDesc, true); 587ilg.EndMethod(); 605ilg.BeginMethod( 611LocalBuilder sLoc = ilg.DeclareLocal(typeof(string), "s"); 612ilg.Load(null); 613ilg.Stloc(sLoc); 621Label defaultLabel = ilg.DefineLabel(); 622Label endSwitchLabel = ilg.DefineLabel(); 624LocalBuilder localTmp = ilg.DeclareLocal(mapping.TypeDesc.Type!, "localTmp"); 625ilg.Ldarg("v"); 626ilg.Stloc(localTmp); 632Label caseLabel = ilg.DefineLabel(); 633ilg.Ldloc(localTmp); 634ilg.Ldc(Enum.ToObject(mapping.TypeDesc.Type!, c.Value)); 635ilg.Beq(caseLabel); 644ilg.Br(defaultLabel); 647ilg.MarkLabel(caseLabels[i]); 648ilg.Ldc(retValues[i]); 649ilg.Stloc(sLoc); 650ilg.Br(endSwitchLabel); 652ilg.MarkLabel(defaultLabel); 653ReflectionAwareILGen.ILGenForEnumLongValue(ilg, "v"); 654LocalBuilder strArray = ilg.DeclareLocal(typeof(string[]), "strArray"); 655ilg.NewArray(typeof(string), constants.Length); 656ilg.Stloc(strArray); 660ilg.Ldloc(strArray); 661ilg.Ldc(i); 662ilg.Ldstr(GetCSharpString(c.XmlName)); 663ilg.Stelem(typeof(string)); 665ilg.Ldloc(strArray); 666LocalBuilder longArray = ilg.DeclareLocal(typeof(long[]), "longArray"); 667ilg.NewArray(typeof(long), constants.Length); 668ilg.Stloc(longArray); 673ilg.Ldloc(longArray); 674ilg.Ldc(i); 675ilg.Ldc(c.Value); 676ilg.Stelem(typeof(long)); 678ilg.Ldloc(longArray); 679ilg.Ldstr(GetCSharpString(mapping.TypeDesc.FullName)); 685ilg.Call(XmlSerializationWriter_FromEnum); 686ilg.Stloc(sLoc); 687ilg.Br(endSwitchLabel); 691ilg.Br(defaultLabel); 695ilg.MarkLabel(caseLabels[i]); 696ilg.Ldc(retValues[i]); 697ilg.Stloc(sLoc); 698ilg.Br(endSwitchLabel); 716ilg.MarkLabel(defaultLabel); 717ilg.Ldarg(0); 718ilg.Ldarg("v"); 719ilg.ConvertValue(mapping.TypeDesc.Type!, typeof(long)); 720LocalBuilder numLoc = ilg.DeclareLocal(typeof(long), "num"); 721ilg.Stloc(numLoc); 723ilg.LdlocAddress(numLoc); 724ilg.Call(CultureInfo_get_InvariantCulture); 725ilg.Call(Int64_ToString); 726ilg.Ldstr(GetCSharpString(mapping.TypeDesc.FullName)); 727ilg.Call(XmlSerializationWriter_CreateInvalidEnumValueException); 728ilg.Throw(); 730ilg.MarkLabel(endSwitchLabel); 732ilg.Ldloc(sLoc); 733ilg.EndMethod(); 740ilg.InitElseIf(); 742ilg.AndIf(); 752ilg.Ldarg(0); 754ilg.Ldarg("n"); 756ilg.Ldarg("ns"); 757object oVar = ilg.GetVariable("o"); 759ilg.Load(oVar); 760ilg.ConvertValue(oType, derived.TypeDesc.Type!); 765ilg.Ldarg("isNullable"); 768ilg.Ldc(true); 774ilg.Call(methodBuilder); 775ilg.GotoMethodEnd(); 790ilg.InitElseIf(); 793ilg.AndIf(); 811ilg.Ldarg(0); 812ilg.Call(XmlSerializationWriter_get_Writer); 813ilg.Ldarg("n"); 814ilg.Ldarg("ns"); 815ilg.Call(XmlWriter_WriteStartElement); 821ilg.Ldarg(0); 822ilg.Ldstr(GetCSharpString(mapping.TypeName)); 823ilg.Ldstr(GetCSharpString(mapping.Namespace)); 824ilg.Call(XmlSerializationWriter_WriteXsiType); 836ilg.Ldarg(0); 837ilg.Call(XmlSerializationWriter_get_Writer); 838object oVar = ilg.GetVariable("o"); 839ilg.Ldarg(0); 840ilg.Load(oVar); 841ilg.ConvertValue(CodeGenerator.GetVariableType(oVar), mapping.TypeDesc.Type!); 842ilg.Call(methodBuilder); 843ilg.Call(XmlWriter_WriteString); 849ilg.Ldarg(0); 850ilg.Call(XmlSerializationWriter_get_Writer); 851ilg.Call(XmlWriter_WriteEndElement); 852ilg.GotoMethodEnd(); 858ilg.InitElseIf(); 864ilg.AndIf(); 865ilg.EnterScope(); 877ilg.Ldarg(0); 878ilg.Call(XmlSerializationWriter_get_Writer); 879ilg.Ldarg("n"); 880ilg.Ldarg("ns"); 881ilg.Call(XmlWriter_WriteStartElement); 887ilg.Ldarg(0); 888ilg.Ldstr(GetCSharpString(mapping.TypeName)); 889ilg.Ldstr(GetCSharpString(mapping.Namespace)); 890ilg.Call(XmlSerializationWriter_WriteXsiType); 892WriteMember(new SourceInfo("o", "o", null, null, ilg), null, mapping.ElementsSortedByDerivation!, null, null, mapping.TypeDesc, true); 899ilg.Ldarg(0); 900ilg.Call(XmlSerializationWriter_get_Writer); 901ilg.Call(XmlWriter_WriteEndElement); 902ilg.GotoMethodEnd(); 903ilg.ExitScope(); 930ilg.BeginMethod(typeof(void), 937ilg.If(ilg.GetArg("o"), Cmp.EqualTo, null); 939ilg.If(ilg.GetArg("isNullable"), Cmp.EqualTo, true); 946ilg.Ldarg(0); 947ilg.Ldarg("n"); 948ilg.Ldarg("ns"); 949ilg.Call(XmlSerializationWriter_WriteNullTagLiteral); 951ilg.EndIf(); 952ilg.GotoMethodEnd(); 954ilg.EndIf(); 956ilg.If(ilg.GetArg("needType"), Cmp.NotEqualTo, true); // if (!needType) 958LocalBuilder tLoc = ilg.DeclareLocal(typeof(Type), "t"); 964ArgBuilder oArg = ilg.GetArg("o"); 965ilg.LdargAddress(oArg); 966ilg.ConvertAddress(oArg.ArgType, typeof(object)); 967ilg.Call(Object_GetType); 968ilg.Stloc(tLoc); 971ilg.If(); // if (t == typeof(...)) 975ilg.Else(); 983ilg.Ldarg(0); 984ilg.Ldarg("n"); 985ilg.Ldarg("ns"); 986ilg.Ldarg("o"); 987ilg.Ldc(true); 988ilg.Call(XmlSerializationWriter_WriteTypedPrimitive); 989ilg.GotoMethodEnd(); 998ilg.Ldarg(0); 999ilg.Ldarg(oArg); 1000ilg.ConvertValue(oArg.ArgType, typeof(object)); 1001ilg.Call(XmlSerializationWriter_CreateUnknownTypeException); 1002ilg.Throw(); 1004ilg.EndIf(); // if (t == typeof(...)) 1005ilg.EndIf(); // if (!needType) 1016ilg.Ldarg(0); 1017ilg.Ldc(false); 1018ilg.Call(XmlSerializationWriter_set_EscapeName); 1031ilg.Ldarg(0); 1032ilg.Ldarg("n"); 1033ilg.Ldarg("ns"); 1034ArgBuilder argO = ilg.GetArg("o"); 1035ilg.Ldarg(argO); 1036ilg.ConvertValue(argO.ArgType, typeof(object)); 1037ilg.Ldc(false); 1039ilg.Load(null); 1051ilg.Call(XmlSerializationWriter_WriteStartElement); 1054ilg.If(ilg.GetArg("needType"), Cmp.EqualTo, true); 1061ilg.Ldarg(0); 1062ilg.Ldstr(GetCSharpString(mapping.TypeName)); 1063ilg.Ldstr(GetCSharpString(mapping.Namespace)); 1064ilg.Call(XmlSerializationWriter_WriteXsiType); 1066ilg.EndIf(); 1076ilg.LdargAddress(oArg); 1077ilg.Call(m.CheckShouldPersistMethodInfo!); 1078ilg.If(); 1084ilg.If(); 1086WriteMember(ReflectionAwareILGen.GetSourceForMember("o", m, ilg), m.Attribute, m.TypeDesc!, "o"); 1090ilg.EndIf(); 1094ilg.EndIf(); 1109ilg.LdargAddress(oArg); 1110ilg.Call(m.CheckShouldPersistMethodInfo!); 1111ilg.If(); 1117ilg.If(); 1127WriteMember(ReflectionAwareILGen.GetSourceForMember("o", m, m.MemberInfo, ilg), choiceSource, m.ElementsSortedByDerivation!, m.Text, m.ChoiceIdentifier, m.TypeDesc!, true); 1131ilg.EndIf(); 1135ilg.EndIf(); 1140ilg.EndMethod(); 1161ilg.EnterScope(); 1165ilg.Ldloc(memberTypeDesc.Type!, aVar); 1166ilg.Load(null); 1167ilg.If(Cmp.NotEqualTo); 1184ilg.Ldarg(0); 1185ilg.Call(XmlSerializationWriter_get_Writer); 1186ilg.Load(null); 1187ilg.Ldstr(GetCSharpString(attribute.Name)); 1188ilg.Ldstr(GetCSharpString(ns)); 1189ilg.Call(XmlWriter_WriteStartAttribute); 1193LocalBuilder sbLoc = ilg.DeclareOrGetLocal(typeof(StringBuilder), "sb"); 1198ilg.New(StringBuilder_ctor); 1199ilg.Stloc(sbLoc); 1210LocalBuilder localI = ilg.DeclareOrGetLocal(typeof(int), iVar); 1211ilg.For(localI, 0, ilg.GetLocal(aVar)); 1222ilg.Ldloc(iVar); 1223ilg.Ldc(0); 1224ilg.If(Cmp.NotEqualTo); 1235ilg.Ldarg(0); 1236ilg.Call(XmlSerializationWriter_get_Writer); 1237ilg.Ldstr(" "); 1238ilg.Call(XmlWriter_WriteString); 1239ilg.EndIf(); 1240ilg.Ldarg(0); 1251ilg.Ldloc(iVar); 1252ilg.Ldc(0); 1253ilg.If(Cmp.NotEqualTo); 1254ilg.Ldloc("sb"); 1255ilg.Ldstr(" "); 1256ilg.Call(StringBuilder_Append); 1257ilg.Pop(); 1258ilg.EndIf(); 1259ilg.Ldloc("sb"); 1264WriteEnumValue((EnumMapping)attribute.Mapping, new SourceInfo(aiVar, aiVar, null, arrayElementTypeDesc.Type, ilg), out argType); 1266WritePrimitiveValue(arrayElementTypeDesc, new SourceInfo(aiVar, aiVar, null, arrayElementTypeDesc.Type, ilg), out argType); 1272ilg.Call(method); 1274ilg.Pop(); 1278WriteAttribute(new SourceInfo(aiVar, aiVar, null, null, ilg), attribute, parent); 1283ilg.EndFor(); 1299ilg.Ldarg(0); 1300ilg.Call(XmlSerializationWriter_get_Writer); 1301ilg.Call(XmlWriter_WriteEndAttribute); 1310ilg.Ldloc("sb"); 1311ilg.Call(StringBuilder_get_Length); 1312ilg.Ldc(0); 1313ilg.If(Cmp.NotEqualTo); 1316ilg.Ldarg(0); 1317ilg.Ldstr(GetCSharpString(attribute.Name)); 1322ilg.Ldstr(GetCSharpString(ns)); 1330ilg.Ldloc("sb"); 1331ilg.Call(Object_ToString); 1338ilg.Call(XmlSerializationWriter_WriteAttribute); 1339ilg.EndIf(); 1345ilg.EndIf(); 1348ilg.ExitScope(); 1368ilg.Ldarg(0); 1369ilg.Ldloc(source.Source); 1370ilg.Ldarg(parent); 1371ilg.ConvertValue(ilg.GetArg(parent).ArgType, typeof(object)); 1372ilg.Call(XmlSerializationWriter_WriteXmlAttribute); 1419ilg.EnterScope(); 1421LocalBuilder aLoc = ilg.GetLocal(aName); 1424ilg.Ldloc(aLoc); 1425ilg.Load(null); 1426ilg.If(Cmp.NotEqualTo); 1433SourceInfo choiceSourceInfo = new SourceInfo(choiceSource!, null, choice.MemberInfo, null, ilg); 1437Label labelEnd = ilg.DefineLabel(); 1438Label labelTrue = ilg.DefineLabel(); 1439LocalBuilder cLoc = ilg.GetLocal(cName); 1440ilg.Ldloc(cLoc); 1441ilg.Load(null); 1442ilg.Beq(labelTrue); 1443ilg.Ldloc(cLoc); 1444ilg.Ldlen(); 1445ilg.Ldloc(aLoc); 1446ilg.Ldlen(); 1447ilg.Clt(); 1448ilg.Br(labelEnd); 1449ilg.MarkLabel(labelTrue); 1450ilg.Ldc(true); 1451ilg.MarkLabel(labelEnd); 1452ilg.If(); 1458ilg.Ldarg(0); 1459ilg.Ldstr(GetCSharpString(choice.Mapping.TypeDesc.FullName)); 1460ilg.Ldstr(GetCSharpString(choice.MemberName)); 1461ilg.Call(XmlSerializationWriter_CreateInvalidChoiceIdentifierValueException); 1462ilg.Throw(); 1463ilg.EndIf(); 1469ilg.EndIf(); 1472ilg.ExitScope(); 1481LocalBuilder eLoc = ilg.DeclareLocal(typeof(IEnumerator), "e"); 1482ilg.LoadAddress(ilg.GetVariable(arrayName)); 1494ilg.ConvertValue(arrayTypeDesc.Type!, typeIEnumerable); 1505ilg.ConvertValue(arrayTypeDesc.Type!, typeIEnumerable); 1513ilg.Call(getEnumeratorMethod); 1514ilg.ConvertValue(getEnumeratorMethod.ReturnType, typeof(IEnumerator)); 1515ilg.Stloc(eLoc); 1517ilg.Ldloc(eLoc); 1518ilg.Load(null); 1519ilg.If(Cmp.NotEqualTo); 1520ilg.WhileBegin(); 1524WriteElements(new SourceInfo(arrayNamePlusI, null, null, arrayElementTypeDesc.Type, ilg), $"{choiceName}i", elements, text, choice, arrayNamePlusA, true, true); 1526ilg.WhileBeginCondition(); // while (e.MoveNext()) 1531ilg.Ldloc(eLoc); 1532ilg.Call(IEnumerator_MoveNext); 1533ilg.WhileEndCondition(); 1534ilg.WhileEnd(); 1536ilg.EndIf(); // if (e != null) 1544LocalBuilder localI = ilg.DeclareOrGetLocal(typeof(int), iPlusArrayName); 1545ilg.For(localI, 0, ilg.GetLocal(arrayName)); 1554WriteElements(new SourceInfo(arrayNamePlusI, null, null, arrayElementTypeDesc.Type, ilg), $"{choiceName}i", elements, text, choice, arrayNamePlusA, true, arrayElementTypeDesc.IsNullable); 1558WriteElements(new SourceInfo(ReflectionAwareILGen.GetStringForArrayMember(arrayName, iPlusArrayName), null, null, arrayElementTypeDesc.Type, ilg), null, elements, text, choice, arrayNamePlusA, true, arrayElementTypeDesc.IsNullable); 1560ilg.EndFor(); 1580ilg.Load(null); 1581ilg.If(Cmp.NotEqualTo); 1611if (wroteFirstIf) ilg.InitElseIf(); 1612else { wroteFirstIf = true; ilg.InitIf(); } 1614ilg.Load(enumValue); 1615ilg.Ceq(); 1618Label labelFalse = ilg.DefineLabel(); 1619Label labelEnd = ilg.DefineLabel(); 1620ilg.Brfalse(labelFalse); 1622ilg.Load(null); 1623ilg.Cne(); 1624ilg.Br_S(labelEnd); 1625ilg.MarkLabel(labelFalse); 1626ilg.Ldc(false); 1627ilg.MarkLabel(labelEnd); 1629ilg.AndIf(); 1639if (wroteFirstIf) ilg.InitElseIf(); 1640else { wroteFirstIf = true; ilg.InitIf(); } 1643ilg.AndIf(); 1656else ilg.EndIf(); 1661if (elements.Length - anyCount > 0) ilg.InitElseIf(); 1662else ilg.InitIf(); 1665ilg.IsInst(typeof(XmlElement)); 1666ilg.Load(null); 1667ilg.Cne(); 1668ilg.AndIf(); 1670LocalBuilder elemLoc = ilg.DeclareLocal(typeof(XmlElement), "elem"); 1672ilg.Stloc(elemLoc); 1678if (c++ > 0) ilg.InitElseIf(); 1679else ilg.InitIf(); 1688labelFalse = ilg.DefineLabel(); 1689labelEnd = ilg.DefineLabel(); 1691ilg.Load(enumValue); 1692ilg.Bne(labelFalse); 1696ilg.Load(null); 1697ilg.Cne(); 1701ilg.Ldc(true); 1703ilg.Br(labelEnd); 1704ilg.MarkLabel(labelFalse); 1705ilg.Ldc(false); 1706ilg.MarkLabel(labelEnd); 1707ilg.AndIf(); 1709labelFalse = ilg.DefineLabel(); 1710labelEnd = ilg.DefineLabel(); 1721ilg.Ldloc(elemLoc); 1722ilg.Call(XmlNode_get_Name); 1723ilg.Ldstr(GetCSharpString(element.Name)); 1729ilg.Call(String_op_Equality); 1730ilg.Brfalse(labelFalse); 1731ilg.Ldloc(elemLoc); 1732ilg.Call(XmlNode_get_NamespaceURI); 1733ilg.Ldstr(GetCSharpString(element.Namespace)); 1734ilg.Call(String_op_Equality); 1735ilg.Br(labelEnd); 1736ilg.MarkLabel(labelFalse); 1737ilg.Ldc(false); 1738ilg.MarkLabel(labelEnd); 1739if (choice != null) ilg.If(); 1740else ilg.AndIf(); 1741WriteElement(new SourceInfo("elem", null, null, elemLoc.LocalType, ilg), element, arrayName, writeAccessors); 1745ilg.Else(); 1752ilg.Ldarg(0); 1753ilg.Ldstr(GetCSharpString(enumFullName)); 1754ilg.Ldstr(GetCSharpString(choice.MemberName)); 1755ilg.Ldloc(elemLoc); 1756ilg.Call(XmlNode_get_Name); 1757ilg.Ldloc(elemLoc); 1758ilg.Call(XmlNode_get_NamespaceURI); 1759ilg.Call(XmlSerializationWriter_CreateChoiceIdentifierValueException); 1760ilg.Throw(); 1761ilg.EndIf(); 1766ilg.Else(); 1770WriteElement(new SourceInfo("elem", null, null, elemLoc.LocalType, ilg), unnamedAny, arrayName, writeAccessors); 1779ilg.Ldarg(0); 1780ilg.Ldloc(elemLoc); 1791ilg.Call(XmlNode_get_Name); 1792ilg.Ldloc(elemLoc); 1793ilg.Call(XmlNode_get_NamespaceURI); 1794ilg.Call(XmlSerializationWriter_CreateUnknownAnyElementException); 1795ilg.Throw(); 1799ilg.EndIf(); 1806ilg.InitElseIf(); 1808ilg.AndIf(); 1822ilg.InitElseIf(); 1824ilg.Load(null); 1825ilg.AndIf(Cmp.NotEqualTo); 1829ilg.Else(); 1836ilg.Ldarg(0); 1838ilg.Call(XmlSerializationWriter_CreateUnknownTypeException); 1839ilg.Throw(); 1841ilg.EndIf(); 1845ilg.EndIf(); 1854ilg.Ldarg(0); 1868ilg.Call(XmlSerializationWriter_WriteValue); 1886ilg.Ldarg(0); 1887ilg.Call(XmlSerializationWriter_get_Writer); 1888ilg.Call(WriteTo); 1910ilg.Call(Nullable_get_HasValue); 1915ilg.Load(null); 1916ilg.Cne(); 1918ilg.If(); 1925ilg.Else(); 1928ilg.EndIf(); 1938ilg.EnterScope(); 1949ilg.Ldloc(ilg.GetLocal(arrayName)); 1950ilg.Load(null); 1951ilg.If(Cmp.NotEqualTo); 1959ilg.EndIf(); 1965ilg.EndIf(); 1968ilg.ExitScope(); 1997ilg.Ldarg(0); 1998ilg.Ldstr(GetCSharpString(name)); 2000ilg.Ldstr(GetCSharpString(ns)); 2006ilg.Ldc(element.IsNullable); 2009ilg.Ldc(false); 2016ilg.Call(methodBuilder); 2027Label ifLabel1 = ilg.DefineLabel(); 2028Label ifLabel2 = ilg.DefineLabel(); 2030ilg.IsInst(typeof(XmlNode)); 2031ilg.Brtrue(ifLabel1); 2033ilg.Load(null); 2034ilg.Ceq(); 2035ilg.Br(ifLabel2); 2036ilg.MarkLabel(ifLabel1); 2037ilg.Ldc(true); 2038ilg.MarkLabel(ifLabel2); 2039ilg.If(); 2043ilg.Else(); 2050ilg.Ldarg(0); 2052ilg.Call(XmlSerializationWriter_CreateInvalidAnyTypeException); 2053ilg.Throw(); 2055ilg.EndIf(); 2071ilg.Ldarg(0); 2073ilg.Ldstr(GetCSharpString(name)); 2074ilg.Ldstr(GetCSharpString(ns)); 2075ilg.Ldc(isNullable); 2076ilg.Ldc(isAny); 2077ilg.Call(XmlSerializationWriter_func); 2085Label labelEnd = ilg.DefineLabel(); 2086Label labelFalse = ilg.DefineLabel(); 2087Label labelTrue = ilg.DefineLabel(); 2091ilg.Brfalse(labelTrue); 2094ilg.Brfalse(labelFalse); 2101ilg.Call(String_get_Length); 2102ilg.Ldc(0); 2103ilg.Cne(); 2104ilg.Br(labelEnd); 2107ilg.MarkLabel(labelTrue); 2108ilg.Ldc(true); 2112ilg.MarkLabel(labelFalse); 2113ilg.Ldc(false); 2115ilg.MarkLabel(labelEnd); 2116ilg.If(); 2123ilg.Load(null); 2124ilg.Cne(); 2129ilg.Ldc(Convert.ChangeType(value, source.Type!, CultureInfo.InvariantCulture)); 2130ilg.Cne(); 2136ilg.Ldc(value is string ? GetCSharpString((string)value) : value); 2143ilg.Call(op_Inequality); 2145ilg.Cne(); 2147ilg.If(); 2153Label labelFalse = ilg.DefineLabel(); 2154Label labelEnd = ilg.DefineLabel(); 2156ilg.Load(null); 2157ilg.Beq(labelFalse); 2160ilg.Ldc(false); 2161ilg.Ceq(); 2162ilg.Br(labelEnd); 2163ilg.MarkLabel(labelFalse); 2164ilg.Ldc(false); 2165ilg.MarkLabel(labelEnd); 2166ilg.If(); 2172ilg.Ldarg(0); 2173ilg.Ldstr(GetCSharpString(typeDesc.FullName)); 2174ilg.Ldstr(GetCSharpString(choice.MemberName)); 2175ilg.Ldstr(GetCSharpString(enumName)); 2176ilg.Call(XmlSerializationWriter_CreateMismatchChoiceException); 2177ilg.Throw(); 2178ilg.EndIf(); 2183LocalBuilder local = ilg.GetLocal(source); 2185ilg.Load(local); 2186ilg.Load(null); 2187ilg.If(Cmp.EqualTo); 2189ilg.Else(); 2199ilg.Ldarg(0); 2201ilg.Call(XmlSerializationWriter_WriteNamespaceDeclarations); 2217ReflectionAwareILGen.WriteLocalDecl(variableName, new SourceInfo(initValue, initValue, null, type, ilg)); 2226ReflectionAwareILGen.WriteTypeCompare(variable, type, ilg); 2231ReflectionAwareILGen.WriteInstanceOf(source, type, ilg); 2235ReflectionAwareILGen.WriteArrayTypeCompare(variable, arrayType, ilg);