template<typename Tok> JS::Result<FunctionBox*> BinASTParser<Tok>::buildFunctionBox(GeneratorKind generatorKind, FunctionAsyncKind functionAsyncKind, FunctionSyntaxKind syntax, ParseNode* name) { RootedAtom atom(cx_); if (name) atom = name->name(); // Allocate the function before walking down the tree. RootedFunction fun(cx_); BINJS_TRY_VAR(fun, AllocNewFunction(cx_, atom, syntax, generatorKind, functionAsyncKind, nullptr)); BINJS_TRY_DECL(funbox, alloc_.new_<FunctionBox>(cx_, traceListHead_, fun, /* toStringStart = */ 0, Directives(parseContext_), /* extraWarning = */ false, generatorKind, functionAsyncKind)); traceListHead_ = funbox; funbox->initWithEnclosingParseContext(parseContext_, syntax); return funbox; }
bool TokenCreator::isDirective(Token token) { return Directives(language).isValid(token.name);; }