Class ComponentCompiler

Class Documentation

class sixtyfps::interpreter::ComponentCompiler

ComponentCompiler is the entry point to the SixtyFPS interpreter that can be used to load .60 files or compile them on-the-fly from a string (using build_from_source()) or from a path (using build_from_source())

Public Functions

inline ComponentCompiler()

Constructs a new ComponentCompiler instance.

inline ~ComponentCompiler()

Destroys this ComponentCompiler.

inline void set_include_paths(const sixtyfps::SharedVector<sixtyfps::SharedString> &paths)

Sets the include paths used for looking up .60 imports to the specified vector of paths.

inline void set_style(std::string_view style)

Sets the style to be used for widgets.

inline sixtyfps::SharedString style() const

Returns the widget style the compiler is currently using when compiling .60 files.

inline sixtyfps::SharedVector<sixtyfps::SharedString> include_paths() const

Returns the include paths the component compiler is currently configured with.

inline sixtyfps::SharedVector<Diagnostic> diagnostics() const

Returns the diagnostics that were produced in the last call to build_from_path() or build_from_source().

inline std::optional<ComponentDefinition> build_from_source(std::string_view source_code, std::string_view path)

Compile a .60 file into a ComponentDefinition

Returns the compiled ComponentDefinition if there were no errors.

Any diagnostics produced during the compilation, such as warnings or errors, are collected in this ComponentCompiler and can be retrieved after the call using the diagnostics() function.

Diagnostics from previous calls are cleared when calling this function.

inline std::optional<ComponentDefinition> build_from_path(std::string_view path)

Compile some .60 code into a ComponentDefinition

The path argument will be used for diagnostics and to compute relative paths while importing.

Any diagnostics produced during the compilation, such as warnings or errors, are collected in this ComponentCompiler and can be retrieved after the call using the Self::diagnostics() function.

Diagnostics from previous calls are cleared when calling this function.