Search Results for

    Show / Hide Table of Contents

    Class Script

    A script containing one or more files.

    Inheritance
    System.Object
    Script
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Loretta.CodeAnalysis.Lua
    Assembly: cs.temp.dll.dll
    Syntax
    public sealed class Script

    Constructors

    Script()

    Initializes an empty script.

    Declaration
    public Script()

    Script(ImmutableArray<SyntaxTree>)

    Initializes a new script.

    Declaration
    public Script(ImmutableArray<SyntaxTree> syntaxTrees)
    Parameters
    Type Name Description
    ImmutableArray<SyntaxTree> syntaxTrees

    Properties

    Empty

    An empty script with no syntax trees.

    Declaration
    public static Script Empty { get; }
    Property Value
    Type Description
    Script

    RootScope

    The root scope of the script.

    Declaration
    public IScope RootScope { get; }
    Property Value
    Type Description
    IScope

    SyntaxTrees

    The syntax trees contained in this script.

    Declaration
    public ImmutableArray<SyntaxTree> SyntaxTrees { get; }
    Property Value
    Type Description
    ImmutableArray<SyntaxTree>

    Methods

    FindScope(SyntaxNode, ScopeKind)

    Attempts to find the outermost scope of the provided kind (or a more generic one).

    Declaration
    public IScope FindScope(SyntaxNode node, ScopeKind kind = ScopeKind.Block)
    Parameters
    Type Name Description
    SyntaxNode node

    The node to search from.

    ScopeKind kind

    The kind to search for.

    Returns
    Type Description
    IScope
    Remarks

    If the tree that contains the provided node does not have a CompilationUnitSyntax, statements on the file root will not have a scope.

    The kind parameter searches for a scope of the provided kind or a more generic one as in the following list:

    • Block searches for: Block, Function, File, Global.
    • Function searches for: Function, File, Global.
    • File searches for: File, Global.
    • Global searches for itself.

    GetLabel(SyntaxNode)

    Get the goto label for the provided node.

    Declaration
    public IGotoLabel GetLabel(SyntaxNode node)
    Parameters
    Type Name Description
    SyntaxNode node
    Returns
    Type Description
    IGotoLabel

    GetScope(SyntaxNode)

    Get the scope for the provided node.

    Declaration
    public IScope GetScope(SyntaxNode node)
    Parameters
    Type Name Description
    SyntaxNode node
    Returns
    Type Description
    IScope

    GetVariable(SyntaxNode)

    Get the variable for the provided node.

    Declaration
    public IVariable GetVariable(SyntaxNode node)
    Parameters
    Type Name Description
    SyntaxNode node
    Returns
    Type Description
    IVariable

    RenameVariable(IVariable, String)

    Attempts to rename the provided variable with the new provided name.

    Declaration
    public Result<Script, IEnumerable<RenameError>> RenameVariable(IVariable variable, string newName)
    Parameters
    Type Name Description
    IVariable variable

    The variable to rename.

    System.String newName

    The new variable's name.

    Returns
    Type Description
    Result<Script, IEnumerable<RenameError>>

    An Ok(Script) if the rename was successful or an Err(IEnumerable<RenameError>) if there were errors while renaming the variable.

    ☀
    ☾
    In This Article
    Back to top

    Copyright (c) LorettaDevs

    Generated by DocFX

    ☀
    ☾