HandleSeeAlso (mc, ds_target, seealso);
foreach (XmlElement see in n.SelectNodes (".//exception"))
HandleException (mc, ds_target, see);
+ foreach (XmlElement node in n.SelectNodes (".//typeparam"))
+ HandleTypeParam (mc, node);
+ foreach (XmlElement node in n.SelectNodes (".//typeparamref"))
+ HandleTypeParamRef (mc, node);
}
n.WriteTo (XmlCommentOutput);
HandleXrefCommon (mc, ds, seealso);
}
+ //
+ // Handles <typeparam /> node
+ //
+ void HandleTypeParam (MemberCore mc, XmlElement node)
+ {
+ if (!node.HasAttribute ("name"))
+ return;
+
+ string tp_name = node.GetAttribute ("name");
+ if (mc.CurrentTypeParameters != null) {
+ foreach (var tp in mc.CurrentTypeParameters) {
+ if (tp.Name == tp_name)
+ return;
+ }
+ }
+
+ // TODO: CS1710, CS1712
+
+ mc.Compiler.Report.Warning (1711, 2, mc.Location,
+ "XML comment on `{0}' has a typeparam name `{1}' but there is no type parameter by that name",
+ mc.GetSignatureForError (), tp_name);
+ }
+
+ //
+ // Handles <typeparamref /> node
+ //
+ void HandleTypeParamRef (MemberCore mc, XmlElement node)
+ {
+ if (!node.HasAttribute ("name"))
+ return;
+
+ string tp_name = node.GetAttribute ("name");
+ var member = mc;
+ do {
+ if (member.CurrentTypeParameters != null) {
+ foreach (var tp in member.CurrentTypeParameters) {
+ if (tp.Name == tp_name)
+ return;
+ }
+ }
+
+ member = member.Parent;
+ } while (member != null);
+
+ mc.Compiler.Report.Warning (1735, 2, mc.Location,
+ "XML comment on `{0}' has a typeparamref name `{1}' that could not be resolved",
+ mc.GetSignatureForError (), tp_name);
+ }
+
FullNamedExpression ResolveMemberName (IMemberContext context, MemberName mn)
{
if (mn.Left == null)
- return context.LookupNamespaceOrType (mn.Name, mn.Arity, Location.Null, /*ignore_cs0104=*/ false);
+ return context.LookupNamespaceOrType (mn.Name, mn.Arity, LookupMode.Probing, Location.Null);
var left = ResolveMemberName (context, mn.Left);
var ns = left as Namespace;
if (ns != null)
- return ns.Lookup (context, mn.Name, mn.Arity, Location.Null);
+ return ns.LookupTypeOrNamespace (context, mn.Name, mn.Arity, LookupMode.Probing, Location.Null);
TypeExpr texpr = left as TypeExpr;
if (texpr != null) {
var source_file = new CompilationSourceFile ("{documentation}", "", 1);
var doc_module = new ModuleContainer (module.Compiler);
doc_module.DocumentationBuilder = this;
- source_file.NamespaceContainer = new NamespaceEntry (doc_module, null, source_file, null);
+ source_file.NamespaceContainer = new NamespaceContainer (null, doc_module, null, source_file);
Report parse_report = new Report (new NullReportPrinter ());
var parser = new CSharpParser (seekable, source_file, parse_report);
// Try built-in type first because we are using ParsedName as identifier of
// member names on built-in types
//
- if (ParsedBuiltinType != null && ParsedParameters == null) {
+ if (ParsedBuiltinType != null && (ParsedParameters == null || ParsedName != null)) {
member = ParsedBuiltinType.Type;
} else {
member = null;
if (fne != null) {
var ns = fne as Namespace;
if (ns != null) {
- fne = ns.Lookup (mc, ParsedName.Name, ParsedName.Arity, Location.Null);
+ fne = ns.LookupTypeOrNamespace (mc, ParsedName.Name, ParsedName.Arity, LookupMode.Probing, Location.Null);
if (fne != null) {
member = fne.Type;
}
}
if (ParsedParameters != null) {
+ var old_printer = mc.Module.Compiler.Report.SetPrinter (new NullReportPrinter ());
foreach (var pp in ParsedParameters) {
pp.Resolve (mc);
}
+ mc.Module.Compiler.Report.SetPrinter (old_printer);
}
if (type != null) {
{
public readonly Parameter.Modifier Modifier;
public FullNamedExpression Type;
+ TypeSpec type;
public DocumentationParameter (Parameter.Modifier modifier, FullNamedExpression type)
: this (type)
public TypeSpec TypeSpec {
get {
- return Type == null ? null : Type.Type;
+ return type;
}
}
public void Resolve (IMemberContext context)
{
- Type = Type.ResolveAsTypeTerminal (context, true);
+ type = Type.ResolveAsType (context);
}
}
}