From fb37a9fbb5a667d530f258b79b83ddb93d4e5279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Jyl=C3=A4nki?= Date: Tue, 1 Dec 2026 15:45:23 +0200 Subject: [PATCH] [docs] Remove incorrect claim that EM_ASM cannot use double quotes EM_ASM code can use double-quoted JavaScript strings; test/core/test_em_asm_2.cpp exercises both single and double quotes. Co-Authored-By: Claude Opus 5.5 --- .../Interacting-with-code.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/site/source/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.rst b/site/source/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.rst index fd587d8a04f27..e49fe1d95aed4 100644 --- a/site/source/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.rst +++ b/site/source/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.rst @@ -338,10 +338,9 @@ See the :c:macro:`emscripten.h docs ` for more details. - See how ``{`` and ``}`` are used here to enclose the code. This is necessary to differentiate the code from the arguments passed later, which are the input values (this is how C macros work). - - When using the :c:macro:`EM_ASM` macro, ensure that you only use - single quotes('). Double quotes(") will cause a syntax error that - is not detected by the compiler and is only shown when looking at - a JavaScript console while running the offending code. + - JavaScript string literals inside :c:macro:`EM_ASM` code may use either + single quotes (``'``) or double quotes (``"``). See + `test/core/test_em_asm_2.cpp`_ for examples of both forms. - clang-format may clobber Javascript constructions, such as ``=>`` turning to ``= >``. To avoid this, add to your ``.clang-format``: ``WhitespaceSensitiveMacros: ['EM_ASM', 'EM_JS', 'EM_ASM_INT', 'EM_ASM_DOUBLE', 'EM_ASM_PTR', 'MAIN_THREAD_EM_ASM', 'MAIN_THREAD_EM_ASM_INT', 'MAIN_THREAD_EM_ASM_DOUBLE', 'MAIN_THREAD_EM_ASM_DOUBLE', 'MAIN_THREAD_ASYNC_EM_ASM']``. @@ -853,6 +852,7 @@ you can give it a try. See `Emnapi documentation`_ for more details. .. _test/test_other.py: https://github.com/emscripten-core/emscripten/blob/main/test/test_other.py .. _test/core/test_utf.c: https://github.com/emscripten-core/emscripten/blob/main/test/core/test_utf.c .. _test/core/test_getValue_setValue.cpp: https://github.com/emscripten-core/emscripten/blob/main/test/core/test_getValue_setValue.cpp +.. _test/core/test_em_asm_2.cpp: https://github.com/emscripten-core/emscripten/blob/main/test/core/test_em_asm_2.cpp .. _test/test_core.py: https://github.com/emscripten-core/emscripten/blob/main/test/test_core.py .. _Box2D: https://github.com/kripken/box2d.js/#box2djs .. _Bullet: https://github.com/kripken/ammo.js/#ammojs