Skip to content

Merge standardModuleMapping into single knownIncludes#313

Open
davispuh wants to merge 1 commit into
jacob-carlborg:masterfrom
davispuh:merge
Open

Merge standardModuleMapping into single knownIncludes#313
davispuh wants to merge 1 commit into
jacob-carlborg:masterfrom
davispuh:merge

Conversation

@davispuh

@davispuh davispuh commented Jul 4, 2026

Copy link
Copy Markdown

Currently there is standardModuleMapping and knownIncludes which are basically duplicates and does similar thing so merge them into single mapping.

Copilot AI review requested due to automatic review settings July 4, 2026 22:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR consolidates the previously duplicated include-to-module mappings (standardModuleMapping and knownIncludes) into a single shared knownIncludes mapping so both HeaderIndex and IncludeHandler can rely on one source of truth.

Changes:

  • Moved/centralized knownIncludes into HeaderIndex.d and re-used it from HeaderIndex constructor.
  • Removed standardModuleMapping from HeaderIndex and removed the old knownIncludes initialization from IncludeHandler.
  • Simplified IncludeHandler.isKnownInclude to a direct lookup (but this introduces a behavioral regression; see comments).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
dstep/translator/IncludeHandler.d Removes local knownIncludes and changes how includes are recognized as “known”.
dstep/translator/HeaderIndex.d Introduces package-level knownIncludes and uses it as the single module-mapping source.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 168 to 172
string isKnownInclude (string include)
{
import std.path : stripExtension, baseName;

include = stripExtension(baseName(include));

if (auto ptr = include in knownIncludes)
return *ptr;
else
Comment on lines +235 to +237
"math.h" : "core.stdc.math",
"signal.h" : "core.stdc.signal",
"stdarg.h" : "core.stdc.stdarg",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants