Browse Source

pastojs: typecast string(unicodestring), unicodestring(string)

git-svn-id: trunk@41224 -
Mattias Gaertner 6 years ago
parent
commit
bf1af93938
2 changed files with 12 additions and 4 deletions
  1. 2 2
      packages/pastojs/src/fppas2js.pp
  2. 10 2
      packages/pastojs/tests/tcmodules.pas

+ 2 - 2
packages/pastojs/src/fppas2js.pp

@@ -1183,8 +1183,8 @@ const
     ];
     ];
   bfAllJSBaseProcs = bfAllStandardProcs;
   bfAllJSBaseProcs = bfAllStandardProcs;
 
 
-  btAllJSStrings = [btString];
-  btAllJSChars = [btChar];
+  btAllJSStrings = [btString,btUnicodeString];
+  btAllJSChars = [btChar,btWideChar];
   btAllJSStringAndChars = btAllJSStrings+btAllJSChars;
   btAllJSStringAndChars = btAllJSStrings+btAllJSChars;
   btAllJSFloats = [btDouble];
   btAllJSFloats = [btDouble];
   btAllJSBooleans = [btBoolean];
   btAllJSBooleans = [btBoolean];

+ 10 - 2
packages/pastojs/tests/tcmodules.pas

@@ -6679,6 +6679,10 @@ begin
   '{$H+}',
   '{$H+}',
   'const',
   'const',
   '  a = #$00F3#$017C;', // first <256, then >=256
   '  a = #$00F3#$017C;', // first <256, then >=256
+  '  b = string(''a'');',
+  '  c = string(''ä'');',
+  '  d = UnicodeString(''b'');',
+  '  e = UnicodeString(''ö'');',
   'var',
   'var',
   '  s: string = ''abc'';',
   '  s: string = ''abc'';',
   'begin',
   'begin',
@@ -6699,8 +6703,12 @@ begin
   CheckSource('TestStringConst',
   CheckSource('TestStringConst',
     LinesToStr([
     LinesToStr([
     'this.a = "óż";',
     'this.a = "óż";',
-    'this.s="abc";'
-    ]),
+    'this.b = "a";',
+    'this.c = "ä";',
+    'this.d = "b";',
+    'this.e = "ö";',
+    'this.s="abc";',
+    '']),
     LinesToStr([
     LinesToStr([
     '$mod.s="";',
     '$mod.s="";',
     '$mod.s="\r\n";',
     '$mod.s="\r\n";',