Code executed after recognising a function definition (type and function name)
773499
def function_begin_action(self, text, loc, fun):
        """"""
        exshared.setpos(loc, text)
        if DEBUG > 0:
            print("FUN_BEGIN:",fun)
            if DEBUG == 2: self.symtab.display()
            if DEBUG > 2: return
        self.shared.function_index = self.symtab.insert_function(fun.name, fun.type)
        self.shared.function_name = fun.name
        self.shared.function_params = 0
        self.shared.function_vars = 0
        self.codegen.function_begin();
847949
def declare_func(self, id_, lineno, type_=None):
        
        if not self.check_class(id_, 'function', lineno):
            entry = self.get_entry(id_)  # Must not exist or have _class = None or Function and declared = False
            an = 'an' if entry.class_.lower()[0] in 'aeio' else 'a'
            syntax_error(lineno, "'%s' already declared as %s %s at %i" % (id_, an, entry.class_, entry.lineno))
            return None

        entry = self.get_entry(id_)  # Must not exist or have _class = None or Function and declared = False
        if entry is not None:
            if entry.declared and not entry.forwarded:
                syntax_error(lineno, "Duplicate function name '%s', previously defined at %i" % (id_, entry.lineno))
                return None

            if entry.class_ != CLASS.unknown and entry.callable is False:  # HINT: Must use is False here.
                syntax_error_not_array_nor_func(lineno, id_)
                return None

            if id_[-1] in DEPRECATED_SUFFIXES and entry.type_ != self.basic_types[SUFFIX_TYPE[id_[-1]]]:
                syntax_error_func_type_mismatch(lineno, entry)

            if entry.token == 'VAR':  # This was a function used in advance
                symbols.VAR.to_function(entry, lineno=lineno)
            entry.mangled = '%s_%s' % (self.mangle, entry.name)  # HINT: mangle for nexted scopes
        else:
            entry = self.declare(id_, lineno, symbols.FUNCTION(id_, lineno, type_=type_))

        if entry.forwarded:
            entry.forwared = False  # No longer forwarded
            old_type = entry.type_  # Remembers the old type
            if entry.type_ is not None:
                if entry.type_ != old_type:
                    syntax_error_func_type_mismatch(lineno, entry)
            else:
                entry.type_ = old_type
        else:
            entry.params_size = 0  # Size of parameters

        entry.locals_size = 0  # Size of local variables
        return entry
949868
def function_end_action(self, text, loc, fun):
        """"""
        if DEBUG > 0:
            print("FUN_END:",fun)
            if DEBUG == 2: self.symtab.display()
            if DEBUG > 2: return
        #set function's attribute to number of function parameters
        self.symtab.set_attribute(self.shared.function_index, self.shared.function_params)
        #clear local function symbols (but leave function name)
        self.symtab.clear_symbols(self.shared.function_index + 1)
        self.codegen.function_end()
279138
def function_call_action(self, text, loc, fun):
        """"""
        exshared.setpos(loc, text)
        if DEBUG > 0:
            print("FUN_CALL:",fun)
            if DEBUG == 2: self.symtab.display()
            if DEBUG > 2: return
        #check number of arguments
        if len(self.function_arguments) != self.symtab.get_attribute(self.function_call_index):
            raise SemanticException("Wrong number of arguments for function '%s'" % fun.name)
        #arguments should be pushed to stack in reverse order
        self.function_arguments.reverse()
        self.codegen.function_call(self.function_call_index, self.function_arguments)
        self.codegen.restore_used_registers()
        return_type = self.symtab.get_type(self.function_call_index)
        #restore previous function call data
        self.function_call_index = self.function_call_stack.pop()
        self.function_arguments = self.function_arguments_stack.pop()
        register = self.codegen.take_register(return_type)
        #move result to a new free register, to allow the next function call
        self.codegen.move(self.codegen.take_function_register(return_type), register)
        return register
492272
def visit_FunctionDef(self, node):
        
        self.result.add(node.name)
        self.generic_visit(node)
601051
def function(self, func_name):
        
        if self.functions.has_key(func_name):
            return self.functions[func_name]
        else:
            raise RpcException(ERR_METHOD_NOT_FOUND, 
                               "%s: Unknown function: '%s'", self.name, func_name)
1003607
def compiled_init_func(self):
        """"""

        def get_column_assignment(column_name):
            return ALCHEMY_TEMPLATES.col_assignment.safe_substitute(col_name=column_name)

        def get_compiled_args(arg_name):
            return ALCHEMY_TEMPLATES.func_arg.safe_substitute(arg_name=arg_name)

        join_string = "\n" + self.tab + self.tab
        column_assignments = join_string.join([get_column_assignment(n) for n in self.columns])
        init_args = ", ".join(get_compiled_args(n) for n in self.columns)
        return ALCHEMY_TEMPLATES.init_function.safe_substitute(col_assignments=column_assignments,
                                                               init_args=init_args)
1319087
def visit_FunctionDef(self, node):
        """"""
        node = self.get_function_node(node)
        if node is not None:
            node._async = False
1203624
def _ondemand(f):
    
    name = f.__name__

    def func(self, *args, **kwargs):
        if not args and not kwargs:
            if hasattr(self, '_%s' % name):
                return getattr(self, '_%s' % name)

            a = f(self, *args, **kwargs)
            setattr(self, '_%s' % name, a)
            return a
        else:
            return f(self, *args, **kwargs)
    func.__name__ = name
    return func
981513
def dump(self, function_name):
        

        assert isinstance(function_name, str)
        self.stdout.write(function_name)
        self.stdout.write("\n")
        self.stdout.write("-" * len(function_name))
        self.stdout.write("\n\n")

        byte_code = self.interpreter.compiled_functions[function_name]
        self.stdout.write(byte_code.dump())
        self.stdout.write("\n")
673354
def take_function_register(self, rtype = SharedData.TYPES.NO_TYPE):
        """"""
        reg = SharedData.FUNCTION_REGISTER
        if reg not in self.free_registers:
            self.error("function register already taken")
        self.free_registers.remove(reg)
        self.used_registers.append(reg)
        self.symtab.set_type(reg, rtype)
        return reg
181516
function func(declarations, functions, functionMatcher, parseArgs) {
  if (!declarations) return;
  if (false !== parseArgs) parseArgs = true;

  declarations.forEach(function(decl){
    if ('comment' == decl.type) return;
    var generatedFuncs = [], result, generatedFunc;

    while (decl.value.match(functionMatcher)) {
      decl.value = decl.value.replace(functionMatcher, function(_, name, args){
        if (parseArgs) {
          args = args.split(/\s*,\s*/).map(strip);
        } else {
          args = [strip(args)];
        }
        // Ensure result is string
        result = '' + functions[name].apply(decl, args);

        // Prevent fall into infinite loop like this:
        //
        // {
        //   url: function(path) {
        //     return 'url(' + '/some/prefix' + path + ')'
        //   }
        // }
        //
        generatedFunc = {from: name, to: name + getRandomString()};
        result = result.replace(functionMatcherBuilder(name), generatedFunc.to + '($2)');
        generatedFuncs.push(generatedFunc);
        return result;
      });
    }

    generatedFuncs.forEach(function(func) {
      decl.value = decl.value.replace(func.to, func.from);
    })
  });
}
753740
def _onFunction(self, name, line, pos, absPosition,
                    keywordLine, keywordPos,
                    colonLine, colonPos, level,
                    isAsync, returnAnnotation):
        """"""
        self.__flushLevel(level)
        f = Function(name, line, pos, absPosition, keywordLine, keywordPos,
                     colonLine, colonPos, isAsync, returnAnnotation)
        if self.__lastDecorators is not None:
            f.decorators = self.__lastDecorators
            self.__lastDecorators = None
        self.objectsStack.append(f)
663372
def parse_executable_definition(lexer: Lexer) -> ExecutableDefinitionNode:
    """"""
    if peek(lexer, TokenKind.NAME):
        func = _parse_executable_definition_functions.get(cast(str, lexer.token.value))
        if func:
            return func(lexer)
    elif peek(lexer, TokenKind.BRACE_L):
        return parse_operation_definition(lexer)
    raise unexpected(lexer)
636131
def type(self):
        
        # pylint: disable=no-member
        if self.args.args and self.args.args[0].name == "self":
            if isinstance(self.parent.scope(), ClassDef):
                return "method"
        return "function"
1003104
function(a,b,c,d,e,f,g,h) {
            //console.log("running callback function", a, that, moduleId);
            // store the value
            that.execValues[moduleId] = {
               output: [a,b,c,d,e,f,g,h]
            };
            
            that.executeModules(moduleId, "output");
         }
714699
private void _function() throws
      IOException
  {
    // Assumes that builder already contains an IDENT
    if (debug)
    {
      checkArgument('(' == reader.peek());
    }
    builder.type = Type.FUNCTION;
    builder.append(reader.next());
  }