Bug 1424946 - Move GeneralParser::newFunctionBox into a baser class. r=arai

This commit is contained in:
Jeff Walden 2017-12-12 15:20:57 -06:00
Родитель ea7bcff5e6
Коммит 96aa0c5462
2 изменённых файлов: 11 добавлений и 14 удалений

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

@ -923,13 +923,12 @@ ParserBase::newObjectBox(JSObject* obj)
return objbox;
}
template <class ParseHandler, typename CharT>
template <class ParseHandler>
FunctionBox*
GeneralParser<ParseHandler, CharT>::newFunctionBox(Node fn, JSFunction* fun,
uint32_t toStringStart,
Directives inheritedDirectives,
GeneratorKind generatorKind,
FunctionAsyncKind asyncKind)
PerHandlerParser<ParseHandler>::newFunctionBox(Node fn, JSFunction* fun, uint32_t toStringStart,
Directives inheritedDirectives,
GeneratorKind generatorKind,
FunctionAsyncKind asyncKind)
{
MOZ_ASSERT(fun);
@ -941,9 +940,8 @@ GeneralParser<ParseHandler, CharT>::newFunctionBox(Node fn, JSFunction* fun,
* function.
*/
FunctionBox* funbox =
alloc.template new_<FunctionBox>(context, traceListHead, fun, toStringStart,
inheritedDirectives, options().extraWarningsOption,
generatorKind, asyncKind);
alloc.new_<FunctionBox>(context, traceListHead, fun, toStringStart, inheritedDirectives,
options().extraWarningsOption, generatorKind, asyncKind);
if (!funbox) {
ReportOutOfMemory(context);
return nullptr;

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

@ -286,7 +286,9 @@ class PerHandlerParser
bool isValidSimpleAssignmentTarget(Node node,
FunctionCallBehavior behavior = ForbidAssignmentToFunctionCalls);
FunctionBox* newFunctionBox(Node fn, JSFunction* fun, uint32_t toStringStart,
Directives directives, GeneratorKind generatorKind,
FunctionAsyncKind asyncKind);
};
enum class ExpressionClosure { Allowed, Forbidden };
@ -343,6 +345,7 @@ class GeneralParser
using Base::keepAtoms;
using Base::nameIsArgumentsOrEval;
using Base::newFunction;
using Base::newFunctionBox;
using Base::options;
using Base::pos;
using Base::setLocalStrictMode;
@ -527,10 +530,6 @@ class GeneralParser
*/
Node parse();
FunctionBox* newFunctionBox(Node fn, JSFunction* fun, uint32_t toStringStart,
Directives directives,
GeneratorKind generatorKind, FunctionAsyncKind asyncKind);
void trace(JSTracer* trc);
/* Report the given error at the current offset. */