Class CodeIdentifier
Reference to identifier value. Used instead of string to allow identifier mutation in existing AST (e.g. because initial value is not valid in target language or conflicts with existing identifiers).
public sealed class CodeIdentifier : ICodeElement
- Inheritance
-
CodeIdentifier
- Implements
- Extension Methods
Constructors
CodeIdentifier(string, NameFixOptions?, int?)
public CodeIdentifier(string name, NameFixOptions? fixOptions, int? position)
Parameters
name
stringfixOptions
NameFixOptionsposition
int?
CodeIdentifier(string, bool)
public CodeIdentifier(string name, bool immutable)
Parameters
Properties
FixOptions
Optional normalization hits for invalid identifier normalization logic.
public NameFixOptions? FixOptions { get; }
Property Value
Immutable
When true
, is it not allowed to change identifier name.
Should be used only for identifiers that define name of external object (e.g. class, method or property)
as renaming such identifier will lead to wrong generated code with reference to unknown object.
Setting it for objects, generated by code generator is not recommended as it will prevent it from
renaming on naming conflicts and could result in incorrect generated code with duplicate/conflicting
identifiers.
public bool Immutable { get; }
Property Value
Name
Identifier value.
public string Name { get; }
Property Value
Position
Optional identifier ordinal for identifier normalizer (e.g. see SuffixWithPosition).
public int? Position { get; }
Property Value
- int?