mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* Format testsuite escript * Format testsuite pol * Update docs Switch "attributes" to "members" to better align with Escript terms. * Add core-changes, breaking-changes
41 lines
843 B
Text
41 lines
843 B
Text
// Tests with modifying `this` in the constructor.
|
|
// We should never see `uninit` in the output.
|
|
|
|
class BaseClass()
|
|
function BaseClass( this )
|
|
print( $"BaseClass::BaseClass this={this}" );
|
|
endfunction
|
|
endclass
|
|
|
|
// Call super() before modifying this
|
|
class Foo1( BaseClass )
|
|
function Foo1( this )
|
|
print( $"Foo1::Foo1 this={this}" );
|
|
super();
|
|
this := uninit;
|
|
print( $"Foo1::Foo1 this={this}" );
|
|
endfunction
|
|
endclass
|
|
|
|
var f1 := Foo1();
|
|
print( f1 );
|
|
print( "----" );
|
|
|
|
// Call super() after modifying this
|
|
class Foo2( BaseClass )
|
|
function Foo2( this )
|
|
print( $"Foo2::Foo2 this={this}" );
|
|
this := uninit;
|
|
super();
|
|
print( this );
|
|
endfunction
|
|
endclass
|
|
|
|
var f2 := Foo2();
|
|
print( f2 );
|
|
|
|
print( "----" );
|
|
|
|
// As usual, we can re-assign the variable that _holds_ a class instance.
|
|
f2 := "abc";
|
|
print( f2 );
|