mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-06 05:10:52 +02:00
* Merging revisions 42783,42784,42785,42786,42787,42788 from trunk:
------------------------------------------------------------------------ r42783 | michael | 2019-08-24 11:34:41 +0200 (Sat, 24 Aug 2019) | 1 line CreateJSON2ErrorResponse now clones ID parameter instead of consuming it (bug ID 35999) ------------------------------------------------------------------------ r42784 | michael | 2019-08-24 11:35:47 +0200 (Sat, 24 Aug 2019) | 1 line * Safety for empty asJSON. Should not happen, but better safe than sorry ------------------------------------------------------------------------ r42785 | michael | 2019-08-24 11:50:07 +0200 (Sat, 24 Aug 2019) | 1 line * Take into account skipped ------------------------------------------------------------------------ r42786 | michael | 2019-08-24 11:51:13 +0200 (Sat, 24 Aug 2019) | 1 line * Add FPC define, check for unit for short description ------------------------------------------------------------------------ r42787 | michael | 2019-08-24 11:52:04 +0200 (Sat, 24 Aug 2019) | 1 line * Allow aliases ------------------------------------------------------------------------ r42788 | michael | 2019-08-24 11:52:27 +0200 (Sat, 24 Aug 2019) | 1 line * Allow aliases ------------------------------------------------------------------------ git-svn-id: branches/fixes_3_2@42845 -
This commit is contained in:
parent
909b54579d
commit
63ac2d6b54
@ -412,7 +412,9 @@ function CreateJSON2ErrorResponse(Const AMessage : String; Const ACode : Integer
|
||||
|
||||
begin
|
||||
If (ID=Nil) then
|
||||
ID:=TJSONNull.Create;
|
||||
ID:=TJSONNull.Create
|
||||
else
|
||||
ID:=ID.Clone;
|
||||
Result:=TJSONErrorObject.Create(['jsonrpc','2.0','error',CreateJSONErrorObject(AMessage,ACode),idname,ID]);
|
||||
end;
|
||||
|
||||
@ -420,7 +422,9 @@ function CreateJSON2ErrorResponse(Const AFormat : String; Args : Array of const;
|
||||
|
||||
begin
|
||||
If (ID=Nil) then
|
||||
ID:=TJSONNull.Create;
|
||||
ID:=TJSONNull.Create
|
||||
else
|
||||
ID:=ID.Clone;
|
||||
Result:=TJSONErrorObject.Create(['jsonrpc','2.0','error',CreateJSONErrorObject(Format(AFormat,Args),ACode),idname,ID]);
|
||||
end;
|
||||
|
||||
@ -812,7 +816,7 @@ begin
|
||||
begin
|
||||
// No response, and a response was expected.
|
||||
if (ID<>Nil) or not (jdoNotifications in Options) then
|
||||
Result:=CreateJSON2Error(SErrNoResponse,[M],EJSONRPCInternalError,ID.Clone,transactionProperty);
|
||||
Result:=CreateJSON2Error(SErrNoResponse,[M],EJSONRPCInternalError,ID,transactionProperty);
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -832,7 +836,7 @@ begin
|
||||
If (Result<>Nil) then
|
||||
FreeAndNil(Result);
|
||||
If Assigned(ID) and not (ID is TJSONNull) then
|
||||
Result:=CreateJSON2Error(E.Message,EJSONRPCInternalError,ID.Clone,transactionproperty)
|
||||
Result:=CreateJSON2Error(E.Message,EJSONRPCInternalError,ID,transactionproperty)
|
||||
else
|
||||
Result:=CreateJSON2Error(E.Message,EJSONRPCInternalError,Nil,transactionproperty);
|
||||
end;
|
||||
@ -973,7 +977,7 @@ begin
|
||||
O:=A.Objects[i];
|
||||
J:=O.IndexOfName('id');
|
||||
if (J<>-1) then
|
||||
ID:=O.Items[J].Clone;
|
||||
ID:=O.Items[J];
|
||||
end;
|
||||
TJSONArray(Result).Add(CreateJSON2ErrorResponse(SErrJSON2NotAllowed,EJSONRPCInvalidRequest,ID,transactionproperty));
|
||||
end;
|
||||
|
@ -275,7 +275,8 @@ begin
|
||||
AResponse.FreeContentStream:=True;
|
||||
AResponse.ContentStream:=TMemoryStream.Create;
|
||||
R:=Res.AsJSON;
|
||||
AResponse.ContentStream.WriteBuffer(R[1],Length(R));
|
||||
if Length(R)>0 then
|
||||
AResponse.ContentStream.WriteBuffer(R[1],Length(R));
|
||||
AResponse.ContentLength:=AResponse.ContentStream.Size;
|
||||
R:=''; // Free up mem
|
||||
AResponse.ContentType:=GetResponseContentType;
|
||||
|
@ -29,6 +29,7 @@ Type
|
||||
|
||||
TWebIDLContext = Class (TIDLBaseObject)
|
||||
private
|
||||
FAliases: TStrings;
|
||||
FDefinitions: TIDLDefinitionList;
|
||||
FHash : TFPObjectHashTable;
|
||||
Protected
|
||||
@ -50,6 +51,7 @@ Type
|
||||
Function Add(aClass : TIDLDefinitionClass; const AName : UTF8String) : TIDLDefinition; override;
|
||||
Function Add(aParent : TIDLBaseObject; aClass : TIDLDefinitionClass; const AName : UTF8String) : TIDLDefinition; virtual;
|
||||
Property Definitions : TIDLDefinitionList Read FDefinitions;
|
||||
Property Aliases : TStrings Read FAliases Write FAliases;
|
||||
end;
|
||||
|
||||
{ TWebIDLParser }
|
||||
@ -132,6 +134,7 @@ Resourcestring
|
||||
SErrTypeNotAllowed = 'Type "%s" not allowed in "%s" type.';
|
||||
SErrDictionaryNotFound = 'Dictionary %s not found';
|
||||
SErrInterfaceNotFound = 'Interface %s not found';
|
||||
SErrInterfaceNotFoundfor = 'Included Interface %s not found for %s';
|
||||
|
||||
{ TWebIDLParser }
|
||||
|
||||
@ -1367,9 +1370,17 @@ begin
|
||||
Raise EWebIDLParser.CreateFmt(SErrInterfaceNotFound,[ID.Name]);
|
||||
II:=FindInterface(ID.IncludedInterface);
|
||||
If (II=Nil) then
|
||||
Raise EWebIDLParser.CreateFmt(SErrInterfaceNotFound,[ID.Name]);
|
||||
II.IsInclude:=True;
|
||||
OI.Partials.Add(II);
|
||||
begin
|
||||
if Assigned(Aliases) and (Aliases.IndexOfName(ID.IncludedInterface)<>-1) then
|
||||
OI.ParentName:=Aliases.Values[ID.IncludedInterface]
|
||||
else
|
||||
Raise EWebIDLParser.CreateFmt(SErrInterfaceNotFoundFor,[ID.IncludedInterface,ID.Name]);
|
||||
end
|
||||
else
|
||||
begin
|
||||
II.IsInclude:=True;
|
||||
OI.Partials.Add(II);
|
||||
end
|
||||
end;
|
||||
// if there is a single include, no members and no parent, make it a descendent
|
||||
For D in FDefinitions do
|
||||
|
@ -1363,6 +1363,7 @@ procedure TWebIDLToPas.ProcessDefinitions;
|
||||
begin
|
||||
FContext.AppendPartials;
|
||||
FContext.AppendIncludes;
|
||||
|
||||
AllocatePasNames(FContext.Definitions);
|
||||
end;
|
||||
|
||||
@ -1371,6 +1372,7 @@ procedure TWebIDLToPas.Execute;
|
||||
begin
|
||||
FContext:=CreateContext;
|
||||
try
|
||||
FContext.Aliases:=Self.TypeAliases;
|
||||
Parse;
|
||||
if Verbose then
|
||||
DoLog('Parsed %d definitions.',[Context.Definitions.Count]);
|
||||
|
@ -2657,17 +2657,22 @@ Procedure THTMLWriter.AddElementsFromList(L : TStrings; List : TFPList; UsePathN
|
||||
Var
|
||||
I : Integer;
|
||||
El : TPasElement;
|
||||
N : TDocNode;
|
||||
|
||||
begin
|
||||
For I:=0 to List.Count-1 do
|
||||
begin
|
||||
El:=TPasElement(List[I]);
|
||||
if UsePathName then
|
||||
L.AddObject(El.PathName,El)
|
||||
else
|
||||
L.AddObject(El.Name,El);
|
||||
If el is TPasEnumType then
|
||||
AddElementsFromList(L,TPasEnumType(el).Values);
|
||||
N:=Engine.FindDocNode(El);
|
||||
if (N=Nil) or (not N.IsSkipped) then
|
||||
begin
|
||||
if UsePathName then
|
||||
L.AddObject(El.PathName,El)
|
||||
else
|
||||
L.AddObject(El.Name,El);
|
||||
If el is TPasEnumType then
|
||||
AddElementsFromList(L,TPasEnumType(el).Values);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -23,8 +23,7 @@ program MakeSkel;
|
||||
{$h+}
|
||||
|
||||
uses
|
||||
SysUtils, Classes, Gettext,
|
||||
dGlobals, PasTree, PParser,PScanner;
|
||||
SysUtils, Classes, Gettext, dGlobals, PasTree, PParser,PScanner;
|
||||
|
||||
resourcestring
|
||||
STitle = 'MakeSkel - FPDoc skeleton XML description file generator';
|
||||
@ -235,7 +234,9 @@ Function TSkelEngine.WriteElement(Var F : Text;El : TPasElement; ADocNode : TDoc
|
||||
begin
|
||||
Result:=(APasElement.ClassType=TPasArgument) or
|
||||
(APasElement.ClassType=TPasResultElement) or
|
||||
(APasElement.ClassType=TPasEnumValue);
|
||||
(APasElement.ClassType=TPasEnumValue) or
|
||||
(aPaselement.ClassType=TPasUsesUnit) or
|
||||
((APasElement.CLassType=TPasVariable) and (APasElement.Parent is TPasRecordType));
|
||||
end;
|
||||
|
||||
Function IsTypeVarConst(APasElement : TPasElement) : Boolean;
|
||||
@ -398,7 +399,7 @@ begin
|
||||
FEmittedList:=TStringList.Create;
|
||||
FEmittedList.Sorted:=True;
|
||||
try
|
||||
Module:=ParseSource (Self,AFileName,ATarget,ACPU,[poUseStreams,poSkipDefaultDefs]);
|
||||
Module:=ParseSource (Self,AFileName+' -dFPC',ATarget,ACPU,[poUseStreams,poSkipDefaultDefs]);
|
||||
If UpdateMode then
|
||||
begin
|
||||
N:=FindDocNode(Module);
|
||||
|
Loading…
Reference in New Issue
Block a user