* don't crash when looking for a local/parasym while current_procinfo is

nil, such as while parsing a property definition (mantis )

git-svn-id: trunk@13958 -
This commit is contained in:
Jonas Maebe 2009-10-26 13:48:58 +00:00
parent b4f1121808
commit dd937bd32d
3 changed files with 53 additions and 0 deletions

1
.gitattributes vendored
View File

@ -8734,6 +8734,7 @@ tests/webtbf/tw1467.pp svneol=native#text/plain
tests/webtbf/tw14713.pp svneol=native#text/plain
tests/webtbf/tw14713a.pp svneol=native#text/plain
tests/webtbf/tw1483.pp svneol=native#text/plain
tests/webtbf/tw14849.pp svneol=native#text/plain
tests/webtbf/tw1599.pp svneol=native#text/plain
tests/webtbf/tw1599b.pp svneol=native#text/plain
tests/webtbf/tw1633.pp svneol=native#text/plain

View File

@ -344,6 +344,10 @@ implementation
var
pd : tprocdef;
begin
result:=nil;
{ is not assigned while parsing a property }
if not assigned(current_procinfo) then
exit;
{ we can't use searchsym here, because the
symtablestack is not fully setup when pass1
is run for nested procedures }

48
tests/webtbf/tw14849.pp Normal file
View File

@ -0,0 +1,48 @@
{ %norun }
{ %fail }
unit tw14849;
{$mode objfpc}
interface
uses
Classes, SysUtils;
type
TMarkerState=(leftActive,rightActive);
TWorldPoint=record
fX,fY:double;
end;
TCoolClass = class(TComponent)
private
fMarkerPos:array[TMarkerState] of TWorldPoint;
{ private declarations }
public
function LeftMarker :integer;
function RightMarker:integer;
{ public declarations }
{ error: using function to index property }
property xLPM:double read fMarkerPos[leftMarker].fX write fMarkerPos[leftmarker].fX;
end;
implementation
function TCoolClass.LeftMarker :integer;
begin
Result:=0;
end;
function TCoolClass.RightMarker:integer;
begin
Result:=1;
end;
end.