ソースを参照

* perform -CTlowercaseprocstart conversion it tprocsym.create rather than
when building the mangled name, because the latter can also be performed
when compiler another unit (and therefore if that other unit's setting
is different from that of the original unit, a wrong mangled name was
generated) + test for this case

git-svn-id: trunk@25388 -

Jonas Maebe 12 年 前
コミット
fcaad5baf2
4 ファイル変更46 行追加3 行削除
  1. 1 0
      .gitattributes
  2. 0 2
      compiler/symdef.pas
  3. 5 1
      compiler/symsym.pas
  4. 40 0
      tests/test/jvm/tlowercaseproc.pp

+ 1 - 0
.gitattributes

@@ -10639,6 +10639,7 @@ tests/test/jvm/tint.pp svneol=native#text/plain
 tests/test/jvm/tintstr.pp svneol=native#text/plain
 tests/test/jvm/tjavalowercaseproc.java svneol=native#text/plain
 tests/test/jvm/tjsetter.java svneol=native#text/plain
+tests/test/jvm/tlowercaseproc.pp svneol=native#text/plain
 tests/test/jvm/tnestdynarr.pp svneol=native#text/plain
 tests/test/jvm/tnestedset.pp svneol=native#text/plain
 tests/test/jvm/tnestproc.pp svneol=native#text/plain

+ 0 - 2
compiler/symdef.pas

@@ -5271,8 +5271,6 @@ implementation
                     tmpresult:='$'+tprocdef(owner.defowner).procsym.realname+'$'+tostr(tprocdef(owner.defowner).procsym.symid)+'$'+tmpresult;
                     container:=container.defowner.owner;
                   end;
-                if ts_lowercase_proc_start in current_settings.targetswitches then
-                  tmpresult[1]:=lower(tmpresult[1]);
               end;
           end
         else

+ 5 - 1
compiler/symsym.pas

@@ -614,7 +614,11 @@ implementation
 
     constructor tprocsym.create(const n : string);
       begin
-         inherited create(procsym,n);
+         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));
          FProcdefList:=TFPObjectList.Create(false);
          FProcdefderefList:=nil;
          { the tprocdef have their own symoptions, make the procsym

+ 40 - 0
tests/test/jvm/tlowercaseproc.pp

@@ -0,0 +1,40 @@
+{$namespace org.freepascal.test.lcproc}
+
+unit tlowercaseproc;
+
+{$mode delphi}
+{$targetswitch lowercaseprocstart}
+
+interface
+
+procedure DoIt;
+
+type
+  tc = class
+   procedure MethodName;
+   class procedure ClassMethodName; static;
+  end;
+
+implementation
+
+procedure DoIt;
+var
+  a: ansistringclass;
+begin
+  { this routine is declared with uppercase C at the start in the system unit,
+    check that we don't lowercase this one as well }
+  a:=AnsistringClass(AnsistringClass.CreateFromLiteralStringBytes('abcdef',DefaultSystemCodePage));
+end;
+
+procedure tc.MethodName;
+begin
+  doit;
+  classmethodname;
+end;
+
+class procedure tc.ClassMethodName; static;
+begin
+  doit;
+end;
+
+end.