/// <returns></returns> public bool IsPrimitiveType(TypeUse tu) { if (tu != null) { return(BuiltInTypeFactory.IsBuiltIn(tu)); } else { return(false); } }
/// <summary> /// Construct the method summarizer /// </summary> /// <param name="md"></param> public SwumSummary(MethodDefinition md) { this.Method = md; var classBelong = md.GetAncestors <TypeDefinition>().FirstOrDefault(); //class name if (classBelong != null) { ClassName = classBelong.Name; } else { ClassName = ""; } //return type string returnType = "void"; if (md.ReturnType != null) { returnType = md.ReturnType.ToString(); } //Check if md returns primitive bool IsPrimitive = IsPrimitiveType(md.ReturnType); HashSet <FormalParameterRecord> paras = new HashSet <FormalParameterRecord>(); foreach (var para in md.Parameters) { var vType = para.VariableType; var tempPara = new FormalParameterRecord(vType.ToString(), BuiltInTypeFactory.IsBuiltIn(vType), para.Name); paras.Add(tempPara); } MethodContext mc = new MethodContext(returnType, IsPrimitive, ClassName, paras, false, md.IsConstructor, md.IsDestructor); this._mDeclarationNode = new MethodDeclarationNode(md.Name, mc); this._builder = new UnigramSwumBuilder(); this.IsSummarized = false; }