private void CheckOP_CALL(ClassObject current_class, int curr_level, IntegerList a, IntegerList param_mod, IntegerList pos) { FunctionObject obj10; int num35; bool flag8; int id = this.r.arg1; int n = this.n; a.Clear(); param_mod.Clear(); pos.Clear(); int num3 = 0; int avalue = this.n; while (true) { if (avalue <= 1) { this.scripter.CreateErrorObject("CS0001. Internal compiler error."); return; } if ((this[avalue].op == this.OP_BEGIN_CALL) && (this[avalue].arg1 == id)) { break; } avalue--; } this[avalue].op = this.OP_NOP; while (true) { if ((this[avalue].op == this.OP_PUSH) && (this[avalue].res == id)) { pos.Add(avalue); a.Add(this[avalue].arg1); param_mod.Add(this[avalue].arg2); if (this[avalue].arg2 > 0) { num3++; } } if (avalue == this.n) { break; } avalue++; } this.scripter.Dump(); MemberKind kind = this.symbol_table[id].Kind; if (kind == MemberKind.Type) { ClassObject val = (ClassObject) this.GetVal(id); if (val.IsDelegate) { if (a.Count == 1) { FunctionObject obj3 = this.GetFunctionObject(curr_level); this.InsertOperators(pos[0], 1); this.n++; this[pos[0]].op = this.OP_PUSH; this[pos[0]].arg1 = obj3.ThisId; this[pos[0]].arg2 = 0; this[pos[0]].res = val.Id; a.Insert(0, obj3.ThisId); } if (val.PatternMethod.Init == null) { FunctionObject patternMethod = val.PatternMethod; int last = a.Last; if (this.symbol_table[last].Kind == MemberKind.Ref) { int num6 = this.symbol_table[last].Level; int num7 = this.symbol_table[num6].TypeId; ClassObject classObjectEx = this.GetClassObjectEx(num7); int num8 = this.symbol_table[last].NameIndex; bool flag = this.GetUpcase(this.n); MemberObject memberByNameIndex = classObjectEx.GetMemberByNameIndex(num8, flag); this.ReplaceId(a.Last, memberByNameIndex.Id); a.Last = memberByNameIndex.Id; } FunctionObject g = this.GetFunctionObject(a.Last); this.CreatePatternMethod(patternMethod, g); } this[this.n].op = this.OP_SETUP_DELEGATE; this[this.n].arg1 = 0; this[this.n].arg2 = 0; this[this.n].res = 0; } else if (this.r.res > 0) { if ((a.Count == 1) && (this.GetLanguage(this.n) == CSLite_Language.Pascal)) { this.r.op = this.OP_CAST; this.r.arg2 = a[0]; this[this.n - 1].op = this.OP_NOP; this[pos[0]].op = this.OP_NOP; this.n--; } else { string str = this.symbol_table[this.r.arg1].Name; this.scripter.CreateErrorObjectEx("CS0119. '{0}' denotes a '{1}' which is not valid in the given context.", new object[] { str, "type" }); } } else { FunctionObject obj8; id = val.FindConstructorId(a, param_mod, out obj8); if (id != 0) { goto Label_17D6; } string str2 = val.Name; if (obj8 != null) { if (obj8.ParamCount == a.Count) { if ((obj8.ParamsId == 0) || (a.Count == 0)) { this.scripter.CreateErrorObjectEx("CS1502. The best overloaded method match for '{0}' has some invalid arguments.", new object[] { str2 }); return; } int num9 = a[a.Count - 1]; int num10 = this.symbol_table[num9].TypeId; if (CSLite_System.GetRank(this.symbol_table[num10].Name) != 0) { this.scripter.CreateErrorObjectEx("CS1502. The best overloaded method match for '{0}' has some invalid arguments.", new object[] { str2 }); return; } this.InsertActualArray(obj8, curr_level, pos, a); id = obj8.Id; n = this.n; goto Label_17D6; } if (a.Count < obj8.ParamCount) { if (obj8.ParamsId == 0) { this.scripter.CreateErrorObjectEx("CS1501. No overload for method '{0}' takes '{1}' arguments.", new object[] { str2, a.Count }); } else { if ((a.Count + 1) == obj8.ParamCount) { this.InsertActualArray(obj8, curr_level, pos, a); id = obj8.Id; n = this.n; goto Label_17D6; } this.scripter.CreateErrorObjectEx("CS1501. No overload for method '{0}' takes '{1}' arguments.", new object[] { str2, a.Count }); } } else { this.scripter.CreateErrorObjectEx("CS1501. No overload for method '{0}' takes '{1}' arguments.", new object[] { str2, a.Count }); } } else { this.scripter.CreateErrorObjectEx("CS0143. The type '{0}' has no constructors defined.", new object[] { val.Name }); } } return; } if (kind != MemberKind.Method) { switch (kind) { case MemberKind.Constructor: { FunctionObject obj13; int num32 = this.symbol_table[id].Level; ClassObject obj12 = this.GetClassObject(num32); id = obj12.FindConstructorId(a, param_mod, out obj13); this.r.res = 0; if (id == 0) { this.scripter.CreateErrorObjectEx("CS0143. The type '{0}' has no constructors defined.", new object[] { obj12.Name }); } goto Label_17D6; } case MemberKind.Destructor: { int num33 = this.symbol_table[id].Level; ClassObject obj14 = this.GetClassObject(num33); id = obj14.FindDestructorId(a); this.r.res = 0; if (id != 0) { goto Label_17D6; } this.scripter.CreateErrorObjectEx("CS0117. '{0}' does not contain a definition for '{1}'.", new object[] { obj14.Name, "~" + obj14.Name }); return; } } if (kind != MemberKind.Ref) { switch (kind) { case MemberKind.Var: case MemberKind.Index: { int num55 = this.symbol_table[this.r.arg1].TypeId; ClassObject obj20 = this.GetClassObject(num55); if (((kind == MemberKind.Var) && (obj20.IsArray || obj20.IsPascalArray)) && this.PascalOrBasic(this.n)) { this.ConvertCallToIndexAccess(a, pos); return; } if (((kind == MemberKind.Var) && (obj20.DefaultProperty != null)) && this.PascalOrBasic(this.n)) { this.ConvertToDefaultPropertyCall(obj20.DefaultProperty, a, pos); return; } if ((kind == MemberKind.Property) && this.PascalOrBasic(this.n)) { this.ConvertToPropertyCall(a, pos); return; } if (!obj20.IsDelegate) { if (this.PascalOrBasic(this.n)) { this.ConvertCallToIndexAccess(a, pos); } else { string str9 = this.symbol_table[this.r.arg1].Name; this.scripter.CreateErrorObjectEx("CS0118. '{0}' denotes a '{1}' where a '{2}' was expected.", new object[] { str9, "variable", "method" }); } return; } if (this.PascalOrBasic(this.n)) { this[this.n - 1].arg1 = this.r.arg1; } id = obj20.PatternMethod.Id; goto Label_17D6; } } int num56 = this.symbol_table[this.r.arg1].TypeId; ClassObject obj21 = this.GetClassObject(num56); if (((kind == MemberKind.Field) && (obj21.IsArray || obj21.IsPascalArray)) && this.PascalOrBasic(this.n)) { this.ConvertCallToIndexAccess(a, pos); return; } if (((kind == MemberKind.Field) && (obj21.DefaultProperty != null)) && this.PascalOrBasic(this.n)) { this.ConvertToDefaultPropertyCall(obj21.DefaultProperty, a, pos); return; } if ((kind == MemberKind.Property) && this.PascalOrBasic(this.n)) { this.ConvertToPropertyCall(a, pos); return; } if (!obj21.IsDelegate) { string str10 = this.symbol_table[this.r.arg1].Name; this.scripter.CreateErrorObjectEx("CS0118. '{0}' denotes a '{1}' where a '{2}' was expected.", new object[] { str10, "variable", "method" }); return; } if ((kind == MemberKind.Field) && (obj21.ImportedType != null)) { int num57 = this.symbol_table[this.r.arg1].Level; if ((this.symbol_table[num57].Kind == MemberKind.Type) && (this.GetClassObject(num57).ImportedType != null)) { this.r.op = this.OP_DYNAMIC_INVOKE; return; } } this[this.n - 1].arg1 = this.r.arg1; id = obj21.PatternMethod.Id; } else { FunctionObject obj16; int num34 = this.symbol_table[id].Level; num35 = this[this.n - 1].arg1; this[this.n - 1].arg1 = num34; int num36 = this.symbol_table[id].NameIndex; string str6 = this.symbol_table[id].Name; int num37 = this.symbol_table[num34].TypeId; if (this.symbol_table[num37].Kind != MemberKind.Type) { string str7 = this.symbol_table[num37].Name; this.scripter.CreateErrorObjectEx("CS0246. The type or namespace name '{0}' could not be found (are you missing a using directive or an assembly reference?).", new object[] { str7 }); return; } ClassObject obj15 = this.GetClassObjectEx(num37); bool flag5 = this.GetUpcase(this.n); id = obj15.FindMethodId(num36, a, param_mod, 0, out obj16, flag5); if (id == 0) { if (obj16 == null) { int num51 = this.symbol_table[this.r.arg1].TypeId; if (this.symbol_table[num51].Kind != MemberKind.Type) { this.scripter.CreateErrorObjectEx("CS0117. '{0}' does not contain a definition for '{1}'.", new object[] { obj15.Name, str6 }); return; } ClassObject obj18 = this.GetClassObject(num51); if ((obj18.IsArray || obj18.IsPascalArray) && this.PascalOrBasic(this.n)) { this.ConvertCallToIndexAccess(a, pos); return; } if ((obj18.DefaultProperty != null) && this.PascalOrBasic(this.n)) { this.ConvertToDefaultPropertyCall(obj18.DefaultProperty, a, pos); return; } if (!obj18.IsDelegate) { if (this.PascalOrBasic(this.n)) { this.ConvertCallToIndexAccess(a, pos); } else { this.scripter.CreateErrorObjectEx("CS0117. '{0}' does not contain a definition for '{1}'.", new object[] { obj15.Name, str6 }); } return; } if (obj18.ImportedType != null) { int num52 = this.symbol_table[this.r.arg1].Level; int num53 = this.symbol_table[num52].TypeId; if (this.GetClassObject(num53).ImportedType != null) { this.r.op = this.OP_DYNAMIC_INVOKE; return; } } id = obj18.PatternMethod.Id; if (!this.PascalOrBasic(this.n)) { this[this.n - 1].arg1 = num35; goto Label_17D6; } int num54 = this.n; flag8 = false; while (true) { num54--; if ((this[num54].op == this.OP_RAISE_EVENT) && (this[num54].arg1 == this.r.arg1)) { flag8 = true; goto Label_143F; } if (num54 == 1) { goto Label_143F; } } } if (obj16.ParamCount != a.Count) { if ((a.Count < obj16.ParamCount) || (obj16.ParamsId == 0)) { if (obj16.Name == "Dispose") { for (int i = 0; i < pos.Count; i++) { this[pos[i]].op = this.OP_NOP; } this[this.n - 1].op = this.OP_NOP; this[this.n].op = this.OP_NOP; } else { this.scripter.CreateErrorObjectEx("CS1501. No overload for method '{0}' takes '{1}' arguments.", new object[] { str6, a.Count }); } return; } this.InsertActualArray(obj16, curr_level, pos, a); id = obj16.Id; n = this.n; } else { bool flag6 = true; for (int j = 0; j < a.Count; j++) { int num39 = a[j]; int paramId = obj16.GetParamId(j); if (!this.scripter.MatchAssignment(paramId, num39)) { int num41 = this.symbol_table[num39].TypeId; ClassObject obj17 = this.GetClassObject(num41); int num42 = obj17.FindOverloadableImplicitOperatorId(num39, paramId); if (num42 == 0) { flag6 = false; break; } int num43 = this.n; this.n = pos[j]; int currMethodId = this.GetCurrMethodId(); int num45 = this.AppVar(currMethodId, this.symbol_table[paramId].TypeId); int res = this[this.n].res; this[this.n].arg1 = num45; this.InsertOperators(this.n, 3); this[this.n].op = this.OP_PUSH; this[this.n].arg1 = num39; this[this.n].arg2 = 0; this[this.n].res = num42; this.n++; this[this.n].op = this.OP_PUSH; this[this.n].arg1 = obj17.Id; this[this.n].arg2 = 0; this[this.n].res = 0; this.n++; this[this.n].op = this.OP_CALL_SIMPLE; this[this.n].arg1 = num42; this[this.n].arg2 = 1; this[this.n].res = num45; this.n = num43 + 3; for (int k = j + 1; k < a.Count; k++) { pos[k] += 3; } } } if (!flag6) { if ((obj16.ParamsId == 0) || (a.Count == 0)) { this.scripter.CreateErrorObjectEx("CS1502. The best overloaded method match for '{0}' has some invalid arguments.", new object[] { str6 }); return; } int num48 = a[a.Count - 1]; int num49 = this.symbol_table[num48].TypeId; if (CSLite_System.GetRank(this.symbol_table[num49].Name) != 0) { this.scripter.CreateErrorObjectEx("CS1502. The best overloaded method match for '{0}' has some invalid arguments.", new object[] { str6 }); return; } this.InsertActualArray(obj16, curr_level, pos, a); } id = obj16.Id; n = this.n; } } } goto Label_17D6; } int nameIndex = this.symbol_table[id].NameIndex; string name = this.symbol_table[id].Name; int level = this.symbol_table[id].Level; ClassObject classObject = this.GetClassObject(level); bool upcase = this.GetUpcase(this.n); Label_0646: id = classObject.FindMethodId(nameIndex, a, param_mod, 0, out obj10, upcase); if (id != 0) { goto Label_17D6; } if (obj10 == null) { this.scripter.CreateErrorObjectEx("CS0117. '{0}' does not contain a definition for '{1}'.", new object[] { classObject.Name, name }); } else if (obj10.ParamCount != a.Count) { if (a.Count < obj10.ParamCount) { int num27; int defaultParamCount = obj10.DefaultParamCount; if ((a.Count + defaultParamCount) < obj10.ParamCount) { if (obj10.ParamsId == 0) { if (((a.Count + 1) == obj10.ParamCount) && (this.GetTypeId(obj10.Param_Ids[obj10.ParamCount - 1]) == 0x10)) { int num31; if (pos.Count > 0) { num31 = pos[a.Count - 1] + 1; } else { num31 = this.n - 2; } this.InsertOperators(num31, 1); this[num31].op = this.OP_PUSH; this[num31].arg1 = this.symbol_table.NULL_id; this[num31].arg2 = 0; this[num31].res = 0; this.n++; id = obj10.Id; goto Label_0C98; } this.scripter.CreateErrorObjectEx("CS1501. No overload for method '{0}' takes '{1}' arguments.", new object[] { name, a.Count }); } else { if ((a.Count + 1) == obj10.ParamCount) { this.InsertActualArray(obj10, curr_level, pos, a); id = obj10.Id; n = this.n; goto Label_0C98; } this.scripter.CreateErrorObjectEx("CS1501. No overload for method '{0}' takes '{1}' arguments.", new object[] { name, a.Count }); } return; } int number = obj10.ParamCount - a.Count; if (pos.Count > 0) { num27 = pos[a.Count - 1] + 1; } else { num27 = this.n - 2; } ProgRec rec1 = this[this.n]; rec1.arg2 += number; this.InsertOperators(num27, number); int num28 = obj10.ParamCount - number; for (int m = 0; m < number; m++) { int num30 = obj10.Default_Ids[num28]; a.Add(num30); pos.Add(num27); param_mod.Add(obj10.Param_Mod[num28]); this[num27].op = this.OP_PUSH; this[num27].arg1 = num30; this[num27].arg2 = 0; this[num27].res = obj10.Id; num27++; this.n++; num28++; } this.r = this[this.n]; n = this.n; goto Label_0646; } this.InsertActualArray(obj10, curr_level, pos, a); id = obj10.Id; n = this.n; } else { bool flag3 = true; for (int num13 = 0; num13 < a.Count; num13++) { int num14 = a[num13]; int num15 = obj10.GetParamId(num13); if (!this.scripter.MatchAssignment(num15, num14)) { int num16 = this.symbol_table[num14].TypeId; ClassObject obj11 = this.GetClassObject(num16); int num17 = obj11.FindOverloadableImplicitOperatorId(num14, num15); if (num17 == 0) { flag3 = false; break; } int num18 = this.n; this.n = pos[num13]; int num19 = this.GetCurrMethodId(); int num20 = this.AppVar(num19, this.symbol_table[num15].TypeId); int num21 = this[this.n].res; this[this.n].arg1 = num20; this.InsertOperators(this.n, 3); this[this.n].op = this.OP_PUSH; this[this.n].arg1 = num14; this[this.n].arg2 = 0; this[this.n].res = num17; this.n++; this[this.n].op = this.OP_PUSH; this[this.n].arg1 = obj11.Id; this[this.n].arg2 = 0; this[this.n].res = 0; this.n++; this[this.n].op = this.OP_CALL_SIMPLE; this[this.n].arg1 = num17; this[this.n].arg2 = 1; this[this.n].res = num20; this.n = num18 + 3; for (int num22 = num13 + 1; num22 < a.Count; num22++) { pos[num22] += 3; } } } if (flag3) { id = obj10.Id; n = this.n; goto Label_17D6; } if ((obj10.ParamsId == 0) || (a.Count == 0)) { this.scripter.CreateErrorObjectEx("CS1502. The best overloaded method match for '{0}' has some invalid arguments.", new object[] { name }); return; } int num23 = a[a.Count - 1]; int num24 = this.symbol_table[num23].TypeId; if (CSLite_System.GetRank(this.symbol_table[num24].Name) != 0) { this.scripter.CreateErrorObjectEx("CS1502. The best overloaded method match for '{0}' has some invalid arguments.", new object[] { name }); return; } this.InsertActualArray(obj10, curr_level, pos, a); id = obj10.Id; n = this.n; } Label_0C98: if (id != 0) { goto Label_17D6; } return; Label_143F: if (flag8) { this[this.n - 1].arg1 = num35; } else { this[this.n - 1].arg1 = this.r.arg1; } Label_17D6: this.r.arg1 = id; for (avalue = 0; avalue < pos.Count; avalue++) { this[pos[avalue]].res = id; } int typeId = this.symbol_table[this.r.arg1].TypeId; if (typeId == 1) { this.r.res = 0; } else if (this.symbol_table[this.r.arg1].Name != "get_Current") { this.symbol_table[this.r.res].TypeId = typeId; } bool flag9 = false; string str11 = ""; string str12 = ""; FunctionObject functionObject = this.GetFunctionObject(id); if (functionObject.Static) { int num59 = this.symbol_table[id].Level; this[n - 1].arg1 = num59; } if (!functionObject.Imported && (a.Count > 0)) { avalue = 0; while (avalue < functionObject.ParamCount) { ParamMod paramMod = functionObject.GetParamMod(avalue); ParamMod mod2 = (ParamMod) param_mod[avalue]; if (paramMod != mod2) { int num60 = functionObject.GetParamId(avalue); int num61 = this[this.n].arg1; int num62 = this.symbol_table[num60].TypeId; int num63 = this.symbol_table[num61].TypeId; str11 = this.symbol_table[num62].Name; str12 = this.symbol_table[num63].Name; switch (paramMod) { case ParamMod.RetVal: str11 = "ref " + str11; break; case ParamMod.Out: str11 = "out " + str11; break; } if (mod2 == ParamMod.RetVal) { str12 = "ref " + str12; } else if (mod2 == ParamMod.Out) { str12 = "out " + str12; } flag9 = true; if (flag9 && this.PascalOrBasic(this.n)) { flag9 = false; if (paramMod == ParamMod.RetVal) { param_mod[avalue] = (int) paramMod; num3++; } } else { this.n = pos[avalue]; break; } } avalue++; } } if (flag9) { this.scripter.CreateErrorObjectEx("CS1503. Argument '{0}': cannot convert from '{1}' to '{2}'.", new object[] { avalue + 1, str12, str11 }); } else if ((num3 > 0) && (a.Count > 0)) { this.InsertOperators(this.n + 1, num3 * 2); for (avalue = 0; avalue < functionObject.ParamCount; avalue++) { int num64 = functionObject.GetParamId(avalue); if (param_mod[avalue] != 0) { int num65 = this.AppVar(this.symbol_table[id].Level, this.symbol_table[num64].TypeId); this.n++; this[this.n].op = this.OP_GET_PARAM_VALUE; this[this.n].arg1 = id; this[this.n].arg2 = avalue; this[this.n].res = num65; this.n++; this[this.n].op = this.OP_ASSIGN; this[this.n].arg1 = a[avalue]; this[this.n].arg2 = num65; this[this.n].res = a[avalue]; } } } }