def visit_Call(self, ast_call: Call): func_call_node = FuncCallNode() # coord = coordinate(ast_call.col_offset, ast_call.lineno) # self.set_coordinate(func_call_node, coord) if hasattr(ast_call.func, 'id'): func_call_node.name = ast_call.func.id else: func_call_node.name = ast_call.func.attr # if ast_call.args: # for arg in ast_call.args: # if(hasattr(arg,'value')): # if type(arg) == Starred: # func_call_node.parameter.append(arg.value.id) # else: # func_call_node.parameter.append(arg.id) # if ast_call.keywords: # for keyword in ast_call.keywords: # if(hasattr(keyword,'value')): # if keyword.arg == None: # func_call_node.parameter.append(keyword.value.id) # else: # func_call_node.parameter.append(keyword.arg) return func_call_node
def visit_FuncCall(self, pyc_func_call: FuncCall): func_call_node = FuncCallNode() self.set_coordinate(func_call_node, pyc_func_call.coord) func_call_node.name = pyc_func_call.name.name if pyc_func_call.args: for param in pyc_func_call.args.exprs: if isinstance(param, Constant): func_call_node.parameter.append(param.value) elif isinstance(param, ID): func_call_node.parameter.append(param.name) return func_call_node
def visit_FuncCallNode(self, func_call: FuncCallNode): target = func_call.name for func in self.function_list: if target == func.name: func_call.time_complexity = sympy.Symbol(func.name, integer=True, positive=True) break pass
def visit_MethodInvocation(self, java_method_invocation: MethodInvocation): # func_call_node = JavaFuncCallNodeFactory().create(java_method_invocation) # self.parent.children.append(func_call_node) # func_call.copy_node_info_from(basic_node) func_call = FuncCallNode() self.set_coordinate(func_call, java_method_invocation) func_call.name = java_method_invocation.member if java_method_invocation.arguments: for arg in java_method_invocation.arguments: if type(arg) == Literal: func_call.parameter.append(str(arg.value)) elif type(arg) == MemberReference: func_call.parameter.append(str(arg.member)) elif type(arg) == BinaryOperation: func_call.parameter.append( str(arg.operandl) + str(arg.operator) + str(arg.operandr)) else: func_call.parameter.append(str(arg)) return func_call