You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is less an issue but a request for advice. I try to change the way code for namespaces is emitted.
Currently the typescript code
namespace A{
var x = 42;
}
is emitted as
var A;
(function (A) {
var x = 42;
})(A || (A = {}));
which I want to change to be emitted as
var A_x = 42;
Obviously, all references to x also need to become A_x .
I walkted through emitter.ts and declarationEmitter.ts but without being able to stepping through the compilation with a debugger it is hard to fully understand the pieces. So my question:
How can I debug compilation ?
Hints on my namespace hack are also appreciated.
The text was updated successfully, but these errors were encountered:
If you're on Windows with a program that can use the script debugging interface (e.g. Visual Studio), you can use cscript with with /X flag to signal that it should stop on the first statement.
If you want to make it faster, use the Chakra engine using something like the flag /E:{16d51579-a30b-4c8b-a276-0ff4dc41e755}.
If you don't have that privilege, you can use node-inspector and run the compiler with node --debug-brk build/local/tsc.js.
As a word of caution, if you're intending on sending this out as a PR, I don't think we're inclined to accept something like that (or at least, we'd need a proposal to consider first). If it's for your own personal purposes, I fully encourage you to learn about the compiler and experiment. I'd look into emitIdentifier in emitter.ts.
This is less an issue but a request for advice. I try to change the way code for namespaces is emitted.
Currently the typescript code
is emitted as
which I want to change to be emitted as
Obviously, all references to x also need to become A_x .
I walkted through emitter.ts and declarationEmitter.ts but without being able to stepping through the compilation with a debugger it is hard to fully understand the pieces. So my question:
How can I debug compilation ?
Hints on my namespace hack are also appreciated.
The text was updated successfully, but these errors were encountered: