mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
loader: switch to custom program loader
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package loader
|
||||
|
||||
// Errors contains a list of parser errors or a list of typechecker errors for
|
||||
// the given package.
|
||||
type Errors struct {
|
||||
Pkg *Package
|
||||
Errs []error
|
||||
}
|
||||
|
||||
func (e Errors) Error() string {
|
||||
return "could not compile: " + e.Errs[0].Error()
|
||||
}
|
||||
|
||||
// ImportCycleErrors is returned when encountering an import cycle. The list of
|
||||
// packages is a list from the root package to the leaf package that imports one
|
||||
// of the packages in the list.
|
||||
type ImportCycleError struct {
|
||||
Packages []string
|
||||
}
|
||||
|
||||
func (e *ImportCycleError) Error() string {
|
||||
msg := "import cycle: " + e.Packages[0]
|
||||
for _, path := range e.Packages[1:] {
|
||||
msg += " → " + path
|
||||
}
|
||||
return msg
|
||||
}
|
||||
Reference in New Issue
Block a user