pastojs: filer: warn for generics

git-svn-id: trunk@43690 -
This commit is contained in:
Mattias Gaertner 2019-12-15 14:06:15 +00:00
parent c8a3a11a26
commit 12084211bf
2 changed files with 34 additions and 2 deletions

View File

@ -3920,6 +3920,13 @@ begin
WritePasElement(Obj,El,aContext);
Scope:=El.CustomData as TPas2JSProcedureScope;
//writeln('TPCUWriter.WriteProcedure ',GetObjName(El),' ',GetObjName(Scope),' ',Resolver.GetElementSourcePosStr(El));
if Scope.SpecializedFromItem<>nil then
begin
// ToDo: write spezialiation signature
RaiseMsg(20191120180305,El,GetObjPath(Scope.SpecializedFromItem.FirstSpecialize));
end;
if Scope.DeclarationProc=nil then
begin
// declaration

View File

@ -172,7 +172,8 @@ type
procedure TestPC_ClassInterface;
procedure TestPC_Attributes;
procedure TestPC_GenericFunction;
procedure TestPC_GenericClassSkip; // ToDo
procedure TestPC_GenericFunctionSkip;
procedure TestPC_UseUnit;
procedure TestPC_UseUnit_Class;
@ -2406,7 +2407,31 @@ begin
WriteReadUnit;
end;
procedure TTestPrecompile.TestPC_GenericFunction;
procedure TTestPrecompile.TestPC_GenericClassSkip;
begin
exit;
StartUnit(false);
Add([
'interface',
'type',
' TObject = class',
' end;',
' generic TBird<T> = class',
' a: T;',
' generic function Run<T>(a: T): T;',
' end;',
'implementation',
'function TBird.Run<T>(a: T): T;',
'var b: T;',
'begin',
' b:=a; Result:=b;',
'end;',
'']);
WriteReadUnit;
end;
procedure TTestPrecompile.TestPC_GenericFunctionSkip;
begin
StartUnit(false);
Add([