polserver/testsuite/escript/func/funcref04.src
Kevin Eady f47ce97d26
Add compiler support for expressions as function callee (#670)
* initial support for function calls with expression callee

* Add support for identifier-named callees

* add compilation failure test; better code docs

* Add core-changes

* Address compiler warnings
- conversion from 'size_t' to 'unsigned int', possible loss of data

* Update grammar

* implementation

* tests

* update core-changes

* Address CI warnings
- declaration of 'method' hides previous local declaration
2024-07-28 20:21:23 +02:00

11 lines
275 B
Text

// `sum` should be called either:
//
// - a function: `sum(...)` for compile-time errors
// - a funcref: `@sum.call(...)` for run-time errors
// - an expression: `(@sum)(...)` for run-time errors
//
print( ( sum )( 1, 2 ) );
function sum( a, b )
return a + b;
endfunction