On 08/03/2018 11:14 AM, Kent Williams wrote:
> I have embedded the TypeScript compiler in SpiderMonkey. The way I did
> it was to add the minimal JSNative functions needed to support what the
> compiler needs. If you're curious, grab the TypeScript source look at
> Typescript/src/compiler/sys.ts.
Heh. Sounds pretty crazy, and cool.
I doubt it. You'd probably have to modify the TypeScript compiler to
compile down to self-hosted SpiderMonkey code instead of JS (eg, replace
every single function call with callFunction()), then compile the
original TS->JS compiler with that. I've never written anything in
self-hosted code, only read it, but self-hosted code feels like an
incredibly restrictive environment. I think it also gets cloned in a
weird way to every compartment that uses it.