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
61 lines
1.6 KiB
Text
61 lines
1.6 KiB
Text
class BaseClass1()
|
|
function BaseClass1( this, arg0, arg1 )
|
|
print( $"BaseClass1 arg0={arg0} arg1={arg1}" );
|
|
this.base1 := { this.base1 ?: {} ..., { arg0, arg1 } };
|
|
endfunction
|
|
endclass
|
|
|
|
class BaseClass2()
|
|
function BaseClass2( this, arg0 )
|
|
print( $"BaseClass2 arg0={arg0}" );
|
|
// this.base2 := arg0;
|
|
this.base2 := { this.base2 ?: {} ..., { arg0 } };
|
|
endfunction
|
|
endclass
|
|
|
|
class Foo1( BaseClass1, BaseClass2 )
|
|
function Foo1( this, arg0 )
|
|
// Will "expand" arguments in order
|
|
super( "unscoped-arg0", "unscoped-arg1", "unscoped-arg2" );
|
|
print( "---" );
|
|
this.child := arg0;
|
|
endfunction
|
|
endclass
|
|
|
|
class Foo2( BaseClass1, BaseClass2 )
|
|
function Foo2( this, arg0 )
|
|
// Can be scoped ...
|
|
super( BaseClass1::arg0:= "scoped-c1.arg0", BaseClass1::arg1:= "scoped-c1.arg1",
|
|
BaseClass2::arg0:= "scoped-c2.arg0" );
|
|
print( "---" );
|
|
|
|
this.child := arg0;
|
|
endfunction
|
|
endclass
|
|
|
|
class Foo3( BaseClass1, BaseClass2 )
|
|
function Foo3( this, arg0 )
|
|
// ... in any order, eg. putting Class2 first
|
|
super( BaseClass2::arg0:= "scoped-c2.arg0", BaseClass1::arg0:= "scoped-c1.arg0",
|
|
BaseClass1::arg1:= "scoped-c1.arg1" );
|
|
print( "---" );
|
|
|
|
this.child := arg0;
|
|
endfunction
|
|
endclass
|
|
|
|
class Foo4( BaseClass1, BaseClass2 )
|
|
function Foo4( this, arg0 )
|
|
// And do not need to scope uniquely-named arguments (arg1)
|
|
super( BaseClass2::arg0:= "scoped-c2.arg0", arg1 := "scoped-c1.arg1",
|
|
BaseClass1::arg0:= "scoped-c1.arg0" );
|
|
print( "---" );
|
|
|
|
this.child := arg0;
|
|
endfunction
|
|
endclass
|
|
|
|
var foo1 := Foo1( "foo" );
|
|
var foo2 := Foo2( "foo" );
|
|
var foo3 := Foo3( "foo" );
|
|
var foo4 := Foo4( "foo" );
|