Search Results for

    Show / Hide Table of Contents

    Class NamingStrategies

    The default naming strategies.

    Inheritance
    System.Object
    NamingStrategies
    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.Experimental.Minifying
    Assembly: Loretta.CodeAnalysis.Lua.Experimental.dll
    Syntax
    public static class NamingStrategies

    Methods

    | Improve this Doc View Source

    Alphabetical(Int32, IEnumerable<IScope>)

    The alphabet naming strategy. This is similar to Sequential(Char, ImmutableArray<String>) with:

    prefix as _

    and alphabet as abcdefghijklmnopqrstuvwxyz.

    It is more optimized than Sequential(Char, ImmutableArray<String>) so use this instead of it whenever possible.
    Declaration
    public static string Alphabetical(int slot, IEnumerable<IScope> scopes)
    Parameters
    Type Name Description
    System.Int32 slot
    IEnumerable<IScope> scopes
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    Numerical(Int32, IEnumerable<IScope>)

    The alphabet naming strategy. This is similar to Sequential(Char, ImmutableArray<String>) with:

    prefix as _

    and alphabet as 0123456789.

    It is more optimized than Sequential(Char, ImmutableArray<String>) so use this instead of it whenever possible.
    Declaration
    public static string Numerical(int slot, IEnumerable<IScope> scopes)
    Parameters
    Type Name Description
    System.Int32 slot
    IEnumerable<IScope> scopes
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    Sequential(Char, ImmutableArray<String>)

    The sequential naming strategy factory method. It'll create a NamingStrategy delegate using the provided prefix and alphabet.

    Declaration
    public static NamingStrategy Sequential(char prefix, ImmutableArray<string> alphabet)
    Parameters
    Type Name Description
    System.Char prefix

    The prefix to use when a variable of the same name is found.

    ImmutableArray<System.String> alphabet

    The alphabet to use. Each character will be a single item.

    Returns
    Type Description
    NamingStrategy
    Remarks

    To provide an example of how this strategy works, let's assume the following:

    1. prefix is '_'
    2. alphabet is "a", "b" and "c"
    3. The provided IScope has two variables in scope named 'a' and 'b'.
    And these are some of its returns:
    • Slot 0: _a (as a is already in scope)
    • Slot 1: _b (as b is already in scope)
    • Slot 2: c (as there is no c already in scope)
    • Slot 3: aa
    • Slot 13: aaa
    • Slot 40: aaaa
    | Improve this Doc View Source

    ZeroWidth(Int32, IEnumerable<IScope>)

    The non-printable characters naming strategy. ONLY WORKS WHEN TARGETTING LUAJIT. This works like Sequential(Char, ImmutableArray<String>). With prefix as _ and alphabet as zero width unicode characters. It is more optimized than Sequential(Char, ImmutableArray<String>) so use this instead of it whenever possible.

    Declaration
    public static string ZeroWidth(int slot, IEnumerable<IScope> scopes)
    Parameters
    Type Name Description
    System.Int32 slot
    IEnumerable<IScope> scopes
    Returns
    Type Description
    System.String
    • Improve this Doc
    • View Source
    ☀
    ☾
    In This Article
    Back to top

    Copyright (c) LorettaDevs

    Generated by DocFX

    ☀
    ☾