mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 13:29:27 +02:00
pastojs: nested external class constructor
git-svn-id: trunk@49351 -
This commit is contained in:
parent
9bfc731bb6
commit
4ddaa26fc0
@ -18003,11 +18003,20 @@ begin
|
||||
'{$modeswitch externalclass}',
|
||||
'type',
|
||||
' TExtA = class external name ''ExtA''',
|
||||
' public type',
|
||||
' TExtB = class external name ''ExtB''',
|
||||
' public type',
|
||||
' TExtC = class external name ''ExtC''',
|
||||
' constructor New;',
|
||||
' constructor New(i: word);',
|
||||
' end;',
|
||||
' end;',
|
||||
' constructor Create;',
|
||||
' constructor Create(i: longint; j: longint = 2);',
|
||||
' end;',
|
||||
'var',
|
||||
' A: texta;',
|
||||
' C: texta.textb.textc;',
|
||||
'begin',
|
||||
' a:=texta.create;',
|
||||
' a:=texta(texta.create);',
|
||||
@ -18021,11 +18030,15 @@ begin
|
||||
' a:=test1.texta.create;',
|
||||
' a:=test1.texta.create();',
|
||||
' a:=test1.texta.create(3);',
|
||||
' c:=texta.textb.textc.new;',
|
||||
' c:=texta.textb.textc.new();',
|
||||
' c:=texta.textb.textc.new(4);',
|
||||
'']);
|
||||
ConvertProgram;
|
||||
CheckSource('TestExternalClass_Constructor',
|
||||
LinesToStr([ // statements
|
||||
'this.A = null;',
|
||||
'this.C = null;',
|
||||
'']),
|
||||
LinesToStr([ // $mod.$main
|
||||
'$mod.A = new ExtA.Create();',
|
||||
@ -18038,6 +18051,9 @@ begin
|
||||
'$mod.A = new ExtA.Create();',
|
||||
'$mod.A = new ExtA.Create();',
|
||||
'$mod.A = new ExtA.Create(3,2);',
|
||||
'$mod.C = new ExtA.ExtB.ExtC();',
|
||||
'$mod.C = new ExtA.ExtB.ExtC();',
|
||||
'$mod.C = new ExtA.ExtB.ExtC(4);',
|
||||
'']));
|
||||
end;
|
||||
|
||||
|
@ -2723,10 +2723,10 @@ function(){
|
||||
Destructors are not allowed.<br>
|
||||
Constructors are supported in four ways:
|
||||
<ul>
|
||||
<li><i>constructor New</i> is translated to <i>new ExtClass(params)</i>.</li>
|
||||
<li><i>constructor New</i> is translated to <i>new ExtClass(params)</i>, and for nested external class: <i>new ExtParentClass.ExtClass(Params)</i></li>
|
||||
<li><i>constructor New; external name ''GlobalFunc''</i> is translated to <i>new GlobalFunc(params)</i>.</li>
|
||||
<li><i>constructor SomeName; external name </i>'{}'</i> is translated to <i>{}</i>.</li>
|
||||
<li>Otherwise it is translated to <i>new ExtClass.FuncName(params)</i>.</li>
|
||||
<li>Otherwise it is translated to <i>new ExtClass.FuncName(params)</i>, and for nested external class: <i>new ExtParentClass.ExtClass.FuncName(params)</i>.</li>
|
||||
</ul>
|
||||
|
||||
<table class="sample">
|
||||
|
Loading…
Reference in New Issue
Block a user