|
@@ -2990,7 +2990,7 @@ begin
|
|
if not aClass.IsExternal then exit;
|
|
if not aClass.IsExternal then exit;
|
|
if aClass.Parent is TPasMembersType then
|
|
if aClass.Parent is TPasMembersType then
|
|
exit; // nested class
|
|
exit; // nested class
|
|
- if not IsExternalClass_Name(aClass,Data^.JSName) then exit;
|
|
|
|
|
|
+ if aClass.ExternalName<>Data^.JSName then exit;
|
|
Data^.Found:=aClass;
|
|
Data^.Found:=aClass;
|
|
Data^.ElScope:=ElScope;
|
|
Data^.ElScope:=ElScope;
|
|
Data^.StartScope:=StartScope;
|
|
Data^.StartScope:=StartScope;
|
|
@@ -4333,12 +4333,12 @@ begin
|
|
okClass:
|
|
okClass:
|
|
begin
|
|
begin
|
|
if (ClassScope.NewInstanceFunction=nil)
|
|
if (ClassScope.NewInstanceFunction=nil)
|
|
|
|
+ and (Proc.ClassType=TPasClassFunction)
|
|
and (ClassScope.AncestorScope<>nil)
|
|
and (ClassScope.AncestorScope<>nil)
|
|
and (TPasClassType(ClassScope.AncestorScope.Element).IsExternal)
|
|
and (TPasClassType(ClassScope.AncestorScope.Element).IsExternal)
|
|
- and (Proc.ClassType=TPasClassFunction)
|
|
|
|
and (Proc.Visibility in [visProtected,visPublic,visPublished])
|
|
and (Proc.Visibility in [visProtected,visPublic,visPublished])
|
|
and (TPasClassFunction(Proc).FuncType.ResultEl.ResultType=AClassOrRec)
|
|
and (TPasClassFunction(Proc).FuncType.ResultEl.ResultType=AClassOrRec)
|
|
- and (Proc.Modifiers*[pmOverride,pmExternal]=[])
|
|
|
|
|
|
+ and (Proc.Modifiers-[pmVirtual,pmAssembler]=[])
|
|
and (Proc.ProcType.Modifiers*[ptmOfObject]=[ptmOfObject]) then
|
|
and (Proc.ProcType.Modifiers*[ptmOfObject]=[ptmOfObject]) then
|
|
begin
|
|
begin
|
|
// The first non private class function in a Pascal class descending
|
|
// The first non private class function in a Pascal class descending
|
|
@@ -14374,7 +14374,7 @@ var
|
|
AncestorPath, OwnerName, DestructorName, FnName, IntfKind: String;
|
|
AncestorPath, OwnerName, DestructorName, FnName, IntfKind: String;
|
|
C: TClass;
|
|
C: TClass;
|
|
AssignSt: TJSSimpleAssignStatement;
|
|
AssignSt: TJSSimpleAssignStatement;
|
|
- NeedInitFunction, HasConstructor: Boolean;
|
|
|
|
|
|
+ NeedInitFunction, HasConstructor, IsJSFunction, NeedClassExt: Boolean;
|
|
Proc: TPasProcedure;
|
|
Proc: TPasProcedure;
|
|
aResolver: TPas2JSResolver;
|
|
aResolver: TPas2JSResolver;
|
|
begin
|
|
begin
|
|
@@ -14419,11 +14419,17 @@ begin
|
|
Call:=CreateCallExpression(El);
|
|
Call:=CreateCallExpression(El);
|
|
try
|
|
try
|
|
AncestorIsExternal:=(Ancestor is TPasClassType) and TPasClassType(Ancestor).IsExternal;
|
|
AncestorIsExternal:=(Ancestor is TPasClassType) and TPasClassType(Ancestor).IsExternal;
|
|
|
|
+ IsJSFunction:=aResolver.IsExternalClass_Name(El,'Function');
|
|
|
|
+
|
|
|
|
+ NeedClassExt:=AncestorIsExternal or IsJSFunction;
|
|
|
|
+ if NeedClassExt and (El.ObjKind<>okClass) then
|
|
|
|
+ RaiseNotSupported(El,AContext,20200627083750);
|
|
|
|
+
|
|
if El.ObjKind=okInterface then
|
|
if El.ObjKind=okInterface then
|
|
FnName:=GetBIName(pbifnIntfCreate)
|
|
FnName:=GetBIName(pbifnIntfCreate)
|
|
else if El.ObjKind in okAllHelpers then
|
|
else if El.ObjKind in okAllHelpers then
|
|
FnName:=GetBIName(pbifnCreateHelper)
|
|
FnName:=GetBIName(pbifnCreateHelper)
|
|
- else if AncestorIsExternal then
|
|
|
|
|
|
+ else if NeedClassExt then
|
|
FnName:=GetBIName(pbifnCreateClassExt)
|
|
FnName:=GetBIName(pbifnCreateClassExt)
|
|
else
|
|
else
|
|
FnName:=GetBIName(pbifnCreateClass);
|
|
FnName:=GetBIName(pbifnCreateClass);
|
|
@@ -14462,7 +14468,7 @@ begin
|
|
AncestorPath:=CreateReferencePath(Ancestor,AContext,rpkPathAndName);
|
|
AncestorPath:=CreateReferencePath(Ancestor,AContext,rpkPathAndName);
|
|
Call.AddArg(CreatePrimitiveDotExpr(AncestorPath,El));
|
|
Call.AddArg(CreatePrimitiveDotExpr(AncestorPath,El));
|
|
|
|
|
|
- if AncestorIsExternal and (El.ObjKind=okClass) then
|
|
|
|
|
|
+ if NeedClassExt then
|
|
begin
|
|
begin
|
|
// add the name of the NewInstance function
|
|
// add the name of the NewInstance function
|
|
if Scope.NewInstanceFunction<>nil then
|
|
if Scope.NewInstanceFunction<>nil then
|