@@ -438,7 +438,10 @@ def render_function(class_name, func_name, sigs, return_type, non_pointer,
438438 args = [(all_args [i ].identifier .name if isinstance (all_args [i ], WebIDL .IDLArgument ) else ('arg%d' % i )) for i in range (max_args )]
439439 if not constructor and not is_static :
440440 body = ' var self = this.ptr;\n '
441- pre_arg = ['BigInt(self)' ] if options .wasm64 else ['self' ]
441+ if options .wasm64 :
442+ pre_arg = ['BigInt(self)' ]
443+ else :
444+ pre_arg = ['self' ]
442445 else :
443446 body = ''
444447 pre_arg = []
@@ -457,10 +460,16 @@ def is_ptr_arg(i):
457460 compatible_arg = isinstance (arg , Dummy ) or (isinstance (arg , WebIDL .IDLArgument ) and arg .optional is False )
458461 # note: null has typeof object, but is ok to leave as is, since we are calling into asm code where null|0 = 0
459462 if not legacy_mode and compatible_arg :
460- arg_name = arg .identifier .name if isinstance (arg , WebIDL .IDLArgument ) else ''
463+ if isinstance (arg , WebIDL .IDLArgument ):
464+ arg_name = arg .identifier .name
465+ else :
466+ arg_name = ''
461467 # Format assert fail message
462468 check_msg = "[CHECK FAILED] %s::%s(%s:%s): " % (class_name , func_name , js_arg , arg_name )
463- inner = arg .type .inner if isinstance (arg .type , WebIDL .IDLWrapperType ) else ''
469+ if isinstance (arg .type , WebIDL .IDLWrapperType ):
470+ inner = arg .type .inner
471+ else :
472+ inner = ""
464473
465474 # Print type info in comments.
466475 body += " /* %s <%s> [%s] */\n " % (js_arg , arg .type .name , inner )
@@ -539,7 +548,10 @@ def make_call_args(i):
539548
540549 for i in range (min_args , max_args ):
541550 c_names [i ] = f'emscripten_bind_{ bindings_name } _{ i } '
542- after_call = '' if 'return ' in call_prefix else f'; { cache } return'
551+ if 'return ' in call_prefix :
552+ after_call = ''
553+ else :
554+ after_call = '; ' + cache + 'return'
543555 args_for_call = make_call_args (i )
544556 body += ' if (%s === undefined) { %s_%s(%s)%s%s }\n ' % (args [i ], call_prefix , c_names [i ],
545557 args_for_call ,
@@ -551,7 +563,10 @@ def make_call_args(i):
551563 if cache :
552564 body += f' { cache } \n '
553565
554- declare_name = f' { func_name } ' if constructor else ''
566+ if constructor :
567+ declare_name = ' ' + func_name
568+ else :
569+ declare_name = ''
555570 mid_js .append (r'''function%s(%s) {
556571%s
557572};
@@ -586,8 +601,11 @@ def make_call_args(i):
586601 else :
587602 if not bind_to :
588603 bind_to = func_name
589- call = f'{ bind_to } ({ call_args } )'
590- call = f'{ c_class_name } ::{ call } ' if is_static else f'self->{ call } '
604+ call = bind_to + '(' + call_args + ')'
605+ if is_static :
606+ call = c_class_name + '::' + call
607+ else :
608+ call = 'self->' + call
591609
592610 if operator :
593611 cast_self = 'self'
0 commit comments