mrdocs::js::Scope::compile_function

Compile a script and push results to stack.

Synopsis

Expected<Value>
compile_function(std::string_view jsCode);

Description

Compile ECMAScript source code that defines a function and return the compiled function object.

Unlike the script() function, the code is not executed. A compiled function with the specified number of arguments that can be executed is returned.

If the function code contains more than one function, the return value is the first function compiled.

Return Value

A function object that can be called. The function object has the number of arguments defined in the code. If the code does not define a function, an error is returned.

Parameters

Name

Description

jsCode

The JavaScript code to compile.

Created with MrDocs