зеркало из https://github.com/mozilla/gecko-dev.git
Bug 936143 - Part 2: Simplify and fix js_GetScriptLineExtent. (r=shu)
This commit is contained in:
Родитель
da43c458f6
Коммит
882ca67e7a
|
@ -2250,29 +2250,19 @@ JS_FRIEND_API(unsigned)
|
|||
js_GetScriptLineExtent(JSScript *script)
|
||||
{
|
||||
unsigned lineno = script->lineno;
|
||||
unsigned maxLineNo = 0;
|
||||
bool counting = true;
|
||||
unsigned maxLineNo = lineno;
|
||||
for (jssrcnote *sn = script->notes(); !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) {
|
||||
SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
|
||||
if (type == SRC_SETLINE) {
|
||||
if (maxLineNo < lineno)
|
||||
maxLineNo = lineno;
|
||||
if (type == SRC_SETLINE)
|
||||
lineno = (unsigned) js_GetSrcNoteOffset(sn, 0);
|
||||
counting = true;
|
||||
if (maxLineNo < lineno)
|
||||
maxLineNo = lineno;
|
||||
else
|
||||
counting = false;
|
||||
} else if (type == SRC_NEWLINE) {
|
||||
if (counting)
|
||||
lineno++;
|
||||
}
|
||||
else if (type == SRC_NEWLINE)
|
||||
lineno++;
|
||||
|
||||
if (maxLineNo < lineno)
|
||||
maxLineNo = lineno;
|
||||
}
|
||||
|
||||
if (maxLineNo > lineno)
|
||||
lineno = maxLineNo;
|
||||
|
||||
return 1 + lineno - script->lineno;
|
||||
return 1 + maxLineNo - script->lineno;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Загрузка…
Ссылка в новой задаче