This repository has been archived by the owner on Sep 8, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change the way common methods are mixed in to TypeScript-based lexers (…
…rouge-ruby#1527) Sometimes it makes sense for a Rouge lexer to inherit methods from more than one class. Ruby does not have multiple class inheritance and so the idiomatic solution in Rouge is to extract the methods that should be shared into a common module that can be mixed in to the relevant lexers. A Ruby module can be mixed in via either calling `include` or `extend`. If the module is mixed in via `include`, then the methods are added as instance methods of the mixing class. If the module is mixed in via `extend`, the methods are added to the singleton class of the mixing class. Given the way Rouge is architected, it is more correct for the common module to be extended (not doing so can cause issues with overloading methods). This commit updates the TypeScript and TSX lexers to mix in the `TypescriptCommon` module by calling `extend` rather than `include`.
- Loading branch information