|
@@ -3295,6 +3295,7 @@ var
|
|
Arr: TJSONArray;
|
|
Arr: TJSONArray;
|
|
i: Integer;
|
|
i: Integer;
|
|
Ref: TResolvedReference;
|
|
Ref: TResolvedReference;
|
|
|
|
+ Scope: TPas2JSClassScope;
|
|
begin
|
|
begin
|
|
WritePasElement(Obj,El,aContext);
|
|
WritePasElement(Obj,El,aContext);
|
|
if El.PackMode<>pmNone then
|
|
if El.PackMode<>pmNone then
|
|
@@ -3326,9 +3327,13 @@ begin
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
|
|
+ Scope:=El.CustomData as TPas2JSClassScope;
|
|
WriteElementList(Obj,El,'Interfaces',El.Interfaces,aContext,true);
|
|
WriteElementList(Obj,El,'Interfaces',El.Interfaces,aContext,true);
|
|
WriteElementList(Obj,El,'Members',El.Members,aContext);
|
|
WriteElementList(Obj,El,'Members',El.Members,aContext);
|
|
- WriteClassScope(Obj,El.CustomData as TPas2JSClassScope,aContext);
|
|
|
|
|
|
+ if Scope<>nil then
|
|
|
|
+ WriteClassScope(Obj,Scope,aContext)
|
|
|
|
+ else
|
|
|
|
+ Obj.Add('Scope',false); // msIgnoreInterfaces
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -3437,7 +3442,10 @@ end;
|
|
|
|
|
|
procedure TPCUWriter.WriteProperty(Obj: TJSONObject; El: TPasProperty;
|
|
procedure TPCUWriter.WriteProperty(Obj: TJSONObject; El: TPasProperty;
|
|
aContext: TPCUWriterContext);
|
|
aContext: TPCUWriterContext);
|
|
|
|
+var
|
|
|
|
+ Scope: TPasPropertyScope;
|
|
begin
|
|
begin
|
|
|
|
+ Scope:=El.CustomData as TPasPropertyScope;
|
|
WriteVariable(Obj,El,aContext);
|
|
WriteVariable(Obj,El,aContext);
|
|
WriteExpr(Obj,El,'Index',El.IndexExpr,aContext);
|
|
WriteExpr(Obj,El,'Index',El.IndexExpr,aContext);
|
|
WriteExpr(Obj,El,'Read',El.ReadAccessor,aContext);
|
|
WriteExpr(Obj,El,'Read',El.ReadAccessor,aContext);
|
|
@@ -3458,7 +3466,10 @@ begin
|
|
if El.IsNodefault then
|
|
if El.IsNodefault then
|
|
Obj.Add('NoDefault',true);
|
|
Obj.Add('NoDefault',true);
|
|
|
|
|
|
- WritePropertyScope(Obj,El.CustomData as TPasPropertyScope,aContext);
|
|
|
|
|
|
+ if Scope<>nil then
|
|
|
|
+ WritePropertyScope(Obj,Scope,aContext)
|
|
|
|
+ else
|
|
|
|
+ Obj.Add('Scope',false); // msIgnoreInterfaces
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TPCUWriter.WriteProcedureModifiers(Obj: TJSONObject;
|
|
procedure TPCUWriter.WriteProcedureModifiers(Obj: TJSONObject;
|
|
@@ -3518,7 +3529,9 @@ var
|
|
begin
|
|
begin
|
|
WritePasElement(Obj,El,aContext);
|
|
WritePasElement(Obj,El,aContext);
|
|
Scope:=El.CustomData as TPas2JSProcedureScope;
|
|
Scope:=El.CustomData as TPas2JSProcedureScope;
|
|
- if Scope.DeclarationProc=nil then
|
|
|
|
|
|
+ //writeln('TPCUWriter.WriteProcedure ',GetObjName(El),' ',GetObjName(Scope),' ',Resolver.GetElementSourcePosStr(El));
|
|
|
|
+ // BEWARE: Scope can be nil for ignored methods of an interface (msIgnoreInterfaces)
|
|
|
|
+ if (Scope=nil) or (Scope.DeclarationProc=nil) then
|
|
begin
|
|
begin
|
|
WriteElementProperty(Obj,El,'ProcType',El.ProcType,aContext);
|
|
WriteElementProperty(Obj,El,'ProcType',El.ProcType,aContext);
|
|
WriteExpr(Obj,El,'Public',El.PublicName,aContext);
|
|
WriteExpr(Obj,El,'Public',El.PublicName,aContext);
|
|
@@ -3537,6 +3550,11 @@ begin
|
|
Obj.Add('MessageType',PCUProcedureMessageTypeNames[El.MessageType]);
|
|
Obj.Add('MessageType',PCUProcedureMessageTypeNames[El.MessageType]);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ if Scope=nil then
|
|
|
|
+ begin
|
|
|
|
+ Obj.Add('Scope',false); // msIgnoreInterfaces
|
|
|
|
+ exit;
|
|
|
|
+ end;
|
|
WriteProcedureScope(Obj,Scope,aContext);
|
|
WriteProcedureScope(Obj,Scope,aContext);
|
|
end
|
|
end
|
|
else
|
|
else
|
|
@@ -4008,6 +4026,7 @@ procedure TPCUReader.Set_ClassScope_DirectAncestor(RefEl: TPasElement;
|
|
Data: TObject);
|
|
Data: TObject);
|
|
var
|
|
var
|
|
Scope: TPas2JSClassScope absolute Data;
|
|
Scope: TPas2JSClassScope absolute Data;
|
|
|
|
+ AncestorScope: TPas2JSClassScope;
|
|
aClassAncestor: TPasType;
|
|
aClassAncestor: TPasType;
|
|
begin
|
|
begin
|
|
if not (RefEl is TPasType) then
|
|
if not (RefEl is TPasType) then
|
|
@@ -4019,8 +4038,9 @@ begin
|
|
aClassAncestor:=Resolver.ResolveAliasType(Scope.DirectAncestor);
|
|
aClassAncestor:=Resolver.ResolveAliasType(Scope.DirectAncestor);
|
|
if not (aClassAncestor is TPasClassType) then
|
|
if not (aClassAncestor is TPasClassType) then
|
|
RaiseMsg(20180214114322,Scope.Element,GetObjName(RefEl));
|
|
RaiseMsg(20180214114322,Scope.Element,GetObjName(RefEl));
|
|
- Scope.AncestorScope:=aClassAncestor.CustomData as TPas2JSClassScope;
|
|
|
|
- if pcsfPublished in Scope.AncestorScope.Flags then
|
|
|
|
|
|
+ AncestorScope:=aClassAncestor.CustomData as TPas2JSClassScope;
|
|
|
|
+ Scope.AncestorScope:=AncestorScope;
|
|
|
|
+ if (AncestorScope<>nil) and (pcsfPublished in Scope.AncestorScope.Flags) then
|
|
Include(Scope.Flags,pcsfPublished);
|
|
Include(Scope.Flags,pcsfPublished);
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -6424,8 +6444,13 @@ begin
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
- Scope:=TPas2JSClassScope(Resolver.CreateScope(El,Resolver.ScopeClass_Class));
|
|
|
|
- El.CustomData:=Scope;
|
|
|
|
|
|
+ if Obj.Find('Scope') is TJSONBoolean then
|
|
|
|
+ Scope:=nil // msIgnoreInterfaces
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ Scope:=TPas2JSClassScope(Resolver.CreateScope(El,Resolver.ScopeClass_Class));
|
|
|
|
+ El.CustomData:=Scope;
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
|
|
|
|
ReadPasElement(Obj,El,aContext);
|
|
ReadPasElement(Obj,El,aContext);
|
|
@@ -6454,13 +6479,11 @@ begin
|
|
ReadString(Obj,'ExternalName',El.ExternalName,El);
|
|
ReadString(Obj,'ExternalName',El.ExternalName,El);
|
|
|
|
|
|
if Scope<>nil then
|
|
if Scope<>nil then
|
|
- begin
|
|
|
|
ReadClassScope(Obj,Scope,aContext);
|
|
ReadClassScope(Obj,Scope,aContext);
|
|
- // read Members as last
|
|
|
|
- ReadElementList(Obj,El,'Members',El.Members,aContext);
|
|
|
|
-
|
|
|
|
|
|
+ // read Members
|
|
|
|
+ ReadElementList(Obj,El,'Members',El.Members,aContext);
|
|
|
|
+ if Scope<>nil then
|
|
ReadClassScopeAbstractProcs(Obj,Scope);
|
|
ReadClassScopeAbstractProcs(Obj,Scope);
|
|
- end;
|
|
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TPCUReader.ReadArgument(Obj: TJSONObject; El: TPasArgument;
|
|
procedure TPCUReader.ReadArgument(Obj: TJSONObject; El: TPasArgument;
|
|
@@ -6652,8 +6675,13 @@ procedure TPCUReader.ReadProperty(Obj: TJSONObject; El: TPasProperty;
|
|
var
|
|
var
|
|
Scope: TPasPropertyScope;
|
|
Scope: TPasPropertyScope;
|
|
begin
|
|
begin
|
|
- Scope:=TPasPropertyScope(Resolver.CreateScope(El,TPasPropertyScope));
|
|
|
|
- El.CustomData:=Scope;
|
|
|
|
|
|
+ if Obj.Find('Scope') is TJSONBoolean then
|
|
|
|
+ Scope:=nil // msIgnoreInterfaces
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ Scope:=TPasPropertyScope(Resolver.CreateScope(El,TPasPropertyScope));
|
|
|
|
+ El.CustomData:=Scope;
|
|
|
|
+ end;
|
|
|
|
|
|
ReadVariable(Obj,El,aContext);
|
|
ReadVariable(Obj,El,aContext);
|
|
El.IndexExpr:=ReadExpr(Obj,El,'Index',aContext);
|
|
El.IndexExpr:=ReadExpr(Obj,El,'Index',aContext);
|
|
@@ -6672,7 +6700,8 @@ begin
|
|
ReadBoolean(Obj,'Default',El.IsDefault,El);
|
|
ReadBoolean(Obj,'Default',El.IsDefault,El);
|
|
ReadBoolean(Obj,'NoDefault',El.IsNodefault,El);
|
|
ReadBoolean(Obj,'NoDefault',El.IsNodefault,El);
|
|
|
|
|
|
- ReadPropertyScope(Obj,Scope,aContext);
|
|
|
|
|
|
+ if Scope<>nil then
|
|
|
|
+ ReadPropertyScope(Obj,Scope,aContext);
|
|
end;
|
|
end;
|
|
|
|
|
|
function TPCUReader.ReadProcedureModifiers(Obj: TJSONObject; El: TPasElement;
|
|
function TPCUReader.ReadProcedureModifiers(Obj: TJSONObject; El: TPasElement;
|
|
@@ -6840,8 +6869,13 @@ var
|
|
Ref: TPCUFilerElementRef;
|
|
Ref: TPCUFilerElementRef;
|
|
DeclProc: TPasProcedure;
|
|
DeclProc: TPasProcedure;
|
|
begin
|
|
begin
|
|
- Scope:=TPas2JSProcedureScope(Resolver.CreateScope(El,Resolver.ScopeClass_Procedure));
|
|
|
|
- El.CustomData:=Scope;
|
|
|
|
|
|
+ if Obj.Find('Scope') is TJSONBoolean then
|
|
|
|
+ Scope:=nil // msIgnoreInterfaces
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ Scope:=TPas2JSProcedureScope(Resolver.CreateScope(El,Resolver.ScopeClass_Procedure));
|
|
|
|
+ El.CustomData:=Scope;
|
|
|
|
+ end;
|
|
|
|
|
|
ReadPasElement(Obj,El,aContext);
|
|
ReadPasElement(Obj,El,aContext);
|
|
|
|
|
|
@@ -6891,10 +6925,11 @@ begin
|
|
El.ProcType:=TPasProcedureType(ReadElementProperty(
|
|
El.ProcType:=TPasProcedureType(ReadElementProperty(
|
|
Obj,El,'ProcType',TPasProcedureType,aContext));
|
|
Obj,El,'ProcType',TPasProcedureType,aContext));
|
|
|
|
|
|
- ReadProcedureScope(Obj,Scope,aContext);
|
|
|
|
|
|
+ if Scope<>nil then
|
|
|
|
+ ReadProcedureScope(Obj,Scope,aContext);
|
|
end;
|
|
end;
|
|
|
|
|
|
- if Obj.Find('ImplProc')=nil then
|
|
|
|
|
|
+ if (Scope<>nil) and (Obj.Find('ImplProc')=nil) then
|
|
ReadProcScopeReferences(Obj,Scope);
|
|
ReadProcScopeReferences(Obj,Scope);
|
|
|
|
|
|
if Obj.Find('Body')<>nil then
|
|
if Obj.Find('Body')<>nil then
|