diff --git a/tests/webidl/output_ALL.txt b/tests/webidl/output_ALL.txt index 5a7788263c22b..c50dd16489819 100644 --- a/tests/webidl/output_ALL.txt +++ b/tests/webidl/output_ALL.txt @@ -63,6 +63,7 @@ object 21.12 198 getAsArray: 24 +Inner::+= => 2 0 1 34,34 diff --git a/tests/webidl/output_DEFAULT.txt b/tests/webidl/output_DEFAULT.txt index afc0bb3b2a609..d0d3faf3898b0 100644 --- a/tests/webidl/output_DEFAULT.txt +++ b/tests/webidl/output_DEFAULT.txt @@ -63,6 +63,7 @@ object 21.12 198 getAsArray: 24 +Inner::+= => 2 0 1 34,34 diff --git a/tests/webidl/output_FAST.txt b/tests/webidl/output_FAST.txt index afc0bb3b2a609..d0d3faf3898b0 100644 --- a/tests/webidl/output_FAST.txt +++ b/tests/webidl/output_FAST.txt @@ -63,6 +63,7 @@ object 21.12 198 getAsArray: 24 +Inner::+= => 2 0 1 34,34 diff --git a/tests/webidl/post.js b/tests/webidl/post.js index abff14182fcd1..445a14511b3c6 100644 --- a/tests/webidl/post.js +++ b/tests/webidl/post.js @@ -124,6 +124,7 @@ bv2.getAnother().PrintFloat(21.12); console.log(new TheModule.Inner().get()); console.log('getAsArray: ' + new TheModule.Inner().getAsArray(12)); new TheModule.Inner().mul(2); +new TheModule.Inner().incInPlace(new TheModule.Inner()); console.log(TheModule.enum_value1); console.log(TheModule.enum_value2); diff --git a/tests/webidl/test.h b/tests/webidl/test.h index 016a3df5432fe..c228e34634e5e 100644 --- a/tests/webidl/test.h +++ b/tests/webidl/test.h @@ -82,10 +82,15 @@ struct VoidPointerUser { namespace Space { struct Inner { - Inner() {} + int value; + Inner() : value(1) {} int get() { return 198; } Inner& operator*=(float x) { return *this; } int operator[](int x) { return x*2; } + void operator+=(const Inner& other) { + value += other.value; + printf("Inner::+= => %d\n", value); + } }; } diff --git a/tests/webidl/test.idl b/tests/webidl/test.idl index 77c511dc7e976..98b9fcfc6b379 100644 --- a/tests/webidl/test.idl +++ b/tests/webidl/test.idl @@ -77,6 +77,7 @@ interface Inner { long get(); [Operator="*=", Ref] Inner mul(float x); [Operator="[]"] long getAsArray(long x); + [Operator="+="] void incInPlace([Const, Ref] Inner i); }; enum AnEnum { diff --git a/tools/webidl_binder.py b/tools/webidl_binder.py index 136ccc06c4a31..3b16787ce1798 100644 --- a/tools/webidl_binder.py +++ b/tools/webidl_binder.py @@ -504,7 +504,7 @@ def render_function(class_name, func_name, sigs, return_type, non_pointer, copy, if class_name != func_scope: # this function comes from an ancestor class; for operators, we must cast it cast_self = 'dynamic_cast<' + type_to_c(func_scope) + '>(' + cast_self + ')' - maybe_deref = '*' if sig[0] in interfaces else '' + maybe_deref = deref_if_nonpointer(raw[0]) if '=' in operator: call = '(*%s %s %s%s)' % (cast_self, operator, maybe_deref, args[0]) elif operator == '[]':