Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrige implementação de primitiva dicionário para Delégua #620

Merged
merged 1 commit into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions fontes/interpretador/dialetos/potigol/comum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ export async function visitarExpressaoAcessoMetodo(
}

switch (tipoObjeto) {
case 'Dicionário':
case 'dicionario':
const metodoDeDicionario: Function = primitivasVetor[expressao.simbolo.lexema];
if (metodoDeDicionario) {
return new MetodoPrimitiva(objeto, metodoDeDicionario);
}
break;
case 'numero':
case 'número':
const metodoDePrimitivaNumero: Function = primitivasNumero[expressao.simbolo.lexema];
Expand Down
8 changes: 8 additions & 0 deletions fontes/interpretador/interpretador-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ import { PilhaEscoposExecucaoInterface } from '../interfaces/pilha-escopos-execu
import { inferirTipoVariavel } from './inferenciador';
import { MetodoPrimitiva } from '../estruturas/metodo-primitiva';

import primitivasDicionario from '../bibliotecas/primitivas-dicionario';
import primitivasNumero from '../bibliotecas/primitivas-numero';
import primitivasTexto from '../bibliotecas/primitivas-texto';
import primitivasVetor from '../bibliotecas/primitivas-vetor';
Expand Down Expand Up @@ -1416,6 +1417,13 @@ export class InterpretadorBase implements InterpretadorInterface {
}

switch (tipoObjeto) {
case tipoDeDadosDelegua.OBJETO:
case tipoDeDadosDelegua.DICIONARIO:
const metodoDeDicionario: Function = primitivasDicionario[expressao.simbolo.lexema];
if (metodoDeDicionario) {
return new MetodoPrimitiva(objeto, metodoDeDicionario);
}
break;
case tipoDeDadosDelegua.INTEIRO:
case tipoDeDadosDelegua.NUMERO:
const metodoDePrimitivaNumero: Function = primitivasNumero[expressao.simbolo.lexema];
Expand Down
2 changes: 2 additions & 0 deletions fontes/tipos-de-dados/delegua.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export default {
DICIONARIO: 'dicionário',
INTEIRO: 'inteiro',
LOGICO: 'lógico',
NUMERO: 'número',
NULO: 'nulo',
OBJETO: 'objeto',
TEXTO: 'texto',
};
Loading