Browse Source

pastojs: resolver: funcresult[]:=

git-svn-id: trunk@38038 -
Mattias Gaertner 7 years ago
parent
commit
57f3e4d1d6
1 changed files with 39 additions and 0 deletions
  1. 39 0
      packages/pastojs/tests/tcmodules.pas

+ 39 - 0
packages/pastojs/tests/tcmodules.pas

@@ -247,6 +247,7 @@ type
     Procedure TestImplProc;
     Procedure TestImplProc;
     Procedure TestFunctionResult;
     Procedure TestFunctionResult;
     Procedure TestNestedProc;
     Procedure TestNestedProc;
+    Procedure TestNestedProc_ResultString;
     Procedure TestForwardProc;
     Procedure TestForwardProc;
     Procedure TestNestedForwardProc;
     Procedure TestNestedForwardProc;
     Procedure TestAssignFunctionResult;
     Procedure TestAssignFunctionResult;
@@ -2375,6 +2376,44 @@ begin
     '');
     '');
 end;
 end;
 
 
+procedure TTestModule.TestNestedProc_ResultString;
+begin
+  StartProgram(false);
+  Add([
+  'function DoIt: string;',
+  '  function Nesty: string; ',
+  '  begin',
+  '    nesty:=#65#66;',
+  '    nesty[1]:=#67;',
+  '    doit:=#68;',
+  '    doit[2]:=#69;',
+  '  end;',
+  'begin',
+  '  doit:=#70;',
+  '  doit[3]:=#71;',
+  'end;',
+  'begin']);
+  ConvertProgram;
+  CheckSource('TestNestedProc_ResultString',
+    LinesToStr([ // statements
+    'this.DoIt = function () {',
+    '  var Result = "";',
+    '  function Nesty() {',
+    '    var Result$1 = "";',
+    '    Result$1 = "AB";',
+    '    Result$1 = rtl.setCharAt(Result$1, 0, "C");',
+    '    Result = "D";',
+    '    Result = rtl.setCharAt(Result, 1, "E");',
+    '    return Result$1;',
+    '  };',
+    '  Result = "F";',
+    '  Result = rtl.setCharAt(Result, 2, "G");',
+    '  return Result;',
+    '};'
+    ]),
+    '');
+end;
+
 procedure TTestModule.TestForwardProc;
 procedure TTestModule.TestForwardProc;
 begin
 begin
   StartProgram(false);
   StartProgram(false);