Browse Source

pastojs: fixed ord(widechar)

git-svn-id: trunk@47408 -
Mattias Gaertner 4 years ago
parent
commit
fb87b423fe
2 changed files with 5 additions and 3 deletions
  1. 1 1
      packages/pastojs/src/fppas2js.pp
  2. 4 2
      packages/pastojs/tests/tcmodules.pas

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

@@ -13068,7 +13068,7 @@ begin
   bt:=ParamResolved.BaseType;
   if bt=btRange then
     bt:=ParamResolved.SubType;
-  if bt=btChar then
+  if bt in [btChar,btWideChar] then
     begin
     if Param is TParamsExpr then
       begin

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

@@ -294,7 +294,7 @@ type
     Procedure TestBaseType_RawByteStringFail;
     Procedure TestTypeShortstring_Fail;
     Procedure TestCharSet_Custom;
-    Procedure TestWideChar_VarArg;
+    Procedure TestWideChar;
     Procedure TestForCharDo;
     Procedure TestForCharInDo;
 
@@ -7924,7 +7924,7 @@ begin
     '']));
 end;
 
-procedure TTestModule.TestWideChar_VarArg;
+procedure TTestModule.TestWideChar;
 begin
   StartProgram(false);
   Add([
@@ -7942,6 +7942,7 @@ begin
   '  Fly(wc);',
   '  Run(c);',
   '  wc:=WideChar(w);',
+  '  w:=ord(wc);',
   '']);
   ConvertProgram;
   CheckSource('TestWideChar_VarArg',
@@ -7974,6 +7975,7 @@ begin
     '    }',
     '});',
     '$mod.wc = String.fromCharCode($mod.w);',
+    '$mod.w = $mod.wc.charCodeAt();',
     '',
     '']));
 end;