Commit Graph

38 Commits

Author SHA1 Message Date
Marc Vertes
9977ef6fc6 Revert "fix: make interpreter methods discoverable by runtime (#722)" (#732)
This reverts commit a3b2737b5c.
2020-07-01 16:16:26 +02:00
Marc Vertes
55f2fe396a fix: goexports skisp unimplemented solaris Syscall6 (#726)
The standard library syscall package for Solaris defines unimplemented
symbols Syscall6 and RawSyscall6 which makes the build fails on
Solaris platform, now that yaegi command imports syscall symbols.

As the standard library package is locked down, this will remain
unchanged. We just skip those symbols.

Fixes #725.
2020-06-30 22:50:44 +02:00
Marc Vertes
a3b2737b5c fix: make interpreter methods discoverable by runtime (#722)
* fix: make interpreter methods discoverable by runtime

When generating an interface wrapper, lookup existing wrappers by method
to get the one with the biggest set of methods implemented by interpreter.

A string method is also added to wrappers, in order to provide a string
representation of the interpreter value rather than the wrapper itself
(at least for %s and %v verbs).

This allows the runtime to pickup an interpreter method automatically
even if the conversion to the interface is not specified in the script. As
in Go spec, it is enough for the type to implement the required methods.

A current limitation is that only single wrappers can be instantiated,
not allowing to compose interfaces.

This limitation can be removed when the Go reflect issue
https://github.com/golang/go/issues/15924 is fixed.

Fixes #435.

* test: add a simpler test
2020-06-29 14:25:14 +02:00
Nicholas Wiersma
c2ad279643 fix: use pragma for ptr checks 2020-06-22 16:40:03 +02:00
Nicholas Wiersma
9627782394 feature: add Sizeof and Alignof to unsafe 2020-06-22 15:24:04 +02:00
Ludovic Fernandez
a6c24a0d13 chore: update linter. (#706)
* chore: update linter.

* chore: remove not needed travis env var.
2020-06-22 12:55:42 +02:00
Nicholas Wiersma
f19b7563ea feature: unsafe type conversion 2020-06-18 18:14:03 +02:00
Nicholas Wiersma
d252821df3 feature: constant values in bin packages 2020-06-18 13:54:04 +02:00
Ludovic Fernandez
94e0b582ea Update stdlib for go1.14 2020-02-26 15:06:06 +01:00
Marc Vertes
bb04af2d4d doc: document import of source and binary packages (#477) 2020-01-08 18:51:30 +01:00
Marc Vertes
75a696a5c8 fix: goexports performs correct conversion on float32 constants 2019-10-29 10:20:05 +01:00
Ludovic Fernandez
e193d95dc2 feat: update syscall for go1.12.12 2019-10-19 18:30:04 +02:00
Ludovic Fernandez
1cf327bd7d Drop go1.11 2019-10-01 14:40:05 +02:00
Marc Vertes
2c2b471cb9 fix: goexports to convert value type only for untyped constants 2019-09-27 15:44:05 +02:00
Marc Vertes
cda23836f0 feature: additional binary packages in stdlib (#366)
Generate wrappers for the following packages:

- crypto/ed25519 (go1.13 only)
- debug/dwarf
- debug/elf
- debug/gosym
- debug/pe
- debug/plan9obj
- net/http/pprof
- runtime/pprof
- runtime/trace
2019-09-16 14:06:11 +02:00
Ludovic Fernandez
bfa9a267be Update stdlib for go1.13 (#351)
* chore: generate stdlib for go1.13

* chore: update CI configuration.

* fix: struct13 test is too dependent of the Go implementation.

* fix: disable test import4.go
2019-09-09 09:59:26 +02:00
Sebastien Binet
75ad29c6b4 cmd/goexports: add -license flag to goexports 2019-08-05 03:10:05 -07:00
Ludovic Fernandez
ee81ee7fea interp/build: improve Go version handling. 2019-07-30 14:34:04 -07:00
Ludovic Fernandez
373e3204b4 chore: revert stdlib improvements 2019-07-26 22:36:03 -07:00
Ludovic Fernandez
43b8594c82 feat: improve stdlib generation. 2019-07-26 17:10:04 -07:00
Ludovic Fernandez
24db786bb6 fix: exclude syslog for windows, nacl, and plan9. 2019-07-24 18:58:04 -07:00
Marc Vertes
3528b4539d feature: set default GOPATH for command line and allow self interpreting (#240) 2019-07-09 16:57:29 +02:00
Ludovic Fernandez
1948ecf10e chore: regenerate syscall. (#234) 2019-07-03 18:10:07 +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
85c11a9ec6 feature: isolate stdlib "unsafe" package (#228) 2019-06-18 12:00:32 +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
4d8e990ff3 fix: several bug fixes so bcrypt and blowfish work in yaegi (#182)
* convert type of nil value
* range staement with key and no value
* assign operators misbehave
* reset to zero in value spec statements
2019-05-07 14:01:55 +02:00
Ludovic Fernandez
7e07a183ed chore: support go1.11 and go 1.12. (#130)
* feat: support go1.11 and go 1.12.

* chore: generate.

* fix: build constraint.

* exclude importer.For

* generate go 1.11
2019-03-19 22:08:17 +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
6d21cefe75 fix: allow imported binary variables to be set (#85)
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.
2019-02-07 15:41:22 +01:00
Marc Vertes
547b1afb8d feat(goexports): support multi os / arch, generate syscalls for all platforms (#6) 2019-01-11 17:41:26 +01:00
Fernandez Ludovic
45893a87a8 refactor: goexports use go template. 2019-01-07 23:46:36 +01:00
Fernandez Ludovic
3bf45a4b32 refactor: generate syscall for linux. 2019-01-07 11:36:05 +01:00
Marc Vertes
86b2ffedcd stdlib: add syscall package 2018-12-26 15:46:42 -05:00
Marc Vertes
42e891da02 Fix DO NOT EDIT comment on generated files 2018-12-19 11:41:48 +01:00
Marc Vertes
6a397e2294 Fix golint warnings 2018-12-07 17:37:58 +01:00
Marc Vertes
c280611fb4 Fix call expressions involving functions from stdlib, update to go-1.11 2018-08-29 14:35:44 +02:00
Marc Vertes
25adc35a3c Change representation of stdlib from interface{} to reflect.Value
This fixes problems due to storing binary symbols as interfaces{}
instead of concrete type, which confuses lookup functions to retrieve
methods etc. in reflect.
2018-08-28 03:12:28 +02:00