Commit Graph

120 Commits

Author SHA1 Message Date
Marc Vertes
4f93be7f19 fix: emulate struct by interface{} only for recursive struct types 2019-12-16 19:00:07 +01:00
Marc Vertes
275391c1e8 fix: struct type detection, collision between field and type name 2019-12-12 14:40:05 +01:00
Marc Vertes
273df8af9f fix: improve interface type checks using method sets 2019-12-11 14:46:06 +01:00
Marc Vertes
1ff1a50753 fix: add method checks for interface types 2019-12-09 18:24:04 +01:00
Marc Vertes
eef59153d8 fix: detect non boolean condition for IF and FOR statements 2019-11-26 00:08:05 +01:00
Marc Vertes
3969ab16c4 fix: improve handling of untyped complex numbers 2019-10-29 18:14:05 +01:00
Marc Vertes
7d19108f01 fix: compute type of slice expression globally 2019-10-05 19:14:04 +02:00
Dan Kortschak
47923866ff interp: fix array size assignment type inference 2019-09-30 22:58:04 +02:00
Marc Vertes
35e645c690 fix: correct handling of types alias of interfaces 2019-09-25 15:24:04 +02:00
Marc Vertes
03596dac45 fix: correct automatic type conversion for untyped constants 2019-09-25 15:02:04 +02:00
Marc Vertes
9abaeeb729 fix: binary method lookup works for struct field pointer receiver 2019-09-19 14:02:06 +02:00
Marc Vertes
5e49f83519 fix: shift operator inherits its type from first arg only 2019-09-18 23:44:03 +02:00
Marc Vertes
400b625153 fix: support defining recursive interface types 2019-09-17 01:18:03 +02:00
Marc Vertes
f7810d9761 fix: init global var from builtin 2019-09-16 16:50:06 +02:00
Marc Vertes
b08a51cb16 fix: conversion of type to reflect.Type avoids recursive loop 2019-09-16 15:04:03 +02:00
Marc Vertes
9e664ee8dd fix: global variable init from selector expression 2019-09-16 14:30:05 +02:00
Marc Vertes
82dd3f2953 fix: implement variadic using a type category to avoid corruption 2019-09-10 13:12:03 +02:00
Marc Vertes
2f0279f0f5 fix: reuse rather than re-import an already imported source package 2019-09-09 15:54:05 +02:00
Marc Vertes
b0937618b0 fix: improve handling of out of order declarations (#344) 2019-09-05 11:37:34 +02:00
Marc Vertes
d23a7e1d8b fix: assign a function value to a pre-declared variable 2019-08-29 05:16:04 -07:00
Marc Vertes
71fd938040 fix: improve handling of global declarations, possibly out of order (#336) 2019-08-28 16:59:46 +02:00
Marc Vertes
7d5ed8a713 fix: correct array length computed from litteral array (#242) 2019-07-11 12:33:05 +02:00
Marc Vertes
122506cc79 Fix: handle recursive type definition (#239) 2019-07-09 00:08:12 +02:00
Marc Vertes
274c0fc47a chore: API and code cleanup. Rename stdlib.Value into stdlib.Symbols (#231) 2019-06-27 12:40:04 +02:00
Marc Vertes
cc8e05d61b chore: cleanup API, unexport internal constants, types and variables. (#229) 2019-06-24 16:24:47 +02:00
Marc Vertes
686769fa84 fix: add support for tags in struct fields (#220) 2019-06-12 18:52:41 +02:00
Marc Vertes
9bb99669ad fix: handle forward type declarations, preserving early methods (#212) 2019-06-11 10:33:23 +02:00
Marc Vertes
ac9c30d0bb fix: partial implementation of conversion to interface (#209) 2019-06-11 09:37:27 +02:00
Marc Vertes
67ba2888d7 fix: lookup embedded binary fields in struct (#207) 2019-06-11 09:17:51 +02:00
Marc Vertes
455a37e678 fix: correct handling of constant expressions in type declarations (#204) 2019-06-04 16:50:32 +02:00
Marc Vertes
cc2d122cd3 fix: correct negate operator (#199) 2019-05-31 12:48:46 +02:00
Marc Vertes
557a02d616 perf: better handling of return values in func calls (#193) 2019-05-27 12:21:03 +02:00
Marc Vertes
eb705baa01 fix: implement a single interface wrapper for error type (#190) 2019-05-21 16:49:26 +02:00
Marc Vertes
16690838e3 fix: correct handling of multi-assign operations, including swap (#173) 2019-05-01 16:25:31 +02:00
Marc Vertes
eadeb86147 fix: correct unamed type conversion for shift operation (#170) 2019-04-24 17:59:41 +02:00
Marc Vertes
37f93f0392 fix: correct embedded method handling on hybrid struct (#162) 2019-04-19 18:30:04 +02:00
Marc Vertes
637418c8a9 fix: correct struct field lookup for embedded pointers (#160) 2019-04-17 16:08:51 +02:00
Marc Vertes
e63a9ae1de fix: correct implicit struct field name for pointer (#158) 2019-04-17 11:05:14 +02:00
Marc Vertes
9b1a0c006c fix: correct struct field name definition from imported type (#156) 2019-04-16 17:38:28 +02:00
Marc Vertes
378252166b fix: correct assign from function call (#155)
The following changes should fix real and potential  problems
regarding how variables are set from function return values.

In assign from call expressions, Values in caller frame are now
directly assigned from function calls (call(), binCall() or builtins).
The assignement is performed with reflect Set methods or variants,
instead of "=" operator, to enforce runtime type checks.

The assignX() and assignX2() builtins are now removed in favor of
above method.

The representation of nil for pointer on struct has been fixed.

The identification of channel is fixed in for-range channel expression.
2019-04-16 15:22:17 +02:00
Marc Vertes
798252e020 feat: support relative import paths "../xxx" and "./xxx" (#146) 2019-04-05 14:07:29 +02:00
Marc Vertes
68e25cf68e fix: wrong returned type in define from function call in global context (#148) 2019-04-02 16:05:39 +02:00
Marc Vertes
e766c272ed fix: handle append a string to a byte array (#133) 2019-03-22 10:27:02 +01:00
Marc Vertes
68d7890775 feat: add support for builtins complex, real and imag (#128) 2019-03-19 13:41:34 +01:00
Marc Vertes
842d22a8c2 feat: type checking for binary operators (#116)
Catch illegal combinations for all binary operators.
Memoize type conversion to reflect.type.
Add some unit tests for arithmetic and assign operations.
2019-03-15 09:34:01 +01:00
Marc Vertes
5a10046944 feat: simplify Use() (#115)
Change API from
func Use(val libValueMap, typ libTypeMap)
to
func Use(val libValueMap)
2019-03-13 12:24:59 +01:00
Marc Vertes
6657e9a18b feat: add support for named output variables (#113)
* 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.
2019-03-12 19:58:02 +01:00
Marc Vertes
e081b7a86b fix: correct handling of strings in comparison operators (#110)
Add an iString() type helper function, and use it to define the correct
conversion value prior to compare. The correction is to be applied to all
comparison operators, so regenerate op.go.
2019-02-26 13:14:08 +01:00
Marc Vertes
005a3cf93c fix: catch mismatched types in binary operator expressions (#109)
The types of operands are checked prior to generate closures.

- test: improve evalCheck() to check against expected output and/or expected errors.
2019-02-26 11:08:57 +01:00
Marc Vertes
0fb2370c33 fix: handle type for unary expression (#108) 2019-02-25 15:38:48 +01:00