killme2008 / killme2008/aviatorscript

关于运行过程中当前行的获取问题

Open
#553 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
5.2k
Forks
906
PR merge metrics
No merged PRs in 30d

Description

我通过ASMCodeGenerator类的visitLineNumber方法添加了visitMethodInsn来获取当前运行脚本所在行号,但发现了一个问题,在执行while循环的过程中,执行完循环体后,会访问循环体外的下一行2次,然后再回到循环中。虽然不会执行循环体的下一行,但会访问该行,导致获取行号的过程中出现业务上的bug。
例如:
1 while true{
2 print("loop");
3 }
4 print("===")
行号获取顺序:2,4,4,3,2,4,4,3,2,4,4,3

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in ASMCodeGenerator.visitLineNumber and inspect the added visitMethodInsn behavior while running the reported while-loop example. Compare the observed line-number sequence with the executed script lines; done means the loop no longer reports visits to the line outside the loop unless that line actually executes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.