07th-mod / 07th-mod/higurashi-assembly
"Unhandled Operation" Error during script compile is only logged but not thrown otherwise signalled
- Linguagem predominante
- C#
- Estrelas
- 12
- Forks
- 12
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
I was testing hou+ using the standalone compiler, and noticed two errors were output while compiling `&opening.txt`.
```c#
void OpeningLaunch()
{
if (GetGlobalFlag(GVideoOpening) >= 3) {
PlayOriginMovie();
}
}
void OpeningStory()
{
if (GetGlobalFlag(GVideoOpening) >= 2) {
SetGlobalFlag(GVideoOpening, 3);
PlayOriginMovie();
}
}
void PlayOriginMovie()
{
if (GetGlobalFlag(GArtStyle) == 2) {
// Play OG video if using OG artstyle
PlayVideo("video/mv13-pc.mp4", 1920, 1080);
} else {
// Otherwise play console art style
PlayVideo("video/mv13-cs.mp4", 1920, 1080);
}
}
```
The error is that `PlayOriginMovie();` should actually be `CallSection("PlayOriginMovie");`
I'm not sure if this works anyway, even without the CallSection, as the movie does seem to play.
But I was wondering how we've been running CI/building the scripts without noticing this error. I then checked where the error was raised:
```C#
public void ParseOperation(ITree tree)
{
name = tree.GetChild(0).Text;
line = tree.Line;
BGIParameters param = (tree.ChildCount <= 1) ? new BGIParameters() : new BGIParameters(tree.GetChild(1));
if (paramLookup.ContainsKey(name))
{
OutputCmd(name, param);
return;
}
Debug.LogError("Unhandled Operation " + name);
CmdOpNull();
}
```
It looks like the error is just printed out, but there is no signalling during compile that an error occurred, so the compiler thinks everything is OK.
----
Will need to check whether this was done deliberately (as the script seems to work anyway under this condition).
But personally, since this only happens if there is a genuine error, I would want to throw an exception and tell the developer to fix the script (since it should usually be an easy fix).
----
Also check if this applies to previous chapters (apply this fix to the `mod` branch)
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
Examine o método ParseOperation no código do compilador onde o erro 'Unhandled Operation' é registrado. A questão é alterar Debug.LogError para lançar uma exceção ou sinalizar uma falha de compilação de outra forma. Verifique se esse padrão existe em outros capítulos (ramo mod). Verifique se o script ainda funciona apesar do erro, pois o usuário observa que o filme parece ser reproduzido.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Domínio
- compilers
- Tipo de issue
- Bug
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 45/100