import { NewInstantiationSyntaxKind } from "../Languages/Properties/Syntax/NewSyntax" ; import { LineResults } from "../LineResults" ; import { CommandNames } from "../Names/CommandNames" ; import { RenderContext } from "../RenderContext" ; import { Command } from "./Command" ; import { CommandMetadata } from "./Metadata/CommandMetadata" ; import { RepeatingParameters } from "./Metadata/Parameters/RepeatingParameters" ; import { SingleParameter } from "./Metadata/Parameters/SingleParameter" ; import { MemberMethodRenderer } from "./NewRendering/MemberMethodRenderer" ; import { MethodCallRenderer } from "./NewRendering/MethodCallRenderer" ; import { NewRenderer } from "./NewRendering/NewRenderer" ; import { PrefixRenderer } from "./NewRendering/PrefixRenderer" ; /**
 * Instantiates a new class instance.
 */ export class NewCommand extends Command { /**
     * Metadata on the command.
     */ private static metadata : CommandMetadata = new CommandMetadata ( CommandNames . New ) . withDescription ( "Instantiates a new class instance" ) . withParameters ( [ new SingleParameter ( "className" , "Name of the class." , true ) , new RepeatingParameters ( "Arguments to pass into the constructor" , [ new SingleParameter ( "argument" , "Argument to pass into the constructor" , false ) , ] ) , ] ) ; /**
     * Renderers for each possible render style.
     */ private styleRenderers : { [ i ] : NewRenderer ; } ; param context public constructor ( context ) { super ( context ) ; this . styleRenderers = { [ NewInstantiationSyntaxKind . MemberMethodCall ] : new MemberMethodRenderer ( this . language ) , [ NewInstantiationSyntaxKind . MethodCall ] : new MethodCallRenderer ( this . language ) , [ NewInstantiationSyntaxKind . Prefix ] : new PrefixRenderer ( this . language ) , } ; } returns public getMetadata ( ) { return NewCommand . metadata ; } param parameters returns public render ( parameters ) { const instantationKind = this . language . syntax . newProp . instantiationKind ; return this . styleRenderers [ instantationKind ] . render ( parameters ) ; } }