* feat: add support for named output variables
Function output parameters are located at the start of the function
frame, uninitialized, as they could be only set through return
statements.
Supporting named output variables requires to:
- identify and allocate symbols corresponding to output names:
done at ident parsing, with the funcRet() helper,
- compute the location of output name in the frame:
done with retRank() helper,
- initialize the frame entry with the zero value of symbol type,
as the symbol can be accessed and written at multiple times,
and return not setting the variable (opposite to unnamed).
Done with frameType() helper, which now takes into account
output parameters.
* refactor: simplify memory management
Perform function frame analysis at pre-order, instead of post-order, to
initialize memory frame, and track value types. Remove all operation
involving unitialized types. Frame memory layout is now build
incrementally, instead of having to perform dedicated tree walks on AST.
Eval returns the value of the root node of AST, so ensure
that node values are propagated back to ExprStmt and BlockStmt,
which should be sufficient to handle evaluation of simple
statements.
Change the way imported binary variables are imported, from
`reflect.ValueOf(val)` to `reflect.ValueOf(&val).Elem()`, to allow these
variables to be set from the interpreter.
Regenerate stdlib packages accordingly.
Ensure that binary value is forwarded if it exists.
Add tests.
append() now returns the underlying array type.
Method lookup was skipped for selector expression on arrays.
Pointer expression was incorrectly parsed as a dereference instead of
type expression.
At CFG, in pre-order processing, determine the correct type of CompositeLitExpr from its first child (if it's a type) or from the ancestor node.
Make sure The type is propagated to children so the algorithm works recursively.
Fix also the isType() method to handle case of imported types,
either from source or binary packages.
Do not ignore type node when used in a variable declaration with assign.
The source node in a assign node can be the 2nd or the 3rd (the 2nd being the type).
The code for comparison operators is now generated by genop.
The support for multiple type has been added.
Missing operators <= and >= are now implemented.
Add `cmd/genop` program to generate operator functions in `interp/op.go`.
For each operator, determine its type, handle argument types conversion if necessary.
Arithmetic operators are added for now. Assign and comparison operators coming in a next commit.
The recovered state is stored in `Frame`, and captured in `runCfg()`.
`assign()` has been modified to set handle `interface{}` type (not
possible with `reflect`.
* Fix: multi-assign expression panic
The following corrections are done:
* interp/ast.go: in case of ast.ValueSpec node, fix the decision between
multi-assign or single assign
* interp/cfg.go: in multi-assign parse, skip type symbol if it is
present
* ast: improve error handling
* ast: handle select
* dyngo: set filename of executed script
* cfg: improve error reporting
* Implement select for receiving channels
* feat(select): add support for sending channels in case clauses
* test: improve tests on select
* feat(select): add support for "default" case