فهرست منبع

* support unicodestring constants in "case string of" (mantis #29353)

git-svn-id: trunk@32970 -
Jonas Maebe 9 سال پیش
والد
کامیت
a65ab73e8b
3فایلهای تغییر یافته به همراه25 افزوده شده و 1 حذف شده
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/ncon.pas
  3. 23 0
      tests/webtbs/tw29353.pp

+ 1 - 0
.gitattributes

@@ -14926,6 +14926,7 @@ tests/webtbs/tw29250.pp svneol=native#text/pascal
 tests/webtbs/tw2926.pp svneol=native#text/plain
 tests/webtbs/tw2927.pp svneol=native#text/plain
 tests/webtbs/tw29321.pp svneol=native#text/pascal
+tests/webtbs/tw29353.pp -text svneol=native#text/plain
 tests/webtbs/tw2942a.pp svneol=native#text/plain
 tests/webtbs/tw2942b.pp svneol=native#text/plain
 tests/webtbs/tw2943.pp svneol=native#text/plain

+ 1 - 1
compiler/ncon.pas

@@ -262,7 +262,7 @@ implementation
             concatwidestringchar(pWideStringVal, tcompilerwidechar(tordconstnode(p).value.uvalue));
             result:=cstringconstnode.createunistr(pWideStringVal);
           end
-        else if is_conststringnode(p) then
+        else if p.nodetype=stringconstn then
           result:=tstringconstnode(p.getcopy)
         else
           begin

+ 23 - 0
tests/webtbs/tw29353.pp

@@ -0,0 +1,23 @@
+program project1;
+
+{$mode objfpc}{$H+}
+{$codepage UTF8}
+
+uses
+  {$IFDEF UNIX}{$IFDEF UseCThreads}
+  cthreads,
+  {$ENDIF}{$ENDIF}
+  Classes
+  { you can add units after this };
+
+Var
+  AString : String;
+begin
+  AString := 'öö';
+  Case AString of
+    'öö' : WriteLn('match');
+    else
+      halt(1);
+  end;
+end.
+