mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-20 22:27:31 +09:00
Issue #1952 - m-c 1380962/1: Merge append calls when assembling the source string for native functions
This commit is contained in:
parent
fc6c505da8
commit
70eee9b0df
1 changed files with 4 additions and 12 deletions
|
|
@ -990,7 +990,7 @@ js::FunctionToString(JSContext* cx, HandleFunction fun, bool prettyPrint)
|
||||||
// If we're not in pretty mode, put parentheses around lambda functions
|
// If we're not in pretty mode, put parentheses around lambda functions
|
||||||
// so that eval returns lambda, not function statement.
|
// so that eval returns lambda, not function statement.
|
||||||
if (haveSource && !prettyPrint && funIsNonArrowLambda) {
|
if (haveSource && !prettyPrint && funIsNonArrowLambda) {
|
||||||
if (!out.append("("))
|
if (!out.append('('))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1038,7 +1038,7 @@ js::FunctionToString(JSContext* cx, HandleFunction fun, bool prettyPrint)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (!prettyPrint && funIsNonArrowLambda) {
|
if (!prettyPrint && funIsNonArrowLambda) {
|
||||||
if (!out.append(")"))
|
if (!out.append(')'))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
} else if (fun->isInterpreted() &&
|
} else if (fun->isInterpreted() &&
|
||||||
|
|
@ -1056,22 +1056,14 @@ js::FunctionToString(JSContext* cx, HandleFunction fun, bool prettyPrint)
|
||||||
!script->scriptSource()->sourceRetrievable() ||
|
!script->scriptSource()->sourceRetrievable() ||
|
||||||
fun->compartment()->behaviors().discardSource());
|
fun->compartment()->behaviors().discardSource());
|
||||||
if (!AppendPrelude() ||
|
if (!AppendPrelude() ||
|
||||||
!out.append("() {\n ") ||
|
!out.append("() {\n [sourceless code]\n}"))
|
||||||
!out.append("[sourceless code]") ||
|
|
||||||
!out.append("\n}"))
|
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (!AppendPrelude() ||
|
if (!AppendPrelude() ||
|
||||||
!out.append("() {\n "))
|
!out.append("() {\n [native code]\n}"))
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
if (!out.append("[native code]"))
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
if (!out.append("\n}"))
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return out.finishString();
|
return out.finishString();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue