tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Eval.h (1357B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
      2 * vim: set ts=8 sts=2 et sw=2 tw=80:
      3 * This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef builtin_Eval_h
      8 #define builtin_Eval_h
      9 
     10 #include "NamespaceImports.h"
     11 
     12 #include "js/TypeDecls.h"
     13 
     14 namespace js {
     15 
     16 // The C++ native for 'eval' (ES5 15.1.2.1). The function is named "indirect
     17 // eval" because "direct eval" calls (as defined by the spec) will emit
     18 // JSOp::Eval which in turn calls DirectEval. Thus, even though IndirectEval is
     19 // the callee function object for *all* calls to eval, it is by construction
     20 // only ever called in the case indirect eval.
     21 [[nodiscard]] extern bool IndirectEval(JSContext* cx, unsigned argc, Value* vp);
     22 
     23 // Performs a direct eval of |v| (a string containing code, or another value
     24 // that will be vacuously returned), which must correspond to the currently-
     25 // executing stack frame, which must be a script frame.
     26 [[nodiscard]] extern bool DirectEval(JSContext* cx, HandleValue v,
     27                                     MutableHandleValue vp);
     28 
     29 // True iff fun is a built-in eval function.
     30 extern bool IsAnyBuiltinEval(JSFunction* fun);
     31 
     32 }  // namespace js
     33 
     34 #endif /* builtin_Eval_h */