-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge: Merge pull request #22 from natanfeitosa/feat/importacoes
feat: Adiciona importação de nomes
- Loading branch information
Showing
11 changed files
with
229 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package ptst | ||
|
||
func MaquinarioImporteModulo(ctx *Contexto, nome string) (Objeto, error) { | ||
if modulo, err := ctx.ObterModulo(nome); err == nil { | ||
return modulo, nil | ||
} | ||
|
||
if impl := ObtemImplModulo(nome); impl != nil { | ||
return ctx.InicializarModulo(impl) | ||
} | ||
|
||
// FIXME: adicionar lógica para aquisição e inicialização de métodos "locais" | ||
|
||
return nil, NewErroF(ImportacaoErro, "Não foi possível achar o módulo '%s', talvez seja um módulo local que ainda não é suportado", nome) | ||
} | ||
|
||
func MultiImporteModulo(ctx *Contexto, nomes ...string) error { | ||
for _, nome := range nomes { | ||
if _, err := MaquinarioImporteModulo(ctx, nome); err != nil { | ||
return err | ||
} | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.