pastojs: fixed crash when parser error in inline specialize expression, issue 38111

This commit is contained in:
mattias 2020-11-28 10:42:37 +00:00
parent 40cd9a84c7
commit 5236a86500
3 changed files with 6 additions and 1 deletions

View File

@ -21056,6 +21056,7 @@ end;
function TPasResolver.FindElementWithoutParams(const AName: String; function TPasResolver.FindElementWithoutParams(const AName: String;
ErrorPosEl: TPasElement; NoProcsWithArgs, NoGenerics: boolean): TPasElement; ErrorPosEl: TPasElement; NoProcsWithArgs, NoGenerics: boolean): TPasElement;
// ErrorPosEl=nil means to use scanner position as error position
var var
Data: TPRFindData; Data: TPRFindData;
begin begin
@ -21070,6 +21071,7 @@ end;
function TPasResolver.FindElementWithoutParams(const AName: String; out function TPasResolver.FindElementWithoutParams(const AName: String; out
Data: TPRFindData; ErrorPosEl: TPasElement; NoProcsWithArgs, Data: TPRFindData; ErrorPosEl: TPasElement; NoProcsWithArgs,
NoGenerics: boolean): TPasElement; NoGenerics: boolean): TPasElement;
// ErrorPosEl=nil means to use scanner position as error position
var var
Abort: boolean; Abort: boolean;
begin begin

View File

@ -2152,7 +2152,7 @@ destructor TInlineSpecializeExpr.Destroy;
var var
i: Integer; i: Integer;
begin begin
TPasElement(NameExpr).Release{$IFDEF CheckPasTreeRefCount}('CreateElement'){$ENDIF}; ReleaseAndNil(TPasElement(NameExpr){$IFDEF CheckPasTreeRefCount},'CreateElement'{$ENDIF});
for i:=0 to Params.Count-1 do for i:=0 to Params.Count-1 do
TPasElement(Params[i]).Release{$IFDEF CheckPasTreeRefCount}('TInlineSpecializeExpr.Params'){$ENDIF}; TPasElement(Params[i]).Release{$IFDEF CheckPasTreeRefCount}('TInlineSpecializeExpr.Params'){$ENDIF};
FreeAndNil(Params); FreeAndNil(Params);

View File

@ -1998,7 +1998,10 @@ begin
finally finally
if not ok then if not ok then
if Result<>nil then if Result<>nil then
begin
Result.Release{$IFDEF CheckPasTreeRefCount}('CreateElement'){$ENDIF}; Result.Release{$IFDEF CheckPasTreeRefCount}('CreateElement'){$ENDIF};
Result:=nil;
end;
end; end;
end; end;