Fix js_LineNumberToPC based on MikeM@RetekSolutions.com's input (313922, r=mrbkap).

This commit is contained in:
brendan@mozilla.org 2007-04-02 11:13:22 -07:00
Родитель 091b286350
Коммит f94795401a
1 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -1632,9 +1632,13 @@ js_LineNumberToPC(JSScript *script, uintN target)
lineno = script->lineno; lineno = script->lineno;
bestdiff = SN_LINE_LIMIT; bestdiff = SN_LINE_LIMIT;
for (sn = SCRIPT_NOTES(script); !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) { for (sn = SCRIPT_NOTES(script); !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) {
if (lineno == target) /*
* Exact-match only if offset is not in the prolog; otherwise use
* nearest greater-or-equal line number match.
*/
if (lineno == target && script->code + offset >= script->main)
goto out; goto out;
if (lineno > target) { if (lineno >= target) {
diff = lineno - target; diff = lineno - target;
if (diff < bestdiff) { if (diff < bestdiff) {
bestdiff = diff; bestdiff = diff;