refactor: use macros to reduce duplicated codes in injection fields.#1755
Closed
7086cmd wants to merge 1 commit intorolldown:mainfrom
Closed
refactor: use macros to reduce duplicated codes in injection fields.#17557086cmd wants to merge 1 commit intorolldown:mainfrom
7086cmd wants to merge 1 commit intorolldown:mainfrom
Conversation
✅ Deploy Preview for rolldown-rs canceled.
|
Member
|
Using macros is rejected. It's bad for maintaining. |
Member
|
We try to avoid macros as much as we can. A macro should be used for DSLs or super repetitive work. The usage here can be replicated by simple functions (I think). |
Member
|
Yeah. Duplication isn't bad always. Introducing abstraction too early might be bad for future refactoring. |
Contributor
Author
|
I see. But the logic of these four is simply the same. I am wondering if there is a better way except for macros instead of copying them...? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduction
This PR introduces several improvements and new features, focusing on code optimization and support for additional plugin functionalities.
Contents
Code Optimization using Macros:
ecma_generator.rs, specifically targeting the format renderers.Plugintrait is excluded from macro optimization due to an issue with async traits not being compatible with the macros.Plugin Enhancements:
introandoutroin plugins, using feat: supportoutput.footerin plugins. #1713 as a reference example.By utilizing macros, we've significantly reduced the amount of duplicated code, making the codebase cleaner and easier to maintain.