diff --git a/compiler/symsym.pas b/compiler/symsym.pas index cfcb426cd4..f3a7020fd0 100644 --- a/compiler/symsym.pas +++ b/compiler/symsym.pas @@ -616,12 +616,32 @@ implementation ****************************************************************************} constructor tprocsym.create(const n : string); + var + i: longint; begin if not(ts_lowercase_proc_start in current_settings.targetswitches) or (n='') then inherited create(procsym,n) 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); FProcdefderefList:=nil; { the tprocdef have their own symoptions, make the procsym diff --git a/tests/test/jvm/tjavalowercaseproc.java b/tests/test/jvm/tjavalowercaseproc.java index 5f625b7112..bb7e8fd9c2 100644 --- a/tests/test/jvm/tjavalowercaseproc.java +++ b/tests/test/jvm/tjavalowercaseproc.java @@ -9,6 +9,9 @@ public static void main(String[] args) c = new org.freepascal.test.lcproc.tc(); c.methodName(); org.freepascal.test.lcproc.tc.classMethodName(); + c.xToY(); + c.prefixThingToTest(); + c.rc64Encode(); } } diff --git a/tests/test/jvm/tlowercaseproc.pp b/tests/test/jvm/tlowercaseproc.pp index 27018ac9c9..ce61afca21 100644 --- a/tests/test/jvm/tlowercaseproc.pp +++ b/tests/test/jvm/tlowercaseproc.pp @@ -13,6 +13,9 @@ type tc = class procedure MethodName; class procedure ClassMethodName; static; + procedure XToY; // should become xToY + procedure PREFIXThingToTest; // should become prefixThingToTest + procedure RC64Encode; // should become rc64Encode; end; implementation @@ -37,4 +40,16 @@ begin doit; end; +procedure tc.xtoy; +begin +end; + +procedure tc.PREFIXThingToTest; +begin +end; + +procedure tc.RC64Encode; +begin +end; + end.