summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-06-08 13:04:58 -0400
committerGaming4JC <g4jc@hyperbola.info>2019-07-18 22:38:13 -0400
commitdcb43bda93f1f2cbe3da5ba1b7d3f783f1c8ad1c (patch)
tree9d31ce6855ab47e49d5be5e90d3b5819e536e2ff /js
parent5e76f72c539cd0e2fc0d38e4475f494868b5e859 (diff)
downloadUXP-dcb43bda93f1f2cbe3da5ba1b7d3f783f1c8ad1c.tar
UXP-dcb43bda93f1f2cbe3da5ba1b7d3f783f1c8ad1c.tar.gz
UXP-dcb43bda93f1f2cbe3da5ba1b7d3f783f1c8ad1c.tar.lz
UXP-dcb43bda93f1f2cbe3da5ba1b7d3f783f1c8ad1c.tar.xz
UXP-dcb43bda93f1f2cbe3da5ba1b7d3f783f1c8ad1c.zip
1317090: Remove js::FindBody;
Diffstat (limited to 'js')
-rw-r--r--js/src/jsfun.cpp70
-rw-r--r--js/src/jsfun.h4
2 files changed, 0 insertions, 74 deletions
diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp
index e624aa415..3cba3434d 100644
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -886,76 +886,6 @@ const Class JSFunction::class_ = {
const Class* const js::FunctionClassPtr = &JSFunction::class_;
-/* Find the body of a function (not including braces). */
-bool
-js::FindBody(JSContext* cx, HandleFunction fun, HandleLinearString src, size_t* bodyStart,
- size_t* bodyEnd)
-{
- // We don't need principals, since those are only used for error reporting.
- CompileOptions options(cx);
- options.setFileAndLine("internal-findBody", 0);
-
- // For asm.js/wasm modules, there's no script.
- if (fun->hasScript())
- options.setVersion(fun->nonLazyScript()->getVersion());
-
- AutoKeepAtoms keepAtoms(cx->perThreadData);
-
- AutoStableStringChars stableChars(cx);
- if (!stableChars.initTwoByte(cx, src))
- return false;
-
- const mozilla::Range<const char16_t> srcChars = stableChars.twoByteRange();
- TokenStream ts(cx, options, srcChars.begin().get(), srcChars.length(), nullptr);
- int nest = 0;
- bool onward = true;
- // Skip arguments list.
- do {
- TokenKind tt;
- if (!ts.getToken(&tt))
- return false;
- switch (tt) {
- case TOK_NAME:
- case TOK_YIELD:
- if (nest == 0)
- onward = false;
- break;
- case TOK_LP:
- nest++;
- break;
- case TOK_RP:
- if (--nest == 0)
- onward = false;
- break;
- default:
- break;
- }
- } while (onward);
- TokenKind tt;
- if (!ts.getToken(&tt))
- return false;
- if (tt == TOK_ARROW) {
- if (!ts.getToken(&tt))
- return false;
- }
- bool braced = tt == TOK_LC;
- MOZ_ASSERT_IF(fun->isExprBody(), !braced);
- *bodyStart = ts.currentToken().pos.begin;
- if (braced)
- *bodyStart += 1;
- mozilla::RangedPtr<const char16_t> end = srcChars.end();
- if (end[-1] == '}') {
- end--;
- } else {
- MOZ_ASSERT(!braced);
- for (; unicode::IsSpaceOrBOM2(end[-1]); end--)
- ;
- }
- *bodyEnd = end - srcChars.begin();
- MOZ_ASSERT(*bodyStart <= *bodyEnd);
- return true;
-}
-
JSString*
js::FunctionToString(JSContext* cx, HandleFunction fun, bool prettyPrint)
{
diff --git a/js/src/jsfun.h b/js/src/jsfun.h
index 1c7da57ec..62b285806 100644
--- a/js/src/jsfun.h
+++ b/js/src/jsfun.h
@@ -802,10 +802,6 @@ CloneFunctionAndScript(JSContext* cx, HandleFunction fun, HandleObject parent,
gc::AllocKind kind = gc::AllocKind::FUNCTION,
HandleObject proto = nullptr);
-extern bool
-FindBody(JSContext* cx, HandleFunction fun, HandleLinearString src, size_t* bodyStart,
- size_t* bodyEnd);
-
} // namespace js
inline js::FunctionExtended*