Open jamesjuett opened 2 years ago
This issue is caused by declarations.createFunctionDeclarationFromDefinitionAST
.
// if the declarator has a qualified name, we need to check to see if a previous
// declaration for the function already exists, and if so, use that one
if (declarator.name && isQualifiedName(declarator.name)) {
let prevEntity = context.program.getLinkedFunctionEntity(declarator.name);
if (prevEntity) {
return prevEntity.firstDeclaration;
}
}
I do not understand this chunk of code. Basically, when we define A::A(string c)
, this function will not be created by createFunctionDeclarationFromDefinitionAST
method. Because this method will lookup the already defined function with the same name. In this case, it will find the default constructor in class A {};
. So, the later invalid declaration does not exist at all.