Skip to content

cleanup: reduce the number of #include "env.h" and #include "env-inl.h" in the code base #27531

Closed
@joyeecheung

Description

@joyeecheung

Because of how Environment is used in the code base (e.g. to grab Node.js things from callbacks, to have fast access to persistent properties), Environment is used in almost every C++ file, which results in a lot of #include "env.h" and #include "env-inl.h" in the code base. However many files (mostly headers) only need a forward declaration of class Environment instead of requiring env.h or env-inl.h because they just need to know the Environment type to have Environment* in the declarations. When there is code in a header that actually uses something from Environment (so a forward declaration is not enough), the code may be moved out of the header if it is not in a hot path (i.e. it does not need to be inlined).

Reducing the number of these includes should reduce the amount of files being compiled whenever env.h/env-inl.h is touched.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++Issues and PRs that require attention from people who are familiar with C++.good first issueIssues that are suitable for first-time contributors.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions