07th-mod / 07th-mod/higurashi-assembly
"Unhandled Operation" Error during script compile is only logged but not thrown otherwise signalled
- 主要语言
- C#
- 星标
- 12
- 派生
- 12
- PR 合并指标
- 30 天内没有已合并 PR
描述
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)
贡献指南
这个仓库没有索引到贡献指南
调研方向
查看编译器代码中记录“Unhandled Operation”错误的ParseOperation方法。问题在于将Debug.LogError更改为抛出异常或以其他方式发出编译失败信号。检查此模式是否存在于其他章节(mod分支)中。验证脚本在出现错误后是否仍能工作,因为用户指出电影似乎可以播放。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100