@@ -881,15 +881,37 @@ def api_project_all_functions():
881881
882882 # Get all of the functions
883883 all_functions = data_storage .get_functions ()
884- project_functions = []
885- for function in all_functions :
886- if function .project == project_name :
887- project_functions . append ( function )
884+ project_functions = [
885+ function for function in all_functions
886+ if function .project == project_name
887+ ]
888888
889- # Convert it to something we can return
890- functions_to_return = list ()
889+ list_to_return = _convert_function_return_list (project_functions )
890+ return {'result' : 'success' , 'functions' : list_to_return }
891+
892+
893+ @blueprint .route ('/api/all-jvm-constructors' )
894+ def api_project_all_jvm_constructors ():
895+ """Returns a json representation of all the functions in a given project"""
896+ project_name = request .args .get ('project' , None )
897+ if project_name == None :
898+ return {'result' : 'error' , 'msg' : 'Please provide a project name' }
899+
900+ # Get all of the constructor
901+ all_constructors = data_storage .get_constructors ()
902+ project_constructors = [
903+ constr for constr in all_constructors if constr .project == project_name
904+ ]
905+
906+ list_to_return = _convert_function_return_list (project_constructors )
907+ return {'result' : 'success' , 'functions' : list_to_return }
908+
909+
910+ def _convert_function_return_list (project_functions ):
911+ """Convert a function list to something we can return"""
912+ list_to_return = []
891913 for function in project_functions :
892- functions_to_return .append ({
914+ list_to_return .append ({
893915 'function_name' :
894916 function .name ,
895917 'function_filename' :
@@ -911,7 +933,7 @@ def api_project_all_functions():
911933 'runtime_coverage_percent' :
912934 function .runtime_code_coverage ,
913935 })
914- return { 'result' : 'success' , 'functions' : functions_to_return }
936+ return list_to_return
915937
916938
917939@blueprint .route ('/api/project-source-code' )
@@ -1002,6 +1024,7 @@ def api_function_signature():
10021024 return {'result' : 'error' , 'msg' : 'No function name provided' }
10031025
10041026 all_functions = data_storage .get_functions ()
1027+ all_functions .append (data_storage .get_constructors ())
10051028 project_functions = []
10061029 func_to_match = None
10071030 print ("Iterating through all functions to match raw function name" )
0 commit comments