Skip to content

Commit

Permalink
Retorna além de texto, outros valores como cálculo matemático (#87)
Browse files Browse the repository at this point in the history
* Retorna além de texto, outros valores como cálculo matemático

* Ajustando if para não quebrar testes unitários

* Verificando tipo boolean no retorno do interpretador
  • Loading branch information
samuelrvg authored May 10, 2022
1 parent b51e218 commit 6b88ff1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fontes/interpretador/interpretador.ts
Original file line number Diff line number Diff line change
Expand Up @@ -907,9 +907,10 @@ export class Interpretador implements InterpretadorInterface {
executar(declaracao: any, mostrarResultado: boolean = false): void {
const resultado = declaracao.aceitar(this);
if (mostrarResultado) {
const formatoTexto = this.paraTexto(resultado);
this.resultadoInterpretador.push(formatoTexto)
this.funcaoDeRetorno(formatoTexto);
this.funcaoDeRetorno(this.paraTexto(resultado));
}
if(resultado || typeof resultado === 'boolean'){
this.resultadoInterpretador.push(this.paraTexto(resultado))
}
}

Expand Down

0 comments on commit 6b88ff1

Please sign in to comment.