|
@@ -810,7 +810,7 @@ type
|
|
|
|
|
|
|
|
TPasRecordType = class(TPasMembersType)
|
|
TPasRecordType = class(TPasMembersType)
|
|
|
private
|
|
private
|
|
|
- procedure GetMembers(S: TStrings);
|
|
|
|
|
|
|
+ procedure GetMembers(S: TStrings; aSkipSection: Boolean=false);
|
|
|
public
|
|
public
|
|
|
constructor Create(const AName: TPasTreeString; AParent: TPasElement); override;
|
|
constructor Create(const AName: TPasTreeString; AParent: TPasElement); override;
|
|
|
destructor Destroy; override;
|
|
destructor Destroy; override;
|
|
@@ -1166,7 +1166,8 @@ type
|
|
|
procedure FreeChildren(Prepare: boolean); override;
|
|
procedure FreeChildren(Prepare: boolean); override;
|
|
|
function ElementTypeName: TPasTreeString; override;
|
|
function ElementTypeName: TPasTreeString; override;
|
|
|
function TypeName: TPasTreeString; override;
|
|
function TypeName: TPasTreeString; override;
|
|
|
- function GetDeclaration(full: Boolean): TPasTreeString; override;
|
|
|
|
|
|
|
+ function GetDeclaration(full: Boolean): TPasTreeString; override; overload;
|
|
|
|
|
+ function GetDeclaration(full, AddArgs, AddModifiers, AddParent: Boolean): TPasTreeString; virtual; overload;
|
|
|
procedure GetModifiers(List: TStrings);
|
|
procedure GetModifiers(List: TStrings);
|
|
|
procedure ForEachCall(const aMethodCall: TOnForEachPasElement;
|
|
procedure ForEachCall(const aMethodCall: TOnForEachPasElement;
|
|
|
const Arg: Pointer); override;
|
|
const Arg: Pointer); override;
|
|
@@ -1268,7 +1269,7 @@ type
|
|
|
function ElementTypeName: TPasTreeString; override;
|
|
function ElementTypeName: TPasTreeString; override;
|
|
|
function TypeName: TPasTreeString; override;
|
|
function TypeName: TPasTreeString; override;
|
|
|
function GetProcTypeEnum: TProcType; override;
|
|
function GetProcTypeEnum: TProcType; override;
|
|
|
- function GetDeclaration (full : boolean) : TPasTreeString; override;
|
|
|
|
|
|
|
+ function GetDeclaration(full, AddArgs, AddModifiers, AddParent: Boolean): TPasTreeString; override;
|
|
|
Property OperatorType : TOperatorType Read FOperatorType Write FOperatorType;
|
|
Property OperatorType : TOperatorType Read FOperatorType Write FOperatorType;
|
|
|
// True if the declaration was using a token instead of an identifier
|
|
// True if the declaration was using a token instead of an identifier
|
|
|
Property TokenBased : Boolean Read FTokenBased Write FTokenBased;
|
|
Property TokenBased : Boolean Read FTokenBased Write FTokenBased;
|
|
@@ -2971,7 +2972,7 @@ begin
|
|
|
Result:=Pred(Result);
|
|
Result:=Pred(Result);
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
-Function TPasOperator.NameSuffix : TPasTreeString;
|
|
|
|
|
|
|
+function TPasOperator.NameSuffix: TPasTreeString;
|
|
|
|
|
|
|
|
Var
|
|
Var
|
|
|
I : Integer;
|
|
I : Integer;
|
|
@@ -3514,7 +3515,7 @@ begin
|
|
|
Result:=Result+': ('+sLineBreak;
|
|
Result:=Result+': ('+sLineBreak;
|
|
|
S:=TStringList.Create;
|
|
S:=TStringList.Create;
|
|
|
try
|
|
try
|
|
|
- Members.GetMembers(S);
|
|
|
|
|
|
|
+ Members.GetMembers(S,True);
|
|
|
Result:=Result+S.Text;
|
|
Result:=Result+S.Text;
|
|
|
finally
|
|
finally
|
|
|
S.Free;
|
|
S.Free;
|
|
@@ -4610,7 +4611,7 @@ begin
|
|
|
If IsPacked then
|
|
If IsPacked then
|
|
|
Result := 'packed '+Result; // 12/04/04 Dave - Added
|
|
Result := 'packed '+Result; // 12/04/04 Dave - Added
|
|
|
If Assigned(Eltype) then
|
|
If Assigned(Eltype) then
|
|
|
- Result:=Result+ElType.GetDeclaration(ElType is TPasUnresolvedTypeRef)
|
|
|
|
|
|
|
+ Result:=Result+ElType.GetDeclaration(Not (ElType is TPasUnresolvedTypeRef))
|
|
|
else
|
|
else
|
|
|
Result:=Result+'const';
|
|
Result:=Result+'const';
|
|
|
end;
|
|
end;
|
|
@@ -4798,7 +4799,7 @@ end;
|
|
|
|
|
|
|
|
{ TPasRecordType }
|
|
{ TPasRecordType }
|
|
|
|
|
|
|
|
-procedure TPasRecordType.GetMembers(S: TStrings);
|
|
|
|
|
|
|
+procedure TPasRecordType.GetMembers(S: TStrings; aSkipSection : Boolean = false);
|
|
|
|
|
|
|
|
Var
|
|
Var
|
|
|
T : TStringList;
|
|
T : TStringList;
|
|
@@ -4818,7 +4819,7 @@ begin
|
|
|
if E.Visibility<>CV then
|
|
if E.Visibility<>CV then
|
|
|
begin
|
|
begin
|
|
|
CV:=E.Visibility;
|
|
CV:=E.Visibility;
|
|
|
- if CV<>visDefault then
|
|
|
|
|
|
|
+ if (CV<>visDefault) and not aSkipSection then
|
|
|
S.Add(VisibilityNames[CV]);
|
|
S.Add(VisibilityNames[CV]);
|
|
|
end;
|
|
end;
|
|
|
Temp:=E.GetDeclaration(True);
|
|
Temp:=E.GetDeclaration(True);
|
|
@@ -5186,14 +5187,14 @@ procedure TPasProcedure.GetModifiers(List: TStrings);
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
begin
|
|
begin
|
|
|
- Doadd(IsVirtual,' Virtual');
|
|
|
|
|
- DoAdd(IsDynamic,' Dynamic');
|
|
|
|
|
- DoAdd(IsOverride,' Override');
|
|
|
|
|
- DoAdd(IsAbstract,' Abstract');
|
|
|
|
|
- DoAdd(IsOverload,' Overload');
|
|
|
|
|
- DoAdd(IsReintroduced,' Reintroduce');
|
|
|
|
|
- DoAdd(IsStatic,' Static');
|
|
|
|
|
- DoAdd(IsMessage,' Message');
|
|
|
|
|
|
|
+ Doadd(IsVirtual,' virtual');
|
|
|
|
|
+ DoAdd(IsDynamic,' dynamic');
|
|
|
|
|
+ DoAdd(IsOverride,' override');
|
|
|
|
|
+ DoAdd(IsAbstract,' abstract');
|
|
|
|
|
+ DoAdd(IsReintroduced,' reintroduce');
|
|
|
|
|
+ DoAdd(IsOverload,' overload');
|
|
|
|
|
+ DoAdd(IsStatic,' static');
|
|
|
|
|
+ DoAdd(IsMessage,' message');
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
procedure TPasProcedure.ForEachCall(const aMethodCall: TOnForEachPasElement;
|
|
procedure TPasProcedure.ForEachCall(const aMethodCall: TOnForEachPasElement;
|
|
@@ -5337,6 +5338,24 @@ begin
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
function TPasProcedure.GetDeclaration(full: Boolean): TPasTreeString;
|
|
function TPasProcedure.GetDeclaration(full: Boolean): TPasTreeString;
|
|
|
|
|
+
|
|
|
|
|
+begin
|
|
|
|
|
+ GetDeclaration(Full,True,Full,False);
|
|
|
|
|
+end;
|
|
|
|
|
+
|
|
|
|
|
+function TPasProcedure.GetDeclaration(full, AddArgs, AddModifiers, AddParent: Boolean): TPasTreeString;
|
|
|
|
|
+
|
|
|
|
|
+ function GetName(t : string) : String;
|
|
|
|
|
+ begin
|
|
|
|
|
+ Result:=T;
|
|
|
|
|
+ if Name='' then
|
|
|
|
|
+ exit;
|
|
|
|
|
+ Result:=Result+' ';
|
|
|
|
|
+ if addParent and (Parent is TPasType) then
|
|
|
|
|
+ Result:=Result+Parent.Name+'.';
|
|
|
|
|
+ Result:=Result+SafeName;
|
|
|
|
|
+ end;
|
|
|
|
|
+
|
|
|
Var
|
|
Var
|
|
|
S : TStringList;
|
|
S : TStringList;
|
|
|
T: TPasTreeString;
|
|
T: TPasTreeString;
|
|
@@ -5344,31 +5363,29 @@ Var
|
|
|
begin
|
|
begin
|
|
|
S:=TStringList.Create;
|
|
S:=TStringList.Create;
|
|
|
try
|
|
try
|
|
|
- If Full then
|
|
|
|
|
|
|
+ T:=TypeName;
|
|
|
|
|
+ If (NameParts=Nil) or not Full then
|
|
|
|
|
+ T:=GetName(T)
|
|
|
|
|
+ else
|
|
|
begin
|
|
begin
|
|
|
- T:=TypeName;
|
|
|
|
|
- if NameParts<>nil then
|
|
|
|
|
|
|
+ T:=T+' ';
|
|
|
|
|
+ for i:=0 to NameParts.Count-1 do
|
|
|
begin
|
|
begin
|
|
|
- T:=T+' ';
|
|
|
|
|
- for i:=0 to NameParts.Count-1 do
|
|
|
|
|
|
|
+ if i>0 then
|
|
|
|
|
+ T:=T+'.';
|
|
|
|
|
+ with TProcedureNamePart(NameParts[i]) do
|
|
|
begin
|
|
begin
|
|
|
- if i>0 then
|
|
|
|
|
- T:=T+'.';
|
|
|
|
|
- with TProcedureNamePart(NameParts[i]) do
|
|
|
|
|
- begin
|
|
|
|
|
- T:=T+Name;
|
|
|
|
|
- if Templates<>nil then
|
|
|
|
|
- T:=T+GenericTemplateTypesAsString(Templates);
|
|
|
|
|
- end;
|
|
|
|
|
|
|
+ T:=T+Name;
|
|
|
|
|
+ if Templates<>nil then
|
|
|
|
|
+ T:=T+GenericTemplateTypesAsString(Templates);
|
|
|
end;
|
|
end;
|
|
|
- end
|
|
|
|
|
- else if Name<>'' then
|
|
|
|
|
- T:=T+' '+SafeName;
|
|
|
|
|
- S.Add(T);
|
|
|
|
|
|
|
+ end;
|
|
|
end;
|
|
end;
|
|
|
|
|
+ S.Add(T);
|
|
|
if Assigned(ProcType) then
|
|
if Assigned(ProcType) then
|
|
|
begin
|
|
begin
|
|
|
- ProcType.GetArguments(S);
|
|
|
|
|
|
|
+ if AddArgs then
|
|
|
|
|
+ ProcType.GetArguments(S);
|
|
|
If (ProcType is TPasFunctionType)
|
|
If (ProcType is TPasFunctionType)
|
|
|
and Assigned(TPasFunctionType(Proctype).ResultEl) then
|
|
and Assigned(TPasFunctionType(Proctype).ResultEl) then
|
|
|
With TPasFunctionType(ProcType).ResultEl.ResultType do
|
|
With TPasFunctionType(ProcType).ResultEl.ResultType do
|
|
@@ -5380,14 +5397,17 @@ begin
|
|
|
T:=T+GetDeclaration(False);
|
|
T:=T+GetDeclaration(False);
|
|
|
S.Add(T);
|
|
S.Add(T);
|
|
|
end;
|
|
end;
|
|
|
- GetModifiers(S); // needs proctype
|
|
|
|
|
|
|
+ if AddModifiers then
|
|
|
|
|
+ GetModifiers(S); // needs proctype
|
|
|
end;
|
|
end;
|
|
|
- Result:=IndentStrings(S,Length(S[0]));
|
|
|
|
|
|
|
+ if s.Count>0 then
|
|
|
|
|
+ Result:=IndentStrings(S,Length(S[0]));
|
|
|
finally
|
|
finally
|
|
|
S.Free;
|
|
S.Free;
|
|
|
end;
|
|
end;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
+
|
|
|
function TPasFunction.TypeName: TPasTreeString;
|
|
function TPasFunction.TypeName: TPasTreeString;
|
|
|
begin
|
|
begin
|
|
|
Result:='function';
|
|
Result:='function';
|
|
@@ -5415,7 +5435,7 @@ begin
|
|
|
Result:=Result+TypeName+' '+OperatorTypeToOperatorName(OperatorType);
|
|
Result:=Result+TypeName+' '+OperatorTypeToOperatorName(OperatorType);
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
-function TPasOperator.GetDeclaration (full : boolean) : TPasTreeString;
|
|
|
|
|
|
|
+function TPasOperator.GetDeclaration(full, AddArgs, AddModifiers, AddParent: Boolean): TPasTreeString;
|
|
|
|
|
|
|
|
Var
|
|
Var
|
|
|
S : TStringList;
|
|
S : TStringList;
|
|
@@ -5424,8 +5444,7 @@ Var
|
|
|
begin
|
|
begin
|
|
|
S:=TStringList.Create;
|
|
S:=TStringList.Create;
|
|
|
try
|
|
try
|
|
|
- If Full then
|
|
|
|
|
- S.Add(GetOperatorDeclaration(Full));
|
|
|
|
|
|
|
+ S.Add(GetOperatorDeclaration(Full));
|
|
|
ProcType.GetArguments(S);
|
|
ProcType.GetArguments(S);
|
|
|
If Assigned((Proctype as TPasFunctionType).ResultEl) then
|
|
If Assigned((Proctype as TPasFunctionType).ResultEl) then
|
|
|
if Assigned(TPasFunctionType(ProcType).ResultEl.ResultType) then
|
|
if Assigned(TPasFunctionType(ProcType).ResultEl.ResultType) then
|
|
@@ -5440,7 +5459,6 @@ begin
|
|
|
end;
|
|
end;
|
|
|
GetModifiers(S);
|
|
GetModifiers(S);
|
|
|
Result:=IndentStrings(S,Length(S[0]));
|
|
Result:=IndentStrings(S,Length(S[0]));
|
|
|
-
|
|
|
|
|
finally
|
|
finally
|
|
|
S.Free;
|
|
S.Free;
|
|
|
end;
|
|
end;
|