Skip to main content

cpp_file_using_namespaces

Function cpp_file_using_namespaces 

Source
pub fn cpp_file_using_namespaces(source: &str) -> Vec<String>
Expand description

Every using namespace X; directive target in a file, in source order, for resolution-time consumers that need the file’s using-directives without the per-position scope threading extraction does. Parses source fresh and walks the tree structurally, reusing cpp_using_namespace_target (which keys on the grammar’s namespace keyword token, not source text), so it never misreads a member-importing using X::Y; as a namespace directive.

This is a whole-file over-approximation of what is in scope at any one point (a directive nested inside a namespace {} block or a function body is still reported), which is exactly what the #1134 identity reconciler wants: extra candidate namespaces that no visible class confirms are harmless, and two that both confirm are treated as a genuine ambiguity by the reconciler.