mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 04:26:13 +02:00
pas2js: docs
git-svn-id: trunk@37814 -
This commit is contained in:
parent
8d8efd7272
commit
c64562e80c
@ -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 () {',
|
||||||
|
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user