Skip to content

Commit e792dc4

Browse files
committed
fix ccall regex for minified code, and add testing
1 parent afd5a42 commit e792dc4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/preamble.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ var cwrap, ccall;
396396
return ret;
397397
}
398398

399-
var sourceRegex = /^function\s\((.*)\)\s*{\s*([^*]*?)[\s;]*(?:return\s*(.*?)[;\s]*)?}$/;
399+
var sourceRegex = /^function\s\(([^)]*)\)\s*{\s*([^*]*?)[\s;]*(?:return\s*(.*?)[;\s]*)?}$/;
400400
function parseJSFunc(jsfunc) {
401401
// Match the body and the return value of a javascript function source
402402
var parsed = jsfunc.toString().match(sourceRegex).slice(1);

tests/test_core.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -5453,9 +5453,6 @@ def test_corruption_3(self):
54535453
### Integration tests
54545454

54555455
def test_ccall(self):
5456-
if self.emcc_args is not None and '-O2' in self.emcc_args:
5457-
self.emcc_args += ['--closure', '1'] # Use closure here, to test we export things right
5458-
54595456
post = '''
54605457
def process(filename):
54615458
src = \'\'\'
@@ -5499,6 +5496,11 @@ def process(filename):
54995496

55005497
self.do_run_from_file(src, output, post_build=post)
55015498

5499+
if self.emcc_args is not None and '-O2' in self.emcc_args:
5500+
print 'with closure'
5501+
self.emcc_args += ['--closure', '1']
5502+
self.do_run_from_file(src, output, post_build=post)
5503+
55025504
def test_pgo(self):
55035505
if Settings.ASM_JS: return self.skip('PGO does not work in asm mode')
55045506

0 commit comments

Comments
 (0)