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.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Loretta.CodeAnalysis.Lua
    Assembly: Loretta.CodeAnalysis.Lua.dll
    Syntax
    public sealed class Script

    Constructors

    | Improve this Doc View Source

    Script()

    Initializes an empty script.

    Declaration
    public Script()
    | Improve this Doc View Source

    Script(ImmutableArray<SyntaxTree>)

    Initializes a new script.

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

    Properties

    | Improve this Doc View Source

    Empty

    An empty script with no syntax trees.

    Declaration
    public static Script Empty { get; }
    Property Value
    Type Description
    Script
    | Improve this Doc View Source

    RootScope

    The root scope of the script.

    Declaration
    public IScope RootScope { get; }
    Property Value
    Type Description
    IScope
    | Improve this Doc View Source

    SyntaxTrees

    The syntax trees contained in this script.

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

    Methods

    | Improve this Doc View Source

    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.
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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.

    • Improve this Doc
    • View Source
    ☀
    ☾
    In This Article
    Back to top

    Copyright (c) LorettaDevs

    Generated by DocFX

    ☀
    ☾