* Fixed release problem and except (reported by Seth Grover)

git-svn-id: trunk@21922 -
This commit is contained in:
michael 2012-07-16 20:52:22 +00:00
parent 5e93f6b70f
commit a4be3f17d7
2 changed files with 7 additions and 3 deletions

View File

@ -1292,6 +1292,7 @@ begin
end; end;
procedure TPasElement.Release; procedure TPasElement.Release;
begin begin
if FRefCount = 0 then if FRefCount = 0 then
Free Free
@ -1808,7 +1809,10 @@ procedure TPasImplForLoop.AddElement(Element: TPasImplElement);
begin begin
inherited AddElement(Element); inherited AddElement(Element);
if Body=nil then if Body=nil then
Body:=Element begin
Body:=Element;
Body.AddRef;
end
else else
raise Exception.Create('TPasImplForLoop.AddElement body already set - please report this bug'); raise Exception.Create('TPasImplForLoop.AddElement body already set - please report this bug');
end; end;

View File

@ -3038,7 +3038,7 @@ begin
end; end;
tkIf: tkIf:
begin begin
Condition:=ParseExpression(Parent); Condition:=ParseExpression(CurBlock);
el:=TPasImplIfElse(CreateElement(TPasImplIfElse,'',CurBlock)); el:=TPasImplIfElse(CreateElement(TPasImplIfElse,'',CurBlock));
TPasImplIfElse(el).Condition:=Condition; TPasImplIfElse(el).Condition:=Condition;
//WriteLn(i,'IF Condition="',Condition,'" Token=',CurTokenText); //WriteLn(i,'IF Condition="',Condition,'" Token=',CurTokenText);
@ -3241,7 +3241,7 @@ begin
//writeln(i,'EXCEPT'); //writeln(i,'EXCEPT');
el:=TPasImplTryExcept(CreateElement(TPasImplTryExcept,'',CurBlock)); el:=TPasImplTryExcept(CreateElement(TPasImplTryExcept,'',CurBlock));
TPasImplTry(CurBlock).FinallyExcept:=TPasImplTryExcept(el); TPasImplTry(CurBlock).FinallyExcept:=TPasImplTryExcept(el);
CurBlock.AddElement(el); // CurBlock.AddElement(el);
CurBlock:=TPasImplTryExcept(el); CurBlock:=TPasImplTryExcept(el);
end else end else
ParseExc(SParserSyntaxError); ParseExc(SParserSyntaxError);