import { CaseStyle } from "../Languages/Casing/CaseStyle" ; import { LineResults } from "../LineResults" ; import { CommandNames } from "../Names/CommandNames" ; import { KeywordNames } from "../Names/KeywordNames" ; import { Command } from "./Command" ; import { CommandMetadata } from "./Metadata/CommandMetadata" ; import { KeywordParameter } from "./Metadata/Parameters/KeywordParameter" ; import { SingleParameter } from "./Metadata/Parameters/SingleParameter" ; /**
 * Retrieves a static variable.
 */ export class StaticVariableCommand extends Command { /**
     * Metadata on the command.
     */ private static metadata : CommandMetadata = new CommandMetadata ( CommandNames . StaticVariable ) . withDescription ( "Retrieves a static variable" ) . withParameters ( [ new KeywordParameter ( KeywordNames . Privacies , "The privacy of the static variable." , true ) , new SingleParameter ( "className" , "The name of the class the function is on." , true ) , new SingleParameter ( "variableName" , "The name of the static variable." , true ) , ] ) ; returns public getMetadata ( ) { return StaticVariableCommand . metadata ; } param parameters returns public render ( parameters ) { const privacy = parameters [ 1 ] ; const className = parameters [ 2 ] ; let variableName = parameters [ 3 ] ; let variablePrefix ; let casingStyle ; if ( privacy === KeywordNames . Protected ) { variablePrefix = this . language . syntax . classes . statics . variables . protectedPrefix ; casingStyle = this . language . syntax . classes . statics . variables . protectedCase ; } else if ( privacy === KeywordNames . Private ) { variablePrefix = this . language . syntax . classes . statics . variables . privatePrefix ; casingStyle = this . language . syntax . classes . statics . variables . privateCase ; } else { variablePrefix = this . language . syntax . classes . statics . variables . publicPrefix ; casingStyle = this . language . syntax . classes . statics . variables . publicCase ; } variableName = this . context . convertStringToCase ( variableName , casingStyle ) ; let output = "" ; output += className + "." ; output += variablePrefix ; output += variableName ; return LineResults . newSingleLine ( output ) . withAddSemicolon ( true ) ; } }