Commit Graph

415 Commits

Author SHA1 Message Date
Marc Vertes
2ef097e334 feat: better error handling in type parsing (#24)
When parsing types, instead of panic, set proper error and diagnostic with source location.
Propagate errors correctly.
2019-01-21 22:03:40 +01:00
Marc Vertes
015bff1599 feat: handle recover builtin (#13)
The recovered state is stored in `Frame`, and captured in `runCfg()`.
`assign()` has been modified to set handle `interface{}` type (not
possible with `reflect`.
2019-01-17 21:15:10 +01:00
Marc Vertes
098829d316 style: fix warnings from golangci-lint printed by make check (#11)
* style: fix warnings from golangci-lint printed by `make check`
* style: err assign in if block when possible. Better use of switch/case
* style: err assign in if block when possible
2019-01-16 18:59:24 +01:00
Marc Vertes
7987a97847 feat(ast): handle defer statement (#8) 2019-01-15 12:33:02 +01:00
Marc Vertes
bd15f88be6 feat: add support for select statement (#5)
* 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
2019-01-09 17:45:38 +01:00
Fernandez Ludovic
3c00ca4469 fix: quick review. 2019-01-07 11:35:12 +01:00
Marc Vertes
27cbeef38d Methods created in the interpreter can now be used by runtime 2018-12-19 15:10:26 +01:00
Marc Vertes
6a397e2294 Fix golint warnings 2018-12-07 17:37:58 +01:00
Marc Vertes
ea07c12f56 Support incremental parse and eval, and interactive mode 2018-12-07 17:16:11 +01:00
Marc Vertes
6b013ffd35 Simplify export to runtime 2018-12-04 15:14:02 +01:00
Marc Vertes
e508591277 Compute frame types for binary wrapper around closures 2018-12-03 12:05:42 +01:00
Marc Vertes
4eab01911e Fix range for slices of binary objects 2018-12-02 17:46:27 +01:00
Marc Vertes
487e24e829 Type assertion: add support for 2nd return value 2018-12-01 17:56:55 +01:00
Marc Vertes
c75807dec9 Fix type assertions for runtime objects. Work in progress.
Function typeAssert() now returns the concrete value of interface{}
object defined in the runtime.

What is missing is actual type checking against provided type, and
support for the variant returning 2 values, the concrete value and
boolean status.
2018-12-01 14:49:56 +01:00
Marc Vertes
8bc2f14b78 Fix make to handle both runtime and interpreter defined types 2018-11-30 15:13:05 +01:00
Marc Vertes
5143f37a86 Handle dereference of boolean pointer. Uniformize boolean builtins 2018-11-30 12:08:01 +01:00
Marc Vertes
5c7b669fcc Fix handling chan boolean values 2018-11-29 19:28:12 +01:00
Marc Vertes
eb56b7dbb1 Fix handling array boolean values 2018-11-29 19:15:53 +01:00
Marc Vertes
18258dcd75 Fix handling map boolean values 2018-11-29 18:58:42 +01:00
Marc Vertes
1552194f11 Fix handling of boolean struct fields 2018-11-29 18:28:44 +01:00
Marc Vertes
658b32cf1e Handle branching in binary function calls 2018-11-29 16:59:14 +01:00
Marc Vertes
a0b659fa8a Handle branching in boolean functions 2018-11-29 16:36:21 +01:00
Marc Vertes
65933b2441 Test equality on interface, for compatibility with all comparable types.
This is slower than direct test on value, which requires code geneation
(next step).
2018-11-29 13:40:26 +01:00
Marc Vertes
7681be52ca Make values addressable in node wrapper 2018-11-29 10:35:04 +01:00
Marc Vertes
5d490cf22b Fix frame init in node wrapper 2018-11-29 09:45:19 +01:00
Marc Vertes
c8fa453ce4 Fix init of zero objects 2018-11-28 17:27:46 +01:00
Marc Vertes
3bd853988b Automatic type conversion for maps and arrays 2018-11-27 15:19:40 +01:00
Marc Vertes
ae7515a189 Introduce convertLiteralValue() to simplify automatic type conversion 2018-11-27 14:24:42 +01:00
Marc Vertes
7898bd48e2 Automatic type conversion for literal values in composite expression 2018-11-27 11:29:16 +01:00
Marc Vertes
00d5cad47e Automatic type conversion for literal values in composite sparse assign 2018-11-27 10:55:38 +01:00
Marc Vertes
b20edb3b02 Fix handling of variadic arguments 2018-11-26 19:05:29 +01:00
Marc Vertes
726a9e2606 Fix type propagation in context of nested range expressions 2018-11-26 17:33:48 +01:00
Marc Vertes
9cd312611c Fix type conversion and function wrapper 2018-11-23 15:48:22 +01:00
Marc Vertes
a86e5b43a7 Fix automatic type conversion for binary methods 2018-11-22 11:27:40 +01:00
Marc Vertes
d77e2e3f83 Support call to runtime in go statement 2018-11-21 18:06:20 +01:00
Marc Vertes
7ddb593bc2 Interpreter call from runtime: fix node wrapper generation 2018-11-21 15:00:47 +01:00
Marc Vertes
0e6d068a17 Code cleaning 2018-11-20 17:51:43 +01:00
Marc Vertes
9d466c92e3 Improve handling of fields in struct objects 2018-11-20 16:17:42 +01:00
Marc Vertes
84d8456b92 Fix solving selector expression on binary object 2018-11-20 12:21:01 +01:00
Marc Vertes
b3954838e9 Fix call of interpreted callback from runtime. Work in progress. 2018-11-19 19:06:32 +01:00
Marc Vertes
e21513faf8 Fix handling of function types
Fix a bug where type was skipped if several arguments where factorized
on the same type.
2018-11-19 14:37:24 +01:00
Marc Vertes
503b1d9119 Convert literal values to right type 2018-11-19 13:24:55 +01:00
Marc Vertes
0970329031 Convert literal values to right type 2018-11-19 10:27:54 +01:00
Marc Vertes
eff6d5f73b Fix assignement of function call, code clean 2018-11-16 16:51:31 +01:00
Marc Vertes
9212167392 Fix handling methods on binary objects 2018-11-16 15:25:59 +01:00
Marc Vertes
0e36321755 Fix support of variadic functions 2018-11-15 11:35:49 +01:00
Marc Vertes
982d6f3630 Fix convertBin() 2018-11-14 18:14:08 +01:00
Marc Vertes
c9519a6a0e Fix type detection in variable declaration 2018-11-14 18:03:02 +01:00
Marc Vertes
0b67bb3f6f Fix setting composite litterals in nested scopes 2018-11-14 15:54:03 +01:00
Marc Vertes
799a1018d2 Fix nested function calls with multiple return values 2018-11-14 14:38:00 +01:00