Skip to content

Commit 54ddebb

Browse files
authored
Use null at the end of {{{ }}} code blocks that are side-effect only. NFC (#18324)
This, IMHO, is more reasonable than creating an IIFE than returns null.
1 parent fc1e4d5 commit 54ddebb

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

src/library_html5_webgpu.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{{ (function() {
1+
{{{
22
// Helper functions for code generation
33
global.html5_gpu = {
44
makeImportExport: function(snake_case, CamelCase) {
@@ -17,8 +17,8 @@
1717
return s;
1818
},
1919
};
20-
return null;
21-
})(); }}}
20+
null;
21+
}}}
2222

2323

2424
var LibraryHTML5WebGPU = {

src/library_wasm_worker.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
{{{ (function() { global.captureModuleArg = function() { return MODULARIZE ? '' : 'self.Module=d;'; }; return null; })(); }}}
2-
{{{ (function() { global.instantiateModule = function() { return MODULARIZE ? `${EXPORT_NAME}(d);` : ''; }; return null; })(); }}}
3-
{{{ (function() { global.instantiateWasm = function() { return MINIMAL_RUNTIME ? '' : 'd[`instantiateWasm`]=(i,r)=>{var n=new WebAssembly.Instance(d[`wasm`],i);r(n,d[`wasm`]);return n.exports};'; }; return null; })(); }}}
1+
{{{
2+
global.captureModuleArg = () => MODULARIZE ? '' : 'self.Module=d;';
3+
global.instantiateModule = () => MODULARIZE ? `${EXPORT_NAME}(d);` : '';
4+
global.instantiateWasm = () => MINIMAL_RUNTIME ? '' : 'd[`instantiateWasm`]=(i,r)=>{var n=new WebAssembly.Instance(d[`wasm`],i);r(n,d[`wasm`]);return n.exports};';
5+
null;
6+
}}}
47

58
#if WASM_WORKERS
69

src/library_webgl.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
{{{ GL_POOL_TEMP_BUFFERS_SIZE = 2*9*16 }}} // = 288
1010

1111
{{{
12-
global.isCurrentContextWebGL2 = function isCurrentContextWebGL2() {
12+
global.isCurrentContextWebGL2 = () => {
1313
if (MIN_WEBGL_VERSION >= 2) return 'true';
1414
if (MAX_WEBGL_VERSION <= 1) return 'false';
1515
return 'GL.currentContext.version >= 2';
1616
}
17+
null;
1718
}}}
1819

1920
var LibraryGL = {

src/library_webgpu.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* (requires WebGPU to be available - otherwise the test will skip itself and pass)
2222
*/
2323

24-
{{{ (function() {
24+
{{{
2525
// Helper functions for code generation
2626
global.gpu = {
2727
makeInitManager: function(type) {
@@ -157,8 +157,8 @@
157157
VertexBufferNotUsed: 2,
158158
},
159159
};
160-
return null;
161-
})(); }}}
160+
null;
161+
}}}
162162

163163
var LibraryWebGPU = {
164164
$WebGPU__postset: 'WebGPU.initManagers();',

0 commit comments

Comments
 (0)