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
At the moment I am mostly interested in macros for more perform ant logging/tracing in typescript. So conditional execution that can be decided by the environment is crucial.
In addition to that, the line, function and file directives have been missing from the typescript spec. I would like to get them back.
Would it be possible to add these?
The text was updated successfully, but these errors were encountered:
It certainly seems possible. Are you just saying you want access to that ambient information in the body of macros so you can use it when emitting logging/tracing statements? Such as this?
It seems very doable to add that kind of information to MacroContext, since the functions that expand macros (attemptBlockMacro, attemptFunctionMacro, attemptDecoratorMacros, attemptImportMacro in lib/transformer.ts) are already passed:
CompileContext which contains information about the current file.
And the actual ts.TextRange/ts.Node objects the macro is transforming, which can be used to figure out the line/column.
I'm not sure function would be very easy, the various functions that walk the AST would all have to be made aware of the nearest parent function they were in, and honestly it doesn't even seem that necessary when you already have line/column.
I don't really have the bandwidth to work on macro-ts right now, but I'm happy to accept pull requests and give pointers :)
At the moment I am mostly interested in macros for more perform ant logging/tracing in typescript. So conditional execution that can be decided by the environment is crucial.
In addition to that, the line, function and file directives have been missing from the typescript spec. I would like to get them back.
Would it be possible to add these?
The text was updated successfully, but these errors were encountered: