mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
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.
This commit is contained in:
Vendored
+2
@@ -12,6 +12,7 @@ func main() {
|
||||
println("v4:", len(v4), v4 == nil)
|
||||
println("v5:", len(v5), v5 == nil)
|
||||
println("v6:", v6)
|
||||
println("v7:", cap(v7), string(v7))
|
||||
}
|
||||
|
||||
type (
|
||||
@@ -28,4 +29,5 @@ var (
|
||||
v4 map[string]int
|
||||
v5 = map[string]int{}
|
||||
v6 = float64(v1) < 2.6
|
||||
v7 = []byte("foo")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user