MCPcopy Create free account
hub / github.com/GoogleChrome/samples / missingLibrarySymbol

Function missingLibrarySymbol

mkbitmap/mkbitmap.js:979–1006  ·  view source on GitHub ↗
(sym)

Source from the content-addressed store, hash-verified

977missingGlobal('buffer', 'Please use HEAP8.buffer or wasmMemory.buffer');
978
979function missingLibrarySymbol(sym) {
980 if (typeof globalThis !== 'undefined' && !Object.getOwnPropertyDescriptor(globalThis, sym)) {
981 Object.defineProperty(globalThis, sym, {
982 configurable: true,
983 get: function() {
984 // Can't `abort()` here because it would break code that does runtime
985 // checks. e.g. `if (typeof SDL === 'undefined')`.
986 var msg = '`' + sym + '` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line';
987 // DEFAULT_LIBRARY_FUNCS_TO_INCLUDE requires the name as it appears in
988 // library.js, which means $name for a JS name with no prefix, or name
989 // for a JS name like _name.
990 var librarySymbol = sym;
991 if (!librarySymbol.startsWith('_')) {
992 librarySymbol = '$' + sym;
993 }
994 msg += " (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=" + librarySymbol + ")";
995 if (isExportedByForceFilesystem(sym)) {
996 msg += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';
997 }
998 warnOnce(msg);
999 return undefined;
1000 }
1001 });
1002 }
1003 // Any symbol that is not included from the JS libary is also (by definition)
1004 // not exported on the Module object.
1005 unexportedRuntimeSymbol(sym);
1006}
1007
1008function unexportedRuntimeSymbol(sym) {
1009 if (!Object.getOwnPropertyDescriptor(Module, sym)) {

Callers

nothing calls this directly

Calls 3

unexportedRuntimeSymbolFunction · 0.85
warnOnceFunction · 0.70

Tested by

no test coverage detected