* fixed node complexity calculation for certain inlinenodes

(mantis 12404)

git-svn-id: trunk@12020 -
This commit is contained in:
Jonas Maebe 2008-11-02 14:50:17 +00:00
parent 7c919b3c74
commit 7f8e9b8d35
3 changed files with 45 additions and 2 deletions

1
.gitattributes vendored
View File

@ -8604,6 +8604,7 @@ tests/webtbs/tw12242.pp svneol=native#text/plain
tests/webtbs/tw12249.pp svneol=native#text/plain
tests/webtbs/tw1228.pp svneol=native#text/plain
tests/webtbs/tw1229.pp svneol=native#text/plain
tests/webtbs/tw12404.pp svneol=native#text/plain
tests/webtbs/tw1250.pp svneol=native#text/plain
tests/webtbs/tw12508a.pp svneol=native#text/plain
tests/webtbs/tw1251b.pp svneol=native#text/plain

View File

@ -798,13 +798,15 @@ implementation
{ operation (add, sub, or, and }
inc(result);
{ left expression }
inc(result,node_complexity(tbinarynode(p).left));
inc(result,node_complexity(tcallparanode(tunarynode(p).left).left));
if (result >= NODE_COMPLEXITY_INF) then
begin
result := NODE_COMPLEXITY_INF;
exit;
end;
p := tbinarynode(p).right;
p:=tcallparanode(tunarynode(p).left).right;
if assigned(p) then
p:=tcallparanode(p).left;
end;
else
begin

40
tests/webtbs/tw12404.pp Normal file
View File

@ -0,0 +1,40 @@
{ %norun }
{$mode objfpc}
{$h+}
{$inline on}
unit tw12404;
interface
Type
TMyClass = Class(TObject)
Private
FPos : integer;
FChar : PChar;
Function MyFunc : Char; inline;
Function MyOtherFunction : Integer;
end;
implementation
Function TMyClass.MyFunc : Char; inline;
begin
Inc(FPos);
Inc(FChar);
Result:=FChar^;
end;
Function TMyClass.MyOtherFunction : Integer;
Var
C : Char;
begin
C:=MyFunc;
end;
end.