mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 14:03:39 +00:00
tgo: Print IR on panic (sometimes)
This commit is contained in:
@@ -1601,10 +1601,16 @@ func Compile(pkgName, runtimePath, outpath, target string, printIR bool) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Compile Go code to IR.
|
// Compile Go code to IR.
|
||||||
parseErr := c.Parse(pkgName, buildTags)
|
parseErr := func() error {
|
||||||
if printIR {
|
if printIR {
|
||||||
fmt.Println(c.IR())
|
// Run this even if c.Parse() panics.
|
||||||
}
|
defer func() {
|
||||||
|
fmt.Println("IR until the error:")
|
||||||
|
fmt.Println(c.IR())
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
return c.Parse(pkgName, buildTags)
|
||||||
|
}()
|
||||||
if parseErr != nil {
|
if parseErr != nil {
|
||||||
return parseErr
|
return parseErr
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user