emscripten icon indicating copy to clipboard operation
emscripten copied to clipboard

Perform cDefs/cStructs macro substitution using acorn pass

Open sbc100 opened this issue 1 year ago • 2 comments

Rather than depending on the JS pre-processor we can achieve better results using and acorn pass. Some upsides of doing it this way are:

  1. Better syntax highlighing since JS library files are closer to normal JS.
  2. Less noise in input files.

In debug builds include the cDefs/cStructs mappings in the generated code. In release builds we use acorn to replace all occurrences of cDefs/cStructs.

sbc100 avatar Jun 29 '24 23:06 sbc100

This is just a draft for now.

sbc100 avatar Jun 29 '24 23:06 sbc100

To see what it looks like when we use this new technique in our JS library code 3ea9b6a15

sbc100 avatar Jun 29 '24 23:06 sbc100