MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / create_asm_consts

Function create_asm_consts

tools/emscripten.py:724–742  ·  view source on GitHub ↗
(metadata)

Source from the content-addressed store, hash-verified

722
723
724def create_asm_consts(metadata):
725 asm_consts = {}
726 for addr, const in metadata.em_asm_consts.items():
727 body = trim_asm_const_body(const)
728 max_arity = 16
729 arity = 0
730 for i in range(max_arity):
731 if f'${i}' in const:
732 arity = i + 1
733 args = ', '.join(f'${i}' for i in range(arity))
734 if 'arguments' in body:
735 # arrow functions don't bind `arguments` so we have to use
736 # the old function syntax in this case
737 func = f'function({args}) {{ {body} }}'
738 else:
739 func = f'({args}) => {{ {body} }}'
740 asm_consts[addr] = func
741 asm_consts = sorted(asm_consts.items())
742 return asm_consts
743
744
745def type_to_sig(type):

Callers 1

emscriptFunction · 0.85

Calls 3

trim_asm_const_bodyFunction · 0.85
rangeFunction · 0.50
joinMethod · 0.45

Tested by

no test coverage detected