cohtml.Net.ScriptCompiler

Inherits from SystemIDisposable

Public Types

Name
enum classScriptType { ST_Classic, ST_Module, ST_Unknown}
The enumeration tells the ScriptCompiler how to compile the provided source.

Public Functions

Name
virtual voidDispose()
virtual DataBufferCompile(DataBuffer utf8Source, ScriptCompiler.ScriptType scriptType)
Compiles a script file synchronously.
virtual DataBufferCompile(DataBuffer utf8Source)
Compiles a script file synchronously.
virtual voidDestroy()
Destroys the ScriptCompiler and frees memory.

Protected Attributes

Name
boolswigCMemOwn

Public Types Documentation

enum ScriptType

EnumeratorValueDescription
ST_Classic
ST_ModuleTry to compile the provided source as a classic script.
ST_UnknownTry to compile the provided source as a module.

The enumeration tells the ScriptCompiler how to compile the provided source.

Public Functions Documentation

function Dispose

virtual void Dispose()

function Compile

virtual DataBuffer Compile(
    DataBuffer utf8Source,
    ScriptCompiler.ScriptType scriptType
)

Compiles a script file synchronously.

Parameters:

  • utf8Source a data buffer, containing an utf8 encoded script source
  • scriptType specify if the provided source is classic script, module or unknown

Return: A data buffer, containing the compiled data.

Note: If ST_Unknown is passed as scriptType, Cohtml will try to compile it either as a classic script or a module if that fails. V8 might print an error in such case even when the module is compiled successfully, for example if the source contains the “import” keyword because Cohtml will try to compile it as a classic script first.

function Compile

virtual DataBuffer Compile(
    DataBuffer utf8Source
)

Compiles a script file synchronously.

Parameters:

  • utf8Source a data buffer, containing an utf8 encoded script source

Return: A data buffer, containing the compiled data.

Note: If ST_Unknown is passed as scriptType, Cohtml will try to compile it either as a classic script or a module if that fails. V8 might print an error in such case even when the module is compiled successfully, for example if the source contains the “import” keyword because Cohtml will try to compile it as a classic script first.

function Destroy

virtual void Destroy()

Destroys the ScriptCompiler and frees memory.

Protected Attributes Documentation

variable swigCMemOwn

bool swigCMemOwn;