public override CodeExpression GetTestExpression(MethodInfoPointer owner, ILimnorCodeCompiler compiler, IMethodCompile methodToCompile, CodeMemberMethod method, CodeStatementCollection statements, UInt32 branchId) { ParameterInfo[] ps = owner.Info; SubMethodParameterInfo p = (SubMethodParameterInfo)ps[0]; CodeBinaryOperatorExpression bin = new CodeBinaryOperatorExpression( new CodeVariableReferenceExpression(ArrayForEachMethodInfo.codeName2(p.CodeName, branchId)), CodeBinaryOperatorType.LessThan, new CodePropertyReferenceExpression(owner.Owner.GetReferenceCode(methodToCompile, statements, true), "Count")); return(bin); }
public SortedDictionary <string, MethodInfo> GetMethods() { bool bClientOnly = false; bool isWebPage = false; if (this.RootPointer != null) { isWebPage = this.RootPointer.IsWebPage; if (this.RunAt == EnumWebRunAt.Client) { bClientOnly = true; } } SortedDictionary <string, MethodInfo> methods = new SortedDictionary <string, MethodInfo>(); Type t = WrappedType; MethodInfo[] mifs = t.GetMethods(); for (int i = 0; i < mifs.Length; i++) { if (!mifs[i].IsSpecialName) { if (bClientOnly) { bool include = false; if (!string.IsNullOrEmpty(mifs[i].Name)) { if (string.CompareOrdinal(mifs[i].Name, "Get") == 0) { include = true; } else if (string.CompareOrdinal(mifs[i].Name, "Set") == 0) { include = true; } } if (!include) { continue; } } string s = MethodPointer.GetMethodSignature(mifs[i]); methods.Add(s, mifs[i]); } } Type[] tps = t.GetInterfaces(); if (tps != null && tps.Length > 0) { for (int i = 0; i < tps.Length; i++) { mifs = tps[i].GetMethods(); for (int k = 0; k < mifs.Length; k++) { if (!mifs[k].IsSpecialName) { if (bClientOnly) { bool include = false; if (!string.IsNullOrEmpty(mifs[k].Name)) { if (string.CompareOrdinal(mifs[k].Name, "Get") == 0) { include = true; } else if (string.CompareOrdinal(mifs[k].Name, "Set") == 0) { include = true; } } if (!include) { continue; } } string s = MethodPointer.GetMethodSignature(mifs[k]); if (!methods.ContainsKey(s)) { methods.Add(s, mifs[k]); } } } } } ArrayForEachMethodInfo af = new ArrayForEachMethodInfo(ArrayItemType.LibTypePointer.ClassType, MemberId.ToString("x")); methods.Add(af.Name, af); return(methods); }