Closed Bug 1165754 Opened 10 years ago Closed 10 years ago

Strange behavior in the jsshell on emscripten generated code.

Categories

(Core :: JavaScript Engine, defect)

40 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: mbx, Unassigned)

Details

Attachments

(1 file)

616.23 KB, application/x-javascript
Details
Attached file native.js
STR: 1. Run the attached file in the js shell. At some point the code calls |quit|. 2. Uncomment the call to |foobar()| (which doesn't do anything) on line, 15093, and run the script again. Now the script completes without calling |quit|. Why does the call to foobar change the behavior of the script?
It affects parsing, because it's ambiguous there. You have (function(..) {..}) // foobar(); // Uncomment me! // EMSCRIPTEN_END_ASM (Module.asmGlobalArg, Module.asmLibraryArg, buffer); As long as that line is commented, the last line is a bunch of args sent to that function, and it is called. If uncommented, then the function is not called, an automatic semicolon is inserted at the end of the first line, and the last line is just some comma operator stuff with no effects. (Emscripten puts them on different lines because we use that // EMSCRIPTEN_END_ASM line to simplify parsing.)
Silly of me not to notice, thanks.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: