Преглед изворни кода

pas2js: fixed crash on class function

mattias пре 5 година
родитељ
комит
0542edda2a
1 измењених фајлова са 3 додато и 0 уклоњено
  1. 3 0
      compiler/packages/pastojs/src/fppas2js.pp

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

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