mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-26 04:11:27 +01:00
* fixed some bugs in the camelCase conversion performed on the JVM target by
-CTlowercaseprocstart
o convert all consecutive uppercase characters at the start to lowercase
instead of only the first one. Exception: if there is more than one
such character and the last one is followed by a lowercase character,
assume the last uppercase character belongs to the second word (like
in FPCIsGreat) and don't lowercase that one
+ test
git-svn-id: trunk@25845 -
This commit is contained in:
parent
76f6de5cf1
commit
b70e64dc67
@ -616,12 +616,32 @@ implementation
|
|||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
|
|
||||||
constructor tprocsym.create(const n : string);
|
constructor tprocsym.create(const n : string);
|
||||||
|
var
|
||||||
|
i: longint;
|
||||||
begin
|
begin
|
||||||
if not(ts_lowercase_proc_start in current_settings.targetswitches) or
|
if not(ts_lowercase_proc_start in current_settings.targetswitches) or
|
||||||
(n='') then
|
(n='') then
|
||||||
inherited create(procsym,n)
|
inherited create(procsym,n)
|
||||||
else
|
else
|
||||||
inherited create(procsym,lowercase(n[1])+copy(n,2,length(n)-1));
|
begin
|
||||||
|
{ YToX -> yToX
|
||||||
|
RC64Encode -> rc64Encode
|
||||||
|
Test -> test
|
||||||
|
}
|
||||||
|
i:=2;
|
||||||
|
while i<=length(n) do
|
||||||
|
begin
|
||||||
|
if not(n[i] in ['A'..'Z']) then
|
||||||
|
begin
|
||||||
|
if (i>2) and
|
||||||
|
(n[i] in ['a'..'z']) then
|
||||||
|
dec(i);
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
|
inherited create(procsym,lower(copy(n,1,i-1))+copy(n,i,length(n)));
|
||||||
|
end;
|
||||||
FProcdefList:=TFPObjectList.Create(false);
|
FProcdefList:=TFPObjectList.Create(false);
|
||||||
FProcdefderefList:=nil;
|
FProcdefderefList:=nil;
|
||||||
{ the tprocdef have their own symoptions, make the procsym
|
{ the tprocdef have their own symoptions, make the procsym
|
||||||
|
|||||||
@ -9,6 +9,9 @@ public static void main(String[] args)
|
|||||||
c = new org.freepascal.test.lcproc.tc();
|
c = new org.freepascal.test.lcproc.tc();
|
||||||
c.methodName();
|
c.methodName();
|
||||||
org.freepascal.test.lcproc.tc.classMethodName();
|
org.freepascal.test.lcproc.tc.classMethodName();
|
||||||
|
c.xToY();
|
||||||
|
c.prefixThingToTest();
|
||||||
|
c.rc64Encode();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,9 @@ type
|
|||||||
tc = class
|
tc = class
|
||||||
procedure MethodName;
|
procedure MethodName;
|
||||||
class procedure ClassMethodName; static;
|
class procedure ClassMethodName; static;
|
||||||
|
procedure XToY; // should become xToY
|
||||||
|
procedure PREFIXThingToTest; // should become prefixThingToTest
|
||||||
|
procedure RC64Encode; // should become rc64Encode;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -37,4 +40,16 @@ begin
|
|||||||
doit;
|
doit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure tc.xtoy;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure tc.PREFIXThingToTest;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure tc.RC64Encode;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user