/// <summary> /// Obtains a reflection wrapper for a parameter. /// </summary> /// <param name="target">The parameter, or null if none.</param> /// <returns>The reflection wrapper, or null if none.</returns> public StaticParameterWrapper Wrap(CodeParameter2 target) { if (target == null) { return(null); } StaticMemberWrapper member = Wrap(GetContainingFunction((CodeElement)target)); return(new StaticParameterWrapper(this, target, member)); }
/// <inheritdoc /> protected override CodeLocation GetMemberSourceLocation(StaticMemberWrapper member) { CodeElement memberHandle = (CodeElement)member.Handle; ProjectItem projectItem = memberHandle.ProjectItem; if (projectItem.FileCount == 0) { return(CodeLocation.Unknown); } string filename = projectItem.get_FileNames(0); TextPoint point = memberHandle.GetStartPoint(vsCMPart.vsCMPartName); return(new CodeLocation(filename, point.Line, point.LineCharOffset + 1)); }
/// <inheritdoc /> protected override string GetMemberName(StaticMemberWrapper member) { CodeElement memberHandle = (CodeElement)member.Handle; return(memberHandle.Name); }
/// <inheritdoc /> protected override IEnumerable <StaticAttributeWrapper> GetMemberCustomAttributes(StaticMemberWrapper member) { CodeElement2 memberHandle = (CodeElement2)member.Handle; switch (memberHandle.Kind) { case vsCMElement.vsCMElementClass: return(WrapAttributes(((CodeClass2)memberHandle).Attributes)); case vsCMElement.vsCMElementStruct: return(WrapAttributes(((CodeStruct2)memberHandle).Attributes)); case vsCMElement.vsCMElementInterface: return(WrapAttributes(((CodeInterface2)memberHandle).Attributes)); case vsCMElement.vsCMElementDelegate: return(WrapAttributes(((CodeDelegate2)memberHandle).Attributes)); case vsCMElement.vsCMElementEnum: return(WrapAttributes(((CodeEnum)memberHandle).Attributes)); case vsCMElement.vsCMElementFunction: return(WrapAttributes(((CodeFunction2)memberHandle).Attributes)); case vsCMElement.vsCMElementProperty: return(WrapAttributes(((CodeProperty2)memberHandle).Attributes)); case vsCMElement.vsCMElementVariable: return(WrapAttributes(((CodeVariable2)memberHandle).Attributes)); case vsCMElement.vsCMElementEvent: return(WrapAttributes(((CodeEvent)memberHandle).Attributes)); } return(EmptyArray <StaticAttributeWrapper> .Instance); }
private StaticMethodWrapper WrapAccessor(CodeFunction accessorHandle, StaticMemberWrapper member) { return(accessorHandle != null ? new StaticMethodWrapper(this, accessorHandle, member.DeclaringType, member.ReflectedType, member.Substitution) : null); }