MethodMirror GetCreateInstance(TypeMirror arrayType) { foreach (var method in arrayType.GetMethods()) { if (method.Name != nameof(Array.CreateInstance)) { continue; } var ps = method.GetParameters(); if (ps.Length != 2) { continue; } if (ps[0].ParameterType.FullName != "System.Type" || ps[1].ParameterType.FullName != "System.Int32") { continue; } return(method); } return(null); }
Location GetLocFromType(TypeMirror type, string file, int line) { Location target_loc = null; foreach (MethodMirror m in type.GetMethods()) { foreach (Location l in m.Locations) { if (System.IO.Path.GetFileName(l.SourceFile) == file && l.LineNumber == line) { target_loc = l; break; } } if (target_loc != null) { break; } } return(target_loc); }