Skip to content

Commit

Permalink
Resolve problema ao identificar tipos inteiros (#609)
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelrvg authored Jan 29, 2024
1 parent 51e6ae6 commit 01ba31e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fontes/interpretador/interpretador-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,11 @@ export class InterpretadorBase implements InterpretadorInterface {
: typeof esquerda === tipoDeDadosPrimitivos.NUMERO
? tipoDeDadosDelegua.NUMERO
: String(NaN);
if (tipoDireita === tipoDeDadosDelegua.NUMERO && tipoEsquerda === tipoDeDadosDelegua.NUMERO) return;

const tiposNumericos = [tipoDeDadosDelegua.INTEIRO, tipoDeDadosDelegua.NUMERO];

if(tiposNumericos.includes(tipoDireita) && tiposNumericos.includes(tipoEsquerda)) return;

throw new ErroEmTempoDeExecucao(operador, 'Operadores precisam ser números.', operador.linha);
}

Expand Down

0 comments on commit 01ba31e

Please sign in to comment.