diff options
author | Ayke van Laethem <[email protected]> | 2018-10-31 10:43:29 +0100 |
---|---|---|
committer | Ayke van Laethem <[email protected]> | 2018-11-04 18:40:51 +0100 |
commit | bb3d05169d1afbc588836694c379532aecc9fd90 (patch) | |
tree | 0ff5eac65e51207549ea24907060a639f824f696 /interp/errors.go | |
parent | f900d3f9d515bd692928ffe6d524ed58674e1168 (diff) | |
download | tinygo-bb3d05169d1afbc588836694c379532aecc9fd90.tar.gz tinygo-bb3d05169d1afbc588836694c379532aecc9fd90.zip |
interp: add new compile-time package initialization interpreter
This interpreter currently complements the Go SSA level interpreter. It
may stay complementary or may be the only interpreter in the future.
This interpreter is experimental and not yet finished (there are known
bugs!) so it is disabled by default. It can be enabled by passing the
-initinterp flag.
The goal is to be able to run all initializations at compile time except
for the ones having side effects. This mostly works except perhaps for a
few edge cases.
In the future, this interpeter may be used to actually run regular Go
code, perhaps in a shell.
Diffstat (limited to 'interp/errors.go')
-rw-r--r-- | interp/errors.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/interp/errors.go b/interp/errors.go new file mode 100644 index 000000000..d720bbf00 --- /dev/null +++ b/interp/errors.go @@ -0,0 +1,17 @@ +package interp + +// This file provides useful types for errors encountered during IR evaluation. + +import ( + "github.com/aykevl/go-llvm" +) + +type Unsupported struct { + Inst llvm.Value +} + +func (e Unsupported) Error() string { + // TODO: how to return the actual instruction string? + // It looks like LLVM provides no function for that... + return "interp: unsupported instruction" +} |