private PropertyEntity ExtractProperty(PropertyDeclaration propertyDeclaration) { PropertyEntity propertyEntity = new PropertyEntity(); propertyEntity.Name = propertyDeclaration.Name; propertyEntity.Static = (propertyDeclaration.Modifier & Modifiers.Static) == Modifiers.Static; // Get the method's comment IEnumerable <Comment> comments = this.GetDocumentationCommentsBefore(propertyDeclaration); AppendComment(propertyEntity, comments); // Extract getter MethodEntity getterEntity = new MethodEntity(); propertyEntity.Getter = getterEntity; // Extract signature from comments Comment signatureComment = comments.FirstOrDefault(c => CommentHelper.IsSignature(c.CommentText.Trim())); if (signatureComment != null) { getterEntity.Signature = signatureComment.Trim("Original signature is", "'", ";", "private"); } // Extract selector MethodSelectorExtractor extractor = new MethodSelectorExtractor(getterEntity.Signature); getterEntity.Selector = extractor.Extract(); // Parse the signature for return type MethodSignatureEnumerator signatureEnumerator = new MethodSignatureEnumerator(getterEntity.Signature); if (signatureEnumerator.MoveNext()) { bool isOut, isByRef, isBlock; propertyEntity.Type = this.TypeManager.ConvertType(signatureEnumerator.Current.TrimAll(), out isOut, out isByRef, out isBlock, this.Logger); } else { propertyEntity.Type = "Id"; } if (propertyDeclaration.HasSetRegion) { MethodEntity setterEntity = new MethodEntity(); setterEntity.Selector = "MISSING"; MethodParameterEntity methodParameterEntity = new MethodParameterEntity(); methodParameterEntity.Name = "value"; methodParameterEntity.Type = propertyEntity.Type; setterEntity.Parameters.Add(methodParameterEntity); setterEntity.ReturnType = "void"; propertyEntity.Setter = setterEntity; } return(propertyEntity); }
private PropertyEntity ExtractProperty(PropertyDeclaration propertyDeclaration) { PropertyEntity propertyEntity = new PropertyEntity (); propertyEntity.Name = propertyDeclaration.Name; propertyEntity.Static = (propertyDeclaration.Modifier & Modifiers.Static) == Modifiers.Static; // Get the method's comment IEnumerable<Comment> comments = this.GetDocumentationCommentsBefore (propertyDeclaration); AppendComment (propertyEntity, comments); // Extract getter MethodEntity getterEntity = new MethodEntity (); propertyEntity.Getter = getterEntity; // Extract signature from comments Comment signatureComment = comments.FirstOrDefault (c => CommentHelper.IsSignature (c.CommentText.Trim ())); if (signatureComment != null) { getterEntity.Signature = signatureComment.Trim ("Original signature is", "'", ";", "private"); } // Extract selector MethodSelectorExtractor extractor = new MethodSelectorExtractor (getterEntity.Signature); getterEntity.Selector = extractor.Extract (); // Parse the signature for return type MethodSignatureEnumerator signatureEnumerator = new MethodSignatureEnumerator (getterEntity.Signature); if (signatureEnumerator.MoveNext ()) { bool isOut, isByRef, isBlock; propertyEntity.Type = this.TypeManager.ConvertType (signatureEnumerator.Current.TrimAll (), out isOut, out isByRef, out isBlock, this.Logger); } else { propertyEntity.Type = "Id"; } if (propertyDeclaration.HasSetRegion) { MethodEntity setterEntity = new MethodEntity (); setterEntity.Selector = "MISSING"; MethodParameterEntity methodParameterEntity = new MethodParameterEntity (); methodParameterEntity.Name = "value"; methodParameterEntity.Type = propertyEntity.Type; setterEntity.Parameters.Add (methodParameterEntity); setterEntity.ReturnType = "void"; propertyEntity.Setter = setterEntity; } return propertyEntity; }
private MethodEntity ExtractMethod(MethodDeclaration methodDeclaration) { MethodEntity methodEntity = new MethodEntity(); methodEntity.Name = methodDeclaration.Name; // Get the method's comment IEnumerable <Comment> comments = this.GetDocumentationCommentsBefore(methodDeclaration); // Extract signature from comments Comment signatureComment = comments.FirstOrDefault(c => CommentHelper.IsSignature(c.CommentText.Trim())); if (signatureComment != null) { methodEntity.Signature = signatureComment.Trim("Original signature is", "'", ";", "private"); } AppendComment(methodEntity, comments); methodEntity.Static = (methodDeclaration.Modifier & Modifiers.Static) == Modifiers.Static; // Extract selector MethodSelectorExtractor extractor = new MethodSelectorExtractor(methodEntity.Signature); methodEntity.Selector = extractor.Extract(); // Parse the signature for return type MethodSignatureEnumerator signatureEnumerator = new MethodSignatureEnumerator(methodEntity.Signature); if (signatureEnumerator.MoveNext()) { bool isOut, isByRef, isBlock; methodEntity.ReturnType = this.TypeManager.ConvertType(signatureEnumerator.Current.TrimAll(), out isOut, out isByRef, out isBlock, this.Logger); } else { methodEntity.ReturnType = "Id"; } // Parse signature for parameter names and types MethodParametersEnumerator parameterTypesEnumerator = new MethodParametersEnumerator(methodEntity.Signature, false); MethodParametersEnumerator parameterNamesEnumerator = new MethodParametersEnumerator(methodEntity.Signature, true); while (parameterTypesEnumerator.MoveNext() && parameterNamesEnumerator.MoveNext()) { MethodParameterEntity parameterEntity = new MethodParameterEntity(); bool isOut, isByRef, isBlock; parameterEntity.Type = this.TypeManager.ConvertType(parameterTypesEnumerator.Current, out isOut, out isByRef, out isBlock, this.Logger); parameterEntity.IsOut = isOut; parameterEntity.IsByRef = isByRef; parameterEntity.IsBlock = isBlock; parameterEntity.Name = parameterNamesEnumerator.Current.Trim(); methodEntity.Parameters.Add(parameterEntity); } // Extract the corresponding comments foreach (MethodParameterEntity methodParameterEntity in methodEntity.Parameters) { String s = comments.GetParameterDescription(methodParameterEntity.Name); methodParameterEntity.Summary.Add(s); } return(methodEntity); }
private MethodEntity ExtractMethod(MethodDeclaration methodDeclaration) { MethodEntity methodEntity = new MethodEntity (); methodEntity.Name = methodDeclaration.Name; // Get the method's comment IEnumerable<Comment> comments = this.GetDocumentationCommentsBefore (methodDeclaration); // Extract signature from comments Comment signatureComment = comments.FirstOrDefault (c => CommentHelper.IsSignature (c.CommentText.Trim ())); if (signatureComment != null) { methodEntity.Signature = signatureComment.Trim ("Original signature is", "'", ";", "private"); } AppendComment (methodEntity, comments); methodEntity.Static = (methodDeclaration.Modifier & Modifiers.Static) == Modifiers.Static; // Extract selector MethodSelectorExtractor extractor = new MethodSelectorExtractor (methodEntity.Signature); methodEntity.Selector = extractor.Extract (); // Parse the signature for return type MethodSignatureEnumerator signatureEnumerator = new MethodSignatureEnumerator (methodEntity.Signature); if (signatureEnumerator.MoveNext ()) { bool isOut, isByRef, isBlock; methodEntity.ReturnType = this.TypeManager.ConvertType (signatureEnumerator.Current.TrimAll (), out isOut, out isByRef, out isBlock, this.Logger); } else { methodEntity.ReturnType = "Id"; } // Parse signature for parameter names and types MethodParametersEnumerator parameterTypesEnumerator = new MethodParametersEnumerator (methodEntity.Signature, false); MethodParametersEnumerator parameterNamesEnumerator = new MethodParametersEnumerator (methodEntity.Signature, true); while (parameterTypesEnumerator.MoveNext() && parameterNamesEnumerator.MoveNext()) { MethodParameterEntity parameterEntity = new MethodParameterEntity (); bool isOut, isByRef, isBlock; parameterEntity.Type = this.TypeManager.ConvertType (parameterTypesEnumerator.Current, out isOut, out isByRef, out isBlock, this.Logger); parameterEntity.IsOut = isOut; parameterEntity.IsByRef = isByRef; parameterEntity.IsBlock = isBlock; parameterEntity.Name = parameterNamesEnumerator.Current.Trim (); methodEntity.Parameters.Add (parameterEntity); } // Extract the corresponding comments foreach (MethodParameterEntity methodParameterEntity in methodEntity.Parameters) { String s = comments.GetParameterDescription (methodParameterEntity.Name); methodParameterEntity.Summary.Add (s); } return methodEntity; }