TODO: function return values determine expression types if in argument list
(block, args=None, tab='')
| 2035 | |
| 2036 | |
| 2037 | def postcrack(block, args=None, tab=''): |
| 2038 | """ |
| 2039 | TODO: |
| 2040 | function return values |
| 2041 | determine expression types if in argument list |
| 2042 | """ |
| 2043 | global usermodules, onlyfunctions |
| 2044 | |
| 2045 | if isinstance(block, list): |
| 2046 | gret = [] |
| 2047 | uret = [] |
| 2048 | for g in block: |
| 2049 | setmesstext(g) |
| 2050 | g = postcrack(g, tab=tab + '\t') |
| 2051 | # sort user routines to appear first |
| 2052 | if 'name' in g and '__user__' in g['name']: |
| 2053 | uret.append(g) |
| 2054 | else: |
| 2055 | gret.append(g) |
| 2056 | return uret + gret |
| 2057 | setmesstext(block) |
| 2058 | if not isinstance(block, dict) and 'block' not in block: |
| 2059 | raise Exception('postcrack: Expected block dictionary instead of ' + |
| 2060 | str(block)) |
| 2061 | if 'name' in block and not block['name'] == 'unknown_interface': |
| 2062 | outmess(f"{tab}Block: {block['name']}\n", 0) |
| 2063 | block = analyzeargs(block) |
| 2064 | block = analyzecommon(block) |
| 2065 | block['vars'] = analyzevars(block) |
| 2066 | block['sortvars'] = sortvarnames(block['vars']) |
| 2067 | if block.get('args'): |
| 2068 | args = block['args'] |
| 2069 | block['body'] = analyzebody(block, args, tab=tab) |
| 2070 | |
| 2071 | userisdefined = [] |
| 2072 | if 'use' in block: |
| 2073 | useblock = block['use'] |
| 2074 | for k in list(useblock.keys()): |
| 2075 | if '__user__' in k: |
| 2076 | userisdefined.append(k) |
| 2077 | else: |
| 2078 | useblock = {} |
| 2079 | name = '' |
| 2080 | if 'name' in block: |
| 2081 | name = block['name'] |
| 2082 | # and not userisdefined: # Build a __user__ module |
| 2083 | if block.get('externals'): |
| 2084 | interfaced = [] |
| 2085 | if 'interfaced' in block: |
| 2086 | interfaced = block['interfaced'] |
| 2087 | mvars = copy.copy(block['vars']) |
| 2088 | if name: |
| 2089 | mname = name + '__user__routines' |
| 2090 | else: |
| 2091 | mname = 'unknown__user__routines' |
| 2092 | if mname in userisdefined: |
| 2093 | i = 1 |
| 2094 | while f"{mname}_{i}" in userisdefined: |
no test coverage detected
searching dependent graphs…