43#ifndef COMPILER_MODULE_BINDER_H
44#define COMPILER_MODULE_BINDER_H
108 return "Missing_Metadata";
110 return "Ambiguous_Value_Name";
112 return "Ambiguous_Type_Name";
118namespace Compiler_Module_Binder_Detail {
171 for (
size_t i = 0; i <
linkage.issues.size(); ++i)
174 for (
size_t i = 0; i <
linkage.modules.size(); ++i)
186 for (
size_t j = 0; j <
linked_module.visible_exports.size(); ++j)
189 const std::string key =
197 else if (prev->second !=
exp.source_module_index)
205 for (
size_t j = 0; j <
linked_module.visible_exports.size(); ++j)
208 const std::string key =
216 bindings.
names.append({item.kind,
218 item.source_module_index,
219 item.source_module_name,
220 item.declaration_span,
224 result.
modules.append(std::move(bindings));
237 std::ostringstream
out;
238 out <<
"ModuleBindings\n";
239 for (
size_t i = 0; i < result.
modules.size(); ++i)
241 const auto &
module = result.modules.access(i);
242 out <<
" Module(" <<
module.module_name << ") order=" << module.order_index << '\n';
243 for (
size_t j = 0; j <
module.names.size(); ++j)
245 const auto &item =
module.names.access(j);
247 <<
")) -> " << item.provider_module_name <<
' '
248 << (item.imported ?
"imported" :
"local");
249 if (item.declaration_span.is_valid())
250 out <<
" @" << item.declaration_span.to_string();
255 for (
size_t i = 0; i < result.
issues.size(); ++i)
259 <<
") module=" <<
issue.module_name;
261 out <<
" name=" <<
issue.symbol_name;
262 if (
not issue.referenced_module_name.empty())
263 out <<
" dependency=" <<
issue.referenced_module_name;
264 if (
not issue.first_provider_module.empty())
265 out <<
" first=" <<
issue.first_provider_module;
266 if (
not issue.second_provider_module.empty())
267 out <<
" second=" <<
issue.second_provider_module;
268 if (
issue.span.is_valid())
269 out <<
" @" <<
issue.span.to_string();
Reusable linking helpers for module surfaces and direct imports.
size_t size_t int32_t * out
Generic key-value map implemented on top of a binary search tree.
__gmp_expr< T, __gmp_unary_expr< __gmp_expr< T, U >, __gmp_exp_function > > exp(const __gmp_expr< T, U > &expr)
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
int export_namespace_bucket(const Compiler_Module_Export_Kind kind) noexcept
Compiler_Module_Binding_Issue translate_issue(const Compiler_Module_Linkage_Issue &issue)
Main namespace for Aleph-w library functions.
Compiler_Module_Export_Kind
Export kinds currently modeled by reusable module metadata.
Compiler_Module_Binding_Issue_Kind
Structural issues emitted while binding linked module surfaces.
const char * compiler_module_export_kind_name(const Compiler_Module_Export_Kind kind) noexcept
Returns the stable debug name for one module-export kind.
const char * compiler_module_binding_issue_name(const Compiler_Module_Binding_Issue_Kind kind) noexcept
Returns the stable debug name for one module-binding issue kind.
std::string compiler_render_module_bindings(const Compiler_Module_Binding_Result &result)
Renders one deterministic text artifact for bound module names.
Compiler_Module_Binding_Result compiler_bind_module_surfaces(const Compiler_Module_Link_Result &linkage)
Binds linked module surfaces into one deterministic name view.
One structural issue reported by the reusable module binder.
std::string second_provider_module
Compiler_Module_Binding_Issue_Kind kind
std::string referenced_module_name
std::string first_provider_module
Binding result over one linked module-surface view.
DynArray< Compiler_Module_Bindings > modules
DynArray< Compiler_Module_Binding_Issue > issues
Bound top-level names visible from one module.
DynArray< Compiler_Module_Bound_Name > names
One top-level name successfully bound in a module namespace.
std::string provider_module_name
Source_Span declaration_span
size_t provider_module_index
Compiler_Module_Export_Kind kind
bool imported
false for local bindings, true for direct-imported bindings.
Link result over module descriptors and module metadata.
One structural issue reported by the reusable module linker.
Half-open byte range inside a source file.
Dynamic key-value map based on balanced binary search trees.