Fix constructor prefix skipping
This commit is contained in:
parent
7a9f6fdfac
commit
232842f2f6
1 changed files with 27 additions and 23 deletions
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include <cppast/cpp_function.hpp>
|
#include <cppast/cpp_function.hpp>
|
||||||
#include <cppast/cpp_member_function.hpp>
|
#include <cppast/cpp_member_function.hpp>
|
||||||
#include <clang-c/Index.h>
|
|
||||||
|
|
||||||
#include "libclang_visitor.hpp"
|
#include "libclang_visitor.hpp"
|
||||||
#include "parse_functions.hpp"
|
#include "parse_functions.hpp"
|
||||||
|
|
@ -159,34 +158,39 @@ namespace
|
||||||
// name can have multiple tokens if it is an operator
|
// name can have multiple tokens if it is an operator
|
||||||
if (!detail::skip_if(stream, name, true))
|
if (!detail::skip_if(stream, name, true))
|
||||||
return false;
|
return false;
|
||||||
else if (!is_ctor)
|
else if (stream.peek() == "," || stream.peek() == ">" || stream.peek() == ">>")
|
||||||
return true;
|
// argument to template parameters
|
||||||
// if we reach this point, we've encountered the name of a constructor
|
|
||||||
// need to make sure it is not actually a class name
|
|
||||||
else if (stream.peek() == "::")
|
|
||||||
{
|
|
||||||
// after name came "::", it is a class name
|
|
||||||
stream.set_cur(cur);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
else if (is_ctor)
|
||||||
else if (stream.peek() == "<")
|
|
||||||
{
|
{
|
||||||
// after name came "<", it might be arguments for a class template,
|
// need to make sure it is not actually a class name
|
||||||
// or just a specialization
|
if (stream.peek() == "::")
|
||||||
// check if ( comes after the arguments
|
|
||||||
detail::skip_brackets(stream);
|
|
||||||
if (stream.peek() == "(")
|
|
||||||
{
|
{
|
||||||
// it was just a specialization, we're at the end
|
// after name came "::", it is a class name
|
||||||
stream.set_cur(cur);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// class arguments
|
|
||||||
stream.set_cur(cur);
|
stream.set_cur(cur);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if (stream.peek() == "<")
|
||||||
|
{
|
||||||
|
// after name came "<", it might be arguments for a class template,
|
||||||
|
// or just a specialization
|
||||||
|
// check if ( comes after the arguments
|
||||||
|
detail::skip_brackets(stream);
|
||||||
|
if (stream.peek() == "(")
|
||||||
|
{
|
||||||
|
// it was just a specialization, we're at the end
|
||||||
|
stream.set_cur(cur);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// class arguments
|
||||||
|
stream.set_cur(cur);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue