import { LineResults } from "../LineResults" ; import { CommandNames } from "../Names/CommandNames" ; import { Command } from "./Command" ; import { CommandResult } from "./CommandResult" ; import { CommandMetadata } from "./Metadata/CommandMetadata" ; import { SingleParameter } from "./Metadata/Parameters/SingleParameter" ; /**
 * Starts a variable declaration.
 */ export class VariableStartCommand extends Command { /**
     * Metadata on the command.
     */ private static metadata : CommandMetadata = new CommandMetadata ( CommandNames . VariableStart ) . withDescription ( "Starts a variable declaration" ) . withIndentation ( [ 1 ] ) . withParameters ( [ new SingleParameter ( "name" , "The name of the variable." , true ) , new SingleParameter ( "type" , "The type of the variable." , true ) , new SingleParameter ( "value" , "The start of the value of the variable." , true ) , ] ) ; returns public getMetadata ( ) { return VariableStartCommand . metadata ; } param parameters returns public render ( parameters ) { const newParameters = [ "variable" ] ; for ( let i = 1 ; i < parameters . length ; i += 1 ) { const parametersSplit = parameters [ i ] . split ( "\n" ) ; newParameters . push ( parametersSplit [ 0 ] ) ; } const output = this . context . convertParsed ( newParameters ) . withAddSemicolon ( false ) ; if ( this . language . syntax . style . separateBraceLines ) { if ( parameters . length === 5 ) { output . commandResults . push ( new CommandResult ( parameters [ 4 ] , 1 ) ) ; } } else { output . commandResults [ output . commandResults . length - 1 ] . indentation += 1 ; } return output ; } }