Closed mike-lischke closed 7 years ago
The expectation is imports are automatically added for everything generated by the templates. However, if the grammar contains actions which are copied directly (anything from @members
to actions/predicates), they might need to include a @header
action to import the required items.
Hmm, ok, in TS you have an own import per class, while in C++, when you import one file for an exception, you automatically have all other exceptions included as well. Thanks.
@mike-lischke: There's an open issue #195 proposing an alternative to the file-per-class structure for imports. During porting from Java, we left things file-per-class, but it's not clear to me if that's good style for Typescript or not.
Well, certainly interesting to group things (like the exception hierarchy or ATNState and ATNStateType etc.). However, I have no problem with adding explicit imports when required. Just wanted to clarify the intended approach here
I'm not 100% sure this is really a bug or by design. At least in the C++ target you have to manually add all the
#include
calls yourself.However, in the TS target there are some imports that are automatically added, including the
FailedPredicateException
class. Grammars might use other exceptions (e.g.InputMismatchException
in the CPP14.g4 grammar), though. Should that automatically be included as well or would a named action be required for the import?