polserver/testsuite/escript/classes/super-simple.src
Kevin Eady 6838c74cb4 Add super() function call for constructors (#694)
* Grammar updates
- Make class parameters required

* Add ClassLink; wip with `super()` calls in ctors

* More AST nodes as ScopableNames
- (function call) Argument
- FunctionParameterDeclaration

* Add support for ambiguity handling

* Add few more tests

* Handle returns in constructors
- Semantic analysis to error on returning a value
- Introduce specific emitter method for returning from constructor
- Various tests

* Refactor super building to pre-semantic analysis

* Adding several tests, some are TODO
- found an issue with function resolver and funcrefs, fix later

* Address self-review comments

* Fix funcref global func references, tests
2024-10-10 18:06:04 +02:00

15 lines
259 B
Text

class BaseClass()
function BaseClass( this, arg0 )
this.base := arg0;
endfunction
endclass
class Foo( BaseClass )
function Foo( this, arg0 )
super( "bar" );
this.child := arg0;
endfunction
endclass
var obj := Foo( "foo" );
print( obj );