Add BinaryenModuleParseWithFeatures to C and JS APIs#8872
Conversation
| } | ||
|
|
||
| function test_parsing_with_features() { | ||
| var text; |
There was a problem hiding this comment.
I just followed the structure of test_parsing above. Addressed in ecb4042.
| @@ -1 +1,2 @@ | |||
| parsing invalid text... | |||
There was a problem hiding this comment.
This was automatically updated when I ran auto_update_tests.py.
It appears that this line might be the cause of it, but I'm not sure why the .txt file didn't used to contain this line - I can remove it if needed.
There was a problem hiding this comment.
Thanks, I see. I guess we didn't auto-update this test recently.
| text = module.emitText(); | ||
| module.dispose(); | ||
| module = null; | ||
| console.log('test_parsing_with_features text:\n' + text); |
There was a problem hiding this comment.
Maybe as a simpler thing than all this code up to here, just do
var text = `
(module
(global $g anyref (ref.null any))
)
`;
| assert(module2.validate()); | ||
| console.log("module loaded from text form with features:"); | ||
| console.log(module2.emitText()); | ||
| module2.dispose(); |
There was a problem hiding this comment.
It would be good to verify it parses ok with all features, but errors without (to prove the param is actually used).
| @@ -1 +1,2 @@ | |||
| parsing invalid text... | |||
There was a problem hiding this comment.
Thanks, I see. I guess we didn't auto-update this test recently.
This PR implements support for parsing the text of a module with a given feature set in both C and Javascript.
This is necessary as not all modules can be successfully parsed with only the MVP feature set being enabled. One example is the module added as part of the
test_parsing_with_featurestest case - If usingBinaryenModuleParse, the module will fail to parse withand since this error is thrown at parse-time, there is no way to enable the GC feature prior to parsing.