Table of Contents

Class ObjectTypeSymbol

Namespace
MuLang.Core.Types
Assembly
MuLang.Core.dll

Represents a structured MuLang object type.

public sealed class ObjectTypeSymbol : TypeSymbol
Inheritance
ObjectTypeSymbol
Inherited Members

Constructors

ObjectTypeSymbol(string, string, bool, IEnumerable<ObjectPropertySymbol>)

Initializes a new instance of the ObjectTypeSymbol class.

public ObjectTypeSymbol(string id, string name, bool isOpen, IEnumerable<ObjectPropertySymbol> properties)

Parameters

id string

The provider identifier.

name string

The language name.

isOpen bool

A value indicating whether undeclared properties are permitted.

properties IEnumerable<ObjectPropertySymbol>

The declared object properties.

Exceptions

ArgumentException

Thrown when the identifier or name is invalid, or when a property name is duplicated.

ArgumentNullException

Thrown when properties is null.

Properties

DisplayName

Gets the language-facing display name.

public override string DisplayName { get; }

Property Value

string

Id

Gets the provider identifier, or null for a compiler-defined type.

public string? Id { get; }

Property Value

string

IsOpen

Gets a value indicating whether undeclared properties are permitted.

public bool IsOpen { get; }

Property Value

bool

Name

Gets the language name.

public string Name { get; }

Property Value

string

Properties

Gets the declared properties.

public IReadOnlyCollection<ObjectPropertySymbol> Properties { get; }

Property Value

IReadOnlyCollection<ObjectPropertySymbol>

Methods

CreateAnonymous(bool, IEnumerable<ObjectPropertySymbol>)

Creates an anonymous structured object type inferred by the compiler.

public static ObjectTypeSymbol CreateAnonymous(bool isOpen, IEnumerable<ObjectPropertySymbol> properties)

Parameters

isOpen bool

A value indicating whether undeclared properties are permitted.

properties IEnumerable<ObjectPropertySymbol>

The inferred object properties.

Returns

ObjectTypeSymbol

The anonymous structured object type.

Exceptions

ArgumentNullException

Thrown when properties is null.

ArgumentException

Thrown when a property name is duplicated.

TryGetProperty(string, out ObjectPropertySymbol?)

Gets a property by name.

public bool TryGetProperty(string name, out ObjectPropertySymbol? property)

Parameters

name string

The language name.

property ObjectPropertySymbol

When this method returns, contains the property, if found.

Returns

bool

true if a property with the specified name was found; otherwise, false.