From 6b88ff136740f3ce5c0230ad33c64813b622feb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Renan=20Gon=C3=A7alves=20Vaz?= Date: Tue, 10 May 2022 18:48:45 -0300 Subject: [PATCH] =?UTF-8?q?Retorna=20al=C3=A9m=20de=20texto,=20outros=20va?= =?UTF-8?q?lores=20como=20c=C3=A1lculo=20matem=C3=A1tico=20(#87)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- fontes/interpretador/interpretador.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fontes/interpretador/interpretador.ts b/fontes/interpretador/interpretador.ts index f0d220a8..6fd54123 100644 --- a/fontes/interpretador/interpretador.ts +++ b/fontes/interpretador/interpretador.ts @@ -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)) } }