Procházet zdrojové kódy

pas2js: fixed crash on class function

git-svn-id: trunk@45830 -
Mattias Gaertner před 5 roky
rodič
revize
c1fe90524c
1 změnil soubory, kde provedl 3 přidání a 0 odebrání
  1. 3 0
      packages/pastojs/src/fppas2js.pp

+ 3 - 0
packages/pastojs/src/fppas2js.pp

@@ -3274,6 +3274,7 @@ begin
     exit(false); // there is no overload
     exit(false); // there is no overload
 
 
   if (El.ClassType=TPasClassFunction)
   if (El.ClassType=TPasClassFunction)
+      and (El.Parent.ClassType=TPasClassType)
       and (TPas2JSClassScope(TPasClassType(El.Parent).CustomData).NewInstanceFunction=El) then
       and (TPas2JSClassScope(TPasClassType(El.Parent).CustomData).NewInstanceFunction=El) then
     begin
     begin
     Duplicate:=GetDuplicate;
     Duplicate:=GetDuplicate;
@@ -3542,6 +3543,8 @@ var
   Scope: TPasIdentifierScope;
   Scope: TPasIdentifierScope;
 begin
 begin
   i:=FOverloadScopes.Count-1;
   i:=FOverloadScopes.Count-1;
+  if i<0 then
+    RaiseInternalError(20200723125456);
   Scope:=TPasIdentifierScope(FOverloadScopes[i]);
   Scope:=TPasIdentifierScope(FOverloadScopes[i]);
   if Scope.ClassType=TPas2JSOverloadChgThisScope then
   if Scope.ClassType=TPas2JSOverloadChgThisScope then
     Scope.Free;
     Scope.Free;