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

#503 Matriz sendo construida de forma errada #574

Closed
wants to merge 1 commit into from

Conversation

samuelrvg
Copy link
Member

Resolve: #503

@samuelrvg
Copy link
Member Author

samuelrvg commented Jan 16, 2024

@leonelsanchesdasilva Se concordar com a forma que resolvi no VisuAlg, vamos precisar implementar nos demais dialetos, não fiz no interpretador-base e no avaliador-sintático para não quebrar os demais dialetos, adicionei a implementação somente para VisuAlg nesse primeiro momento.

Copy link
Contributor

@leonelsanchesdasilva leonelsanchesdasilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gostei do que foi feito aqui, mas acho que algumas mudanças são necessárias.

@@ -210,6 +210,9 @@ export class InterpretadorBase implements InterpretadorInterface {
/* if (expressao === null || expressao === undefined) {
console.log('Aqui');
} */
if (!expressao) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Na verdade é pra dar erro nesse ponto mesmo. Se você quiser mudar para dar um throw aqui, por exemplo, "expressão não deveria ser nula aqui". Agora, isso aqui não pode ficar assim.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coloquei devido a um Promisse.all(...) que tinha indice2 pra ser resolvido e que pode ou não ser nulo.

);
}
return objeto.charAt(valorIndice1);
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acho que esse else não precisa.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resquícios do interpretador-base.

objeto instanceof DeleguaModulo
) {
objeto[indicePrimario] = valor;
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acho que não precisa.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resquícios do interpretador-base.

@@ -33,6 +37,158 @@ export class InterpretadorVisuAlg extends InterpretadorBase {
throw new Error('Método não implementado.');
}

async visitarExpressaoAtribuicaoPorIndice(expressao: any): Promise<any> {
const { indice1, indice2 } = expressao.indice;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acho que estamos extrapolando o construto aqui. Sou a favor de criarmos outro: AcessoElementoMatriz.

@samuelrvg
Copy link
Member Author

Continuada na PR #575

@samuelrvg samuelrvg closed this Jan 16, 2024
@samuelrvg samuelrvg deleted the matriz-visualg branch January 18, 2024 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Matriz sendo construída de forma errada
2 participants