Re: ESR52 SpiderMonkey & ES6
Jason Orendorff <[email protected]> Sat, 23 Jun 2018 14:25:21 -0500
| Newsgroups | gmane.comp.mozilla.devel.jseng |
|---|---|
| Message-ID | <CA+W3DWEg1+QP=7gYQZpNhcbLUKFS3F+vaRi4iX7Jr+80pTz2KA@mail.gmail.com> |
You're right, this is super complicated. :-\ Well, I guess the first task is to get an error message. There's no pending exception when these functions return false? -j On Wed, Jun 20, 2018 at 3:11 PM, Kent Williams <[email protected]> wrote: > Been beating my head on this for a couple of days. > > I'm trying to get ES6 module support working with ESR52 SpiderMonkey. > > I can run plain scripts just fine, but if I try using ES6 modules, it > breaks. > > I solved one problem: You can't compile anything 'import' in it without > setting the Module resolver with JS::SetModuleResolveHook. > > Then it turns out you can't use JS::Compile with any code with 'import' in > it -- even if it isn't a module itself. > > But if you use JS::CompileModule, it isn't clear what you have to do to > execute the script. > > What should happen is that you do X (where X is unknown) to execute the > script, and then the interpreter handles the 'import' statements in your > code by calling the resolve hook. > > So my problem is X -- if you have to use JS::CompileModule if there are > any import statements in a script, how do you execute the script? > > Looking at the JS Shell code, the resolve hook is actually in a Javascript > file. I tried doing what that file does (ModuleLoader.js) but it doesn't > work. I call ModuleDeclarationInstantiation followed by ModuleEvaluation > -- and both fail without any error message. They return false, and there's > no apparent error message anywhere. > > Is it the case that no one uses ES6 modules with SpiderMonkey, except > perhaps the Mozilla Browswer & the js shell included? > > > > > _______________________________________________ > dev-tech-js-engine mailing list > [email protected] > https://lists.mozilla.org/listinfo/dev-tech-js-engine >