Pardon our dust! Docs for Yarn Spinner for Unity 3.2 and Yarn Spinner for Godot C# are on docs.yarnspinner.dev (the old docs site). Docs for Yarn Spinner for Unity 3.3 (pre-release, out ASAP), Yarn Spinner for Godot GDScript and Yarn Spinner for Unreal Engine (work in progress) are on /docs/ (the new docs site).

CompilationResult

The result of a compilation.
public class CompilationResult : ICodeDumpHelper

Inherits from System.Object

Implements Yarn.ICodeDumpHelper

Instances of this class are produced as a result of supplying a CompilationJob to Compile(CompilationJob).

#Properties

#ContainsErrors

Gets a value indicating whether this compilation result contains any error diagnostics.
public bool ContainsErrors { get }

Type Boolean

If this value is true, then the value contained in Program will not contain a valid output.

#ContainsImplicitStringTags

Gets a value indicating whether the compiler had to create line IDs for lines in the source code that lacked #line: tags.
public bool ContainsImplicitStringTags { get; internal set; }

Type Boolean

Every line is required to have a line ID. If a line doesn't have a line ID specified in the source code (via a #line: tag), the compiler will create one.

Implicit line IDs are guaranteed to remain the same between compilations when the source file does not change. If you want line IDs to remain the same when the source code may be modified in the future, add a #line: tag to the line. This may be done by hand, or added using the TagLines(ISourceInput,HashSet<string>?,ILineTagGenerator?,ILineTagGenerator.TagAbortBehaviour) method.

#DebugInfo Obsolete

Use ProjectDebugInfo.Nodes

Gets the collection of DebugInfo objects for each node in Program.
public IReadOnlyDictionary<string, NodeDebugInfo> DebugInfo { get }

Type IReadOnlyDictionary

#Declarations

Gets the collection of variable declarations that were found during compilation.
public IEnumerable<Declaration> Declarations { get; internal set; }

Type IEnumerable

This value will be null if the CompilationJob object's CompilationType value was not TypeCheck or FullCompilation.

#Diagnostics

Gets the collection of Diagnostic objects that describe problems in the source code.
public IEnumerable<Diagnostic> Diagnostics { get; internal set; }

Type IEnumerable

If the compiler encounters errors while compiling source code, the CompilationResult it produces will have a Program value of null. To help figure out what the error is, users should consult the contents of this property.

#FileTags

Gets the collection of file-level tags found in the source code.
public Dictionary<string, IEnumerable<string>> FileTags { get; internal set; }

Type Dictionary

The keys of this dictionary are the file names (as indicated by the Name property of the CompilationJob's Files collection), and the values are the file tags associated with that file.

#NodeMetadata

contains metadata about all nodes extracted during compilation for use by language server features includes information about jumps, function calls, commands, variables, character names, tags, and structural information
public IEnumerable<NodeMetadata> NodeMetadata { get; internal set; }

Type IEnumerable

#ParseResults

Contains the results of parsing each input of the compilation.
public IEnumerable<FileParseResult> ParseResults { get; internal set; }

Type IEnumerable

#Program

Gets the compiled Yarn program that the Compiler produced.
public Program? Program { get; internal set; }

Type Program

This value will be null if there were errors in the compilation. If this is the case, Diagnostics will contain information describing the errors.

It will also be null if the CompilationJob object's CompilationType value was not FullCompilation.

#ProjectDebugInfo

Gets the debugging information for this compiled project.
public ProjectDebugInfo? ProjectDebugInfo { get; internal set; }

Type ProjectDebugInfo

#StringTable

Gets a dictionary mapping line IDs to StringInfo objects.
public IDictionary<string, StringInfo>? StringTable { get; internal set; }

Type IDictionary

The string table contains the extracted line text found in the provided source code. The keys of this dictionary are the line IDs for each line - either through explicit line tags indicated through the #line: tag, or implicitly-generated line IDs that the compiler added during compilation.

#UserDefinedTypes

Gets a collection of any types that were defined by the user in the input (for example, user-defined enum types.)
public IReadOnlyCollection<IType> UserDefinedTypes { get; internal set; }

Type IReadOnlyCollection

#Methods

#GetDescriptionForVariable(string)

Gets the description for a given variable, if it exists.
public string? GetDescriptionForVariable(string variableName)

Parameters

  • variableNamestring
    The name of the variable.

Returns String: The description for the variable, or null if none was found.

#GetLabelsForNode(string)

Gets the mapping of instruction indices to named labels found in the node.
public IReadOnlyDictionary<int, string> GetLabelsForNode(string node)

Parameters

  • nodestring
    The name of the node.

Returns IReadOnlyDictionary: The instruction label mapping.

#GetStringForKey(string)

Gets the user-facing string for a given key from the code dump helper's string table.
public string? GetStringForKey(string key)

Parameters

  • keystring
    The key to fetch a string for.

Returns String: The found string, or null if none was found.

Generated from Yarn Spinner for Unity 3.3.