Comments and (failing) tests
This commit is contained in:
parent
76fb7dee43
commit
037619964f
2 changed files with 28 additions and 2 deletions
|
|
@ -24,7 +24,9 @@ namespace
|
||||||
if (skip_if(stream, "inline"))
|
if (skip_if(stream, "inline"))
|
||||||
is_inline = true;
|
is_inline = true;
|
||||||
|
|
||||||
// C++17 nested namespace declarations
|
// C++17 nested namespace declarations get one cursor per nested name.
|
||||||
|
// The first cursor starts with the `namespace` keyword, and the
|
||||||
|
// following start with the `::` separator. Either way, it is skipped.
|
||||||
if (!detail::skip_if(stream, "namespace"))
|
if (!detail::skip_if(stream, "namespace"))
|
||||||
skip(stream, "::");
|
skip(stream, "::");
|
||||||
|
|
||||||
|
|
@ -40,7 +42,8 @@ namespace
|
||||||
auto other_attributes = parse_attributes(stream);
|
auto other_attributes = parse_attributes(stream);
|
||||||
attributes.insert(attributes.end(), other_attributes.begin(), other_attributes.end());
|
attributes.insert(attributes.end(), other_attributes.begin(), other_attributes.end());
|
||||||
|
|
||||||
// C++17 nested namespace declarations
|
// If the next token is not `::`, there are no more nested namespace
|
||||||
|
// names, and we expect to see an opening brace.
|
||||||
if (!detail::skip_if(stream, "::"))
|
if (!detail::skip_if(stream, "::"))
|
||||||
skip(stream, "{");
|
skip(stream, "{");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,16 @@ namespace c
|
||||||
/// namespace {
|
/// namespace {
|
||||||
/// }
|
/// }
|
||||||
namespace {}
|
namespace {}
|
||||||
|
|
||||||
|
/// namespace e{
|
||||||
|
/// namespace f{
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
namespace e::f {}
|
||||||
|
|
||||||
|
/// \entity e::f
|
||||||
|
/// namespace f{
|
||||||
|
/// }
|
||||||
)";
|
)";
|
||||||
|
|
||||||
auto file = parse({}, "cpp_namespace.cpp", code);
|
auto file = parse({}, "cpp_namespace.cpp", code);
|
||||||
|
|
@ -69,6 +79,19 @@ namespace {}
|
||||||
REQUIRE(!ns.is_inline());
|
REQUIRE(!ns.is_inline());
|
||||||
REQUIRE(no_children == 0u);
|
REQUIRE(no_children == 0u);
|
||||||
}
|
}
|
||||||
|
else if (ns.name() == "e")
|
||||||
|
{
|
||||||
|
REQUIRE(!ns.is_anonymous());
|
||||||
|
REQUIRE(!ns.is_inline());
|
||||||
|
REQUIRE(no_children == 1u);
|
||||||
|
}
|
||||||
|
else if (ns.name() == "f")
|
||||||
|
{
|
||||||
|
REQUIRE(!ns.is_anonymous());
|
||||||
|
check_parent(ns, "e", "e::f");
|
||||||
|
REQUIRE(!ns.is_inline());
|
||||||
|
REQUIRE(no_children == 0u);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
REQUIRE(false);
|
REQUIRE(false);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue