import { LineResults } from "../LineResults" ; import { CommandNames } from "../Names/CommandNames" ; import { Command } from "./Command" ; import { CommandMetadata } from "./Metadata/CommandMetadata" ; import { SingleParameter } from "./Metadata/Parameters/SingleParameter" ; /**
 * Creates an array for unassigned arguments.
 */ export class RestParametersCommand extends Command { /**
     * Metadata on the command.
     */ private static metadata : CommandMetadata = new CommandMetadata ( CommandNames . RestParameters ) . withDescription ( "Creates an array for unassigned arguments" ) . withParameters ( [ new SingleParameter ( "name" , "A name for the rest parameter array." , true ) , new SingleParameter ( "type" , "A type for the rest parameter array." , true ) , ] ) ; returns public getMetadata ( ) { return RestParametersCommand . metadata ; } param parameters returns public render ( parameters ) { const left = this . language . syntax . parameters . restKeywordLeft ; let middle = "" ; const right = this . language . syntax . parameters . restKeywordRight ; if ( this . language . syntax . parameters . restDeclarationType ) { if ( ! this . language . syntax . parameters . restDeclarationAfter ) { middle = parameters [ 2 ] + this . language . syntax . parameters . restKeywordMiddle + parameters [ 1 ] ; } if ( this . language . syntax . parameters . restDeclarationAfter ) { middle = parameters [ 1 ] + this . language . syntax . parameters . restKeywordMiddle + parameters [ 2 ] ; } } else { middle = this . language . syntax . parameters . restKeywordMiddle + parameters [ 1 ] ; } return LineResults . newSingleLine ( left + middle + right ) ; } }