View Issue Details

IDProjectCategoryView StatusLast Update
0037510pas2jstranspilerpublic2020-08-13 18:53
Reporterhenrique Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
PlatformMakestubOSWindows 
Fixed in Version0.8.39 
Summary0037510: Is adding the overload directive
DescriptionFunctions with the same name are correctly placing the overload policy on the interface part, but in the implementation it does not need to attach, only if it is already declared.
Steps To Reproducemakestub.exe -i js.pas -o jsconv.pas
TagsNo tags attached.
Fixed in Revision46322
Attached Files

Relationships

related to 0037544 resolvedMichael Van Canneyt Removing overload 

Activities

Michael Van Canneyt

2020-08-08 11:28

administrator   ~0124662

fixed, thanks for reporting!

henrique

2020-08-12 14:07

reporter   ~0124795

You are putting the "overload" back into the deployment session.

When a procedure is "overload" on the interface it should not declare the "overload" in the implementation.

The problem that needs correction is the case of "CharInSet", which is declared in the interface and there is a declaration in the implementation. With this you need to put the "overload" in the interface and only in the new function in the implementation.

Let's put an example to be clearer:

Original file:

unit Test;

interface

function MyFunction: String;

implementation

function MyFunction(AValue: Integer): String;
begin
end;

function MyFunction: String;
begin
end;

Converted file:

unit Test;

interface

function MyFunction: String; overload;

implementation

function MyFunction(AValue: Integer): String; overload;
begin
end;

function MyFunction: String;
begin
end;

Michael Van Canneyt

2020-08-12 14:29

administrator   ~0124798

Last edited: 2020-08-12 14:30

View 2 revisions

This can't be fixed as you ask. The original sources must be corrected so they are correctly converted.

Since I can't test in delphi, please correct sysutils so it converts correctly for delphi

henrique

2020-08-13 18:53

reporter   ~0124850

I made an adjustment in the implementation of the generation of files, to generate overload only in the interface part of the unit.

I am still seeing a way to apply overload to procedures that are only declared in the implementation part.
Overload.patch (1,243 bytes)   
From 436432bd8d6e8da9c9bb4de8e960af107886e995 Mon Sep 17 00:00:00 2001
From: Henrique Gottardi Werlang <henriquewerlang@hotmail.com>
Date: Thu, 13 Aug 2020 11:47:40 -0300
Subject: [PATCH] =?UTF-8?q?Ajustando=20a=20declara=C3=A7=C3=A3o=20dos=20ov?=
 =?UTF-8?q?erload.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 packages/fcl-passrc/src/paswrite.pp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/packages/fcl-passrc/src/paswrite.pp b/packages/fcl-passrc/src/paswrite.pp
index d23a7561d3..db79b1609a 100644
--- a/packages/fcl-passrc/src/paswrite.pp
+++ b/packages/fcl-passrc/src/paswrite.pp
@@ -911,7 +911,7 @@ Var
 
 begin
 
-  IsImpl:=AProc.Parent is TPasSection;
+  IsImpl:=AProc.Parent is TImplementationSection;
   if IsImpl then
     PrepareDeclSection('');
   if Not IsImpl then
@@ -933,7 +933,7 @@ begin
     Add(' reintroduce;');
   // if NamePrefix is not empty, we're writing a dummy for external class methods.
   // In that case, we must not write the 'overload'.
-  if AProc.IsOverload and (NamePrefix='') then
+  if AProc.IsOverload and (NamePrefix='') and not IsImpl then
     Add(' overload;');
   if not IsImpl then
     begin
-- 
2.28.0.windows.1

Overload.patch (1,243 bytes)   

Issue History

Date Modified Username Field Change
2020-08-07 21:17 henrique New Issue
2020-08-08 11:28 Michael Van Canneyt Assigned To => Michael Van Canneyt
2020-08-08 11:28 Michael Van Canneyt Status new => resolved
2020-08-08 11:28 Michael Van Canneyt Resolution open => fixed
2020-08-08 11:28 Michael Van Canneyt Fixed in Version => 0.8.39
2020-08-08 11:28 Michael Van Canneyt Fixed in Revision => 46322
2020-08-08 11:28 Michael Van Canneyt Note Added: 0124662
2020-08-12 09:35 Michael Van Canneyt Relationship added related to 0037544
2020-08-12 14:07 henrique Status resolved => feedback
2020-08-12 14:07 henrique Resolution fixed => open
2020-08-12 14:07 henrique Note Added: 0124795
2020-08-12 14:29 Michael Van Canneyt Note Added: 0124798
2020-08-12 14:30 Michael Van Canneyt Note Edited: 0124798 View Revisions
2020-08-13 18:53 henrique Note Added: 0124850
2020-08-13 18:53 henrique File Added: Overload.patch
2020-08-13 18:53 henrique Status feedback => assigned