[Mono-devel-list] Patch for full-featured mcs /doc support

Atsushi Eno atsushi at ximian.com
Fri Nov 26 03:24:36 EST 2004


Hello,

Thanks for several checks!

> + public string consume_doc_comment ()
> + {
> + if (xml_comment_buffer.Length > 0) {
> + string ret = null;
> + if (xmlCommentSavePoint > 0) {
> + ret = xml_comment_buffer.ToString (0, xmlCommentSavePoint);
> + xml_comment_buffer.Remove (0, xmlCommentSavePoint);
> + } else {
> + ret = xml_comment_buffer.ToString ();
> + xml_comment_buffer.Length = 0;
> + }
> + xmlCommentSavePoint = 0;
> + return ret;
> + }
> + else
> + return null;
> + }
> 
> The last else is useless and xmlCommentSavePoint = 0 should be only for
> xmlCommentSavePoint > 0.

Ok. Actually I noticed that push_xml_comment() is not required anymore
(since I implemented invalid comment state transition), I just removed
it as well as xmlCommentSavePoint which is also not required anymore.

> + public enum XmlCommentState {
> + OK,
> + NG,
> + Error
> + }
> 
> What is NG ?

OK, I found that NG is kind of Japanglish ;-) so just renamed
OK as Allowed and NG as NotAllowed.

> + MemberInfo mi = FindDocumentedMember (type, memberName,
> parameterTypes, ds, out warnResult);
> + switch (warnResult) {
> + case 1581:
> + Report.Warning (1581, 1, Location, "Invalid return type in XML comment
> cref attribute '{0}'", cref);
> + return;
> + case 1584:
> + Report.Warning (1020, 1, Location, "Overloadable {0} operator is
> expected", parameterTypes.Length == 2 ? "binary" : "unary");
> + Report.Warning (1584, 1, Location, "XML comment on '{0}' has
> syntactically incorrect attribute '{1}'", GetSignatureForError (), cref);
> + return;
> + }
> 
> Why don't do it inside FindDocumentMember to avoid copy&paste.

Fixed.

> - : IDENTIFIER
> + : IDENTIFIER
> + {
> + tmpComment = Lexer.consume_doc_comment ();
> + Lexer.doc_state = XmlCommentState.OK;
> + }
> OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS
> {
> oob_stack.Push (lexer.Location);
> 
> - current_local_parameters = (Parameters) $3;
> + current_local_parameters = (Parameters) $4;
> }
> opt_constructor_initializer
> {
> Location l = (Location) oob_stack.Pop ();
> - $$ = new Constructor (current_class, (string) $1, 0, (Parameters) $3,
> - (ConstructorInitializer) $6, l);
> + $$ = new Constructor (current_class, (string) $1, 0, (Parameters) $4,
> + (ConstructorInitializer) $7, l);
> }
> 
> I am confuse, what has been changed.

I cannot understand what you mean. It should not be regarded as
confusion, since it must happen whenever any of you guys have to
insert logic between tokens.

> + } catch (NotImplementedException ex) {
> + Report.Error (1569, "Error generating XML documentation file '{0}'
> ('{1}')", xml_documentation_file, ex.Message);
> + return false;
> 
> Does make a sense to catch this exception ?

Oops, it should just be Exception (to catch xml-output errors).

> + vd.DocComment = ConsumeStoredComment ();
> + Lexer.doc_state = XmlCommentState.OK;
> 
> Why don't call this tricky property in ConsumeStroredComment I found
> only one place where this combination is missing (bug ??). Should be
> possible also to rename this property ?

Made as such.

> BTW: I think we should call this call only for /doc option.

Ok, now everything in .jay checks RootContext.NeedDocument.

I've attached the latest diff in mcs/mcs and mcs/tests, and added
new tests in mcs/errors (cs1587-*.cs). It still needs some love
on the files in tests (test-harness is not working properly; am
asking Hari about that).

Atsushi Eno

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mcs-doc-20041126.diff
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20041126/174e7899/attachment.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cs1587-26.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20041126/174e7899/attachment-0001.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cs1587-27.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20041126/174e7899/attachment-0002.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cs1587-28.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20041126/174e7899/attachment-0003.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mcs-doc-tests-20041126.diff
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20041126/174e7899/attachment-0004.pl 


More information about the Mono-devel-list mailing list