/// <inheritdoc /> public override IEnumerable <TypeMethodInfo> FindMethods(string searchedName) { var methods = new List <TypeMethodInfo>(); //firstly we test current nodes (because of implicit ctors,..) IEnumerable <ElementPosition> nextElements; if (_currentElements == null) { //searched name will be tested when filling matching info nextElements = ElementPosition.ExtendElements(_assembly.RootElements, null); } else { fillWithMatchingInfo(searchedName, _currentElements, methods); //searched name will be tested when filling matching info nextElements = ElementPosition.ExtendElements(_currentElements, null); } fillWithMatchingInfo(searchedName, nextElements, methods); var path = PathInfo.Append(_currentPath, searchedName); //resolve generic specializations foreach (var method in methods) { var resolvedMethod = method; if (_currentPath != null && _currentPath.HasGenericArguments) { resolvedMethod = method.MakeGenericMethod(path); } yield return(resolvedMethod); } }
/// <inheritdoc /> public override SearchIterator ExtendName(string suffix) { if (suffix == "") { return(this); } IEnumerable <ElementPosition> extendedPositions; if (_currentElements == null) { //position has not been currently set - use root elements //Root element iteration IS PERFORMANCE KILLER - IS IT POSSIBLE TO WORKAROUND VISUAL STUDIO THREADING MODEL? extendedPositions = ElementPosition.ExtendElements(_assembly.RootElements, suffix); } else { //we already have initial position extendedPositions = ElementPosition.ExtendElements(_currentElements, suffix); } if (!extendedPositions.Any()) { return(null); } return(new CodeElementIterator(extendedPositions, _assembly, PathInfo.Append(_currentPath, suffix))); }