Table of Contents

Class EnvironmentBuilder

Namespace
MuLang.Core.Environment
Assembly
MuLang.Core.dll

Builds an environment schema for MuLang compilation and execution.

public sealed class EnvironmentBuilder
Inheritance
EnvironmentBuilder
Inherited Members

Constructors

EnvironmentBuilder()

public EnvironmentBuilder()

Methods

AddFunction(string, string, IEnumerable<ParameterSymbol>, TypeSymbol)

Adds a provider function to the environment.

public EnvironmentBuilder AddFunction(string id, string name, IEnumerable<ParameterSymbol> parameters, TypeSymbol returnType)

Parameters

id string

The provider identifier.

name string

The language name.

parameters IEnumerable<ParameterSymbol>

The function parameters.

returnType TypeSymbol

The function return type.

Returns

EnvironmentBuilder

The same EnvironmentBuilder instance, for chaining.

Exceptions

ArgumentNullException

Thrown when parameters or returnType is null.

ArgumentException

Thrown when a symbol value is invalid or its name or identifier is already registered.

AddGlobal(string, string, TypeSymbol)

Adds a global value to the environment.

public EnvironmentBuilder AddGlobal(string id, string name, TypeSymbol type)

Parameters

id string

The provider identifier.

name string

The language name.

type TypeSymbol

The type.

Returns

EnvironmentBuilder

The same EnvironmentBuilder instance, for chaining.

Exceptions

ArgumentNullException

Thrown when type is null.

ArgumentException

Thrown when a symbol value is invalid or its name or identifier is already registered.

AddType(ObjectTypeSymbol)

Adds a structured type to the environment.

public EnvironmentBuilder AddType(ObjectTypeSymbol type)

Parameters

type ObjectTypeSymbol

The type.

Returns

EnvironmentBuilder

The same EnvironmentBuilder instance, for chaining.

Exceptions

ArgumentNullException

Thrown when type is null.

ArgumentException

Thrown when the type is anonymous or its name or identifier is already registered.

Build(LanguageVersion)

Creates an immutable environment schema from the registered symbols.

public EnvironmentSchema Build(LanguageVersion languageVersion = LanguageVersion.Version1_2)

Parameters

languageVersion LanguageVersion

The language version.

Returns

EnvironmentSchema

The immutable environment schema.

Exceptions

ArgumentOutOfRangeException

Thrown when languageVersion is not defined.

InvalidOperationException

Thrown when a symbol name is reserved in the selected language version or a referenced structured type is not registered by the same instance.