Skip to content

Commit 8567e89

Browse files
committed
Updated with latest merged version from emscripten github repo
1 parent 254f69e commit 8567e89

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tools/webidl_binder.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,10 +614,15 @@ def make_call_args(i):
614614
# this function comes from an ancestor class; for operators, we must cast it
615615
cast_self = 'dynamic_cast<' + type_to_c(func_scope) + '>(' + cast_self + ')'
616616
maybe_deref = deref_if_nonpointer(raw[0])
617-
if operator == '[]':
617+
operator = operator.strip()
618+
if operator in ["+", "-", "*", "/", "%", "^", "&", "|", "=",
619+
"<", ">", "+=", "-=", "*=", "/=", "%=", "^=", "&=", "|=", "<<", ">>", ">>=",
620+
"<<=", "==", "!=", "<=", ">=", "<=>", "&&", "||"]:
621+
call = '(*%s %s %s%s)' % (cast_self, operator, maybe_deref, args[0])
622+
elif operator == '[]':
618623
call = '((*%s)[%s%s])' % (cast_self, maybe_deref, args[0])
619624
else:
620-
call = '(*%s %s %s%s)' % (cast_self, operator, maybe_deref, args[0])
625+
raise Exception('unfamiliar operator ' + operator)
621626

622627
pre = ''
623628

@@ -627,6 +632,7 @@ def make_call_args(i):
627632
if non_pointer:
628633
return_prefix += '&'
629634
if copy:
635+
# Avoid sharing this static temp var between threads, which could race.
630636
pre += ' static thread_local %s temp;\n' % type_to_c(return_type, non_pointing=True)
631637
return_prefix += '(temp = '
632638
return_postfix += ', &temp)'

0 commit comments

Comments
 (0)