Skip to content

Commit

Permalink
[embind] Fix closure with assertions enabled. (#22760)
Browse files Browse the repository at this point in the history
`argPackAdvance` was being minified so the check for the property was
not working when assertions were enabled with closure.

Fixes #22759
  • Loading branch information
brendandahl authored Oct 17, 2024
1 parent 5eb1305 commit 0cc74ae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/embind/embind.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ var LibraryEmbind = {
$registerType__docs: '/** @param {Object=} options */',
$registerType: function(rawType, registeredInstance, options = {}) {
#if ASSERTIONS
if (!('argPackAdvance' in registeredInstance)) {
if (registeredInstance.argPackAdvance === undefined) {
throw new TypeError('registerType registeredInstance requires argPackAdvance');
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -3234,7 +3234,7 @@ def test_embind_closure_no_dynamic_execution(self):
'o1': ['-O1'],
'o2': ['-O2'],
'o2_mem_growth': ['-O2', '-sALLOW_MEMORY_GROWTH', test_file('embind/isMemoryGrowthEnabled=true.cpp')],
'o2_closure': ['-O2', '--closure=1', '--closure-args', '--externs ' + shlex.quote(test_file('embind/underscore-externs.js'))],
'o2_closure': ['-O2', '--closure=1', '--closure-args', '--externs ' + shlex.quote(test_file('embind/underscore-externs.js')), '-sASSERTIONS=1'],
'strict_js': ['-sSTRICT_JS']
})
def test_embind(self, *extra_args):
Expand Down

0 comments on commit 0cc74ae

Please sign in to comment.