mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 18:09:30 +02:00
pastojs: allow reintroduce published method
git-svn-id: trunk@42288 -
This commit is contained in:
parent
c971b4639f
commit
9871196e8c
@ -2806,7 +2806,10 @@ begin
|
||||
else if C.InheritsFrom(TPasProcedure) then
|
||||
begin
|
||||
if TPasProcedure(El).IsOverride then
|
||||
exit(true);
|
||||
exit(true); // using name of overridden
|
||||
if El.Visibility=visPublished then
|
||||
exit(false);
|
||||
|
||||
// Note: external proc pollutes the name space
|
||||
ProcScope:=TPasProcedureScope(El.CustomData);
|
||||
if ProcScope.DeclarationProc<>nil then
|
||||
|
@ -787,6 +787,7 @@ type
|
||||
Procedure TestRTTI_DefaultValueRangeType;
|
||||
Procedure TestRTTI_DefaultValueInherit;
|
||||
Procedure TestRTTI_OverrideMethod;
|
||||
Procedure TestRTTI_ReintroduceMethod;
|
||||
Procedure TestRTTI_OverloadProperty;
|
||||
// ToDo: array argument
|
||||
Procedure TestRTTI_ClassForward;
|
||||
@ -27155,8 +27156,8 @@ begin
|
||||
Add(' procedure Proc(Sender: tobject); virtual; abstract;');
|
||||
Add(' end;');
|
||||
Add('begin');
|
||||
SetExpectedPasResolverError('Duplicate identifier "Proc" at test1.pp(6,19)',
|
||||
nDuplicateIdentifier);
|
||||
SetExpectedPasResolverError('Duplicate published method "Proc" at test1.pp(6,19)',
|
||||
nDuplicatePublishedMethodXAtY);
|
||||
ConvertProgram;
|
||||
end;
|
||||
|
||||
@ -28039,6 +28040,51 @@ begin
|
||||
'']));
|
||||
end;
|
||||
|
||||
procedure TTestModule.TestRTTI_ReintroduceMethod;
|
||||
begin
|
||||
Converter.Options:=Converter.Options-[coNoTypeInfo];
|
||||
StartProgram(false);
|
||||
Add([
|
||||
'type',
|
||||
' TObject = class',
|
||||
' published',
|
||||
' procedure DoIt;',
|
||||
' end;',
|
||||
' TSky = class',
|
||||
' published',
|
||||
' procedure DoIt; reintroduce;',
|
||||
' end;',
|
||||
'procedure TObject.DoIt; begin end;',
|
||||
'procedure TSky.DoIt;',
|
||||
'begin',
|
||||
' inherited DoIt;',
|
||||
'end;',
|
||||
'begin']);
|
||||
ConvertProgram;
|
||||
CheckSource('TestRTTI_ReintroduceMethod',
|
||||
LinesToStr([ // statements
|
||||
'rtl.createClass($mod, "TObject", null, function () {',
|
||||
' this.$init = function () {',
|
||||
' };',
|
||||
' this.$final = function () {',
|
||||
' };',
|
||||
' this.DoIt = function () {',
|
||||
' };',
|
||||
' var $r = this.$rtti;',
|
||||
' $r.addMethod("DoIt", 0, null);',
|
||||
'});',
|
||||
'rtl.createClass($mod, "TSky", $mod.TObject, function () {',
|
||||
' this.DoIt = function () {',
|
||||
' $mod.TObject.DoIt.call(this);',
|
||||
' };',
|
||||
' var $r = this.$rtti;',
|
||||
' $r.addMethod("DoIt", 0, null);',
|
||||
'});',
|
||||
'']),
|
||||
LinesToStr([ // $mod.$main
|
||||
'']));
|
||||
end;
|
||||
|
||||
procedure TTestModule.TestRTTI_OverloadProperty;
|
||||
begin
|
||||
Converter.Options:=Converter.Options-[coNoTypeInfo];
|
||||
|
Loading…
Reference in New Issue
Block a user