Browse Source

pas2js: docs

git-svn-id: trunk@37814 -
Mattias Gaertner 7 years ago
parent
commit
c64562e80c
2 changed files with 13 additions and 5 deletions
  1. 3 3
      packages/pastojs/tests/tcmodules.pas
  2. 10 2
      utils/pas2js/docs/translation.html

+ 3 - 3
packages/pastojs/tests/tcmodules.pas

@@ -264,7 +264,7 @@ type
     Procedure TestProc_OverloadNested;
     Procedure TestProc_Varargs;
     Procedure TestProc_ConstOrder;
-    Procedure TestProc_VarAbsolute;
+    Procedure TestProc_LocalVarAbsolute;
 
     // enums, sets
     Procedure TestEnum_Name;
@@ -3025,7 +3025,7 @@ begin
     ]));
 end;
 
-procedure TTestModule.TestProc_VarAbsolute;
+procedure TTestModule.TestProc_LocalVarAbsolute;
 begin
   StartProgram(false);
   Add([
@@ -3045,7 +3045,7 @@ begin
   'end;',
   'begin']);
   ConvertProgram;
-  CheckSource('TestProc_VarAbsolute',
+  CheckSource('TestProc_LocalVarAbsolute',
     LinesToStr([ // statements
     'rtl.createClass($mod, "TObject", null, function () {',
     '  this.$init = function () {',

+ 10 - 2
utils/pas2js/docs/translation.html

@@ -60,6 +60,7 @@
     <a href="#tryexcept">Translating try..except</a><br>
     <a href="#enumerators">Translating enumerators</a><br>
     <a href="#functiontype">Translating function types</a><br>
+    <a href="#absolute">Translating var modifier absolute</a><br>
     <a href="#calljavascript">Calling JavaScript from Pascal</a><br>
     <a href="#asm">The asm block</a><br>
     <a href="#assembler">The procedure modifier assembler</a><br>
@@ -1752,7 +1753,7 @@ function(){
     </div>
 
     <div class="section">
-    <h2 id="functiontype">Translating function type</h2>
+    <h2 id="functiontype">Translating function types</h2>
     JavaScript functions work like Delphi's "reference to function", which
     means like closures. Normal functions and nested functions can simply be
     assigned to variables.
@@ -1836,6 +1837,14 @@ rtl = {
     </ul>
     </div>
 
+    <div class="section">
+    <h2 id="absolute">Translating var modifier absolute</h2>
+    The absolute modifier works as an alias. That means it works FPC/Delphi
+    compatible for related types like Pointer and TObject, and works
+    incompatible for unrelated types like longword and record.<br>
+    The modifier is currently only supported for local variables.
+    </div>
+
     <div class="section">
     <h2 id="calljavascript">Calling JavaScript from Pascal</h2>
     Pas2js allows to write low level functions and/or access a JavaScript library
@@ -2610,7 +2619,6 @@ End.
     <li>Scoped enums</li>
     <li>Set of char, boolean, custom range</li>
     <li>Type alias, e.g. type TTranslateString = type string;</li>
-    <li>Var Absolute modifier</li>
     <li>Variant records</li>
     <li>Variants</li>
     </ul>