fix, unhanlded declarations caused wrong results
This commit is contained in:
parent
d9b6828205
commit
fb2b2182e2
|
@ -116,7 +116,6 @@ public:
|
||||||
{
|
{
|
||||||
const Parent savedParent = _parent;
|
const Parent savedParent = _parent;
|
||||||
bool privatePushed;
|
bool privatePushed;
|
||||||
_parent = Parent.function_;
|
|
||||||
|
|
||||||
scope(exit)
|
scope(exit)
|
||||||
{
|
{
|
||||||
|
@ -124,6 +123,14 @@ public:
|
||||||
_parent = savedParent;
|
_parent = savedParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!d.attributeDeclaration &&
|
||||||
|
!d.classDeclaration &&
|
||||||
|
!d.structDeclaration &&
|
||||||
|
!d.unionDeclaration &&
|
||||||
|
!d.interfaceDeclaration &&
|
||||||
|
!d.functionDeclaration)
|
||||||
|
return;
|
||||||
|
|
||||||
import std.algorithm.searching : find;
|
import std.algorithm.searching : find;
|
||||||
import std.algorithm.iteration: filter;
|
import std.algorithm.iteration: filter;
|
||||||
import std.range.primitives : empty;
|
import std.range.primitives : empty;
|
||||||
|
@ -172,6 +179,7 @@ public:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// check final functions
|
// check final functions
|
||||||
|
_parent = Parent.function_;
|
||||||
const(FunctionDeclaration) fd = d.functionDeclaration;
|
const(FunctionDeclaration) fd = d.functionDeclaration;
|
||||||
|
|
||||||
if (isFinal) final switch(savedParent)
|
if (isFinal) final switch(savedParent)
|
||||||
|
@ -248,6 +256,21 @@ public:
|
||||||
class Foo{private: public: final void foo(){}}
|
class Foo{private: public: final void foo(){}}
|
||||||
}, sac);
|
}, sac);
|
||||||
|
|
||||||
|
assertAnalyzerWarnings(q{
|
||||||
|
class Foo{private: public: final void foo(){}}
|
||||||
|
}, sac);
|
||||||
|
|
||||||
|
assertAnalyzerWarnings(q{
|
||||||
|
class Impl
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
static if (true)
|
||||||
|
{
|
||||||
|
protected final void _wrap_getSource() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, sac);
|
||||||
|
|
||||||
// fail
|
// fail
|
||||||
|
|
||||||
assertAnalyzerWarnings(q{
|
assertAnalyzerWarnings(q{
|
||||||
|
@ -262,6 +285,16 @@ public:
|
||||||
FinalAttributeChecker.MSGB.format(FinalAttributeChecker.MESSAGE.func_n)
|
FinalAttributeChecker.MSGB.format(FinalAttributeChecker.MESSAGE.func_n)
|
||||||
), sac);
|
), sac);
|
||||||
|
|
||||||
|
assertAnalyzerWarnings(q{
|
||||||
|
void foo()
|
||||||
|
{
|
||||||
|
static if (true)
|
||||||
|
final class A{ private: final protected void foo(){}} // [warn]: %s
|
||||||
|
}
|
||||||
|
}c.format(
|
||||||
|
FinalAttributeChecker.MSGB.format(FinalAttributeChecker.MESSAGE.class_f)
|
||||||
|
), sac);
|
||||||
|
|
||||||
assertAnalyzerWarnings(q{
|
assertAnalyzerWarnings(q{
|
||||||
final struct Foo{} // [warn]: %s
|
final struct Foo{} // [warn]: %s
|
||||||
}c.format(
|
}c.format(
|
||||||
|
|
Loading…
Reference in New Issue