pas2js: docs

git-svn-id: trunk@37814 -
This commit is contained in:
Mattias Gaertner 2017-12-26 10:48:51 +00:00
parent 8d8efd7272
commit c64562e80c
2 changed files with 13 additions and 5 deletions

View File

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

View File

@ -60,6 +60,7 @@
<a href="#tryexcept">Translating try..except</a><br> <a href="#tryexcept">Translating try..except</a><br>
<a href="#enumerators">Translating enumerators</a><br> <a href="#enumerators">Translating enumerators</a><br>
<a href="#functiontype">Translating function types</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="#calljavascript">Calling JavaScript from Pascal</a><br>
<a href="#asm">The asm block</a><br> <a href="#asm">The asm block</a><br>
<a href="#assembler">The procedure modifier assembler</a><br> <a href="#assembler">The procedure modifier assembler</a><br>
@ -1752,7 +1753,7 @@ function(){
</div> </div>
<div class="section"> <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 JavaScript functions work like Delphi's "reference to function", which
means like closures. Normal functions and nested functions can simply be means like closures. Normal functions and nested functions can simply be
assigned to variables. assigned to variables.
@ -1836,6 +1837,14 @@ rtl = {
</ul> </ul>
</div> </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"> <div class="section">
<h2 id="calljavascript">Calling JavaScript from Pascal</h2> <h2 id="calljavascript">Calling JavaScript from Pascal</h2>
Pas2js allows to write low level functions and/or access a JavaScript library Pas2js allows to write low level functions and/or access a JavaScript library
@ -2610,7 +2619,6 @@ End.
<li>Scoped enums</li> <li>Scoped enums</li>
<li>Set of char, boolean, custom range</li> <li>Set of char, boolean, custom range</li>
<li>Type alias, e.g. type TTranslateString = type string;</li> <li>Type alias, e.g. type TTranslateString = type string;</li>
<li>Var Absolute modifier</li>
<li>Variant records</li> <li>Variant records</li>
<li>Variants</li> <li>Variants</li>
</ul> </ul>