You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We probably don't need to create corresponding full action descriptor types, because we can probably just use local variables in the process of handling the action. Eg
functionrunAction(partialActionDescriptor: PartialActionDescriptor){switch(partialActionDescriptor.name){case"bring":
case"move":
const[sourceDescriptor,destinationTargetDescriptor]=inferFullTargets([partialActionDescriptor.source,partialActionDescriptor.destination.target,]);// Note: we don't need to worry about final stages here because bring and move don't use them!constsource=pipelineRunner.run(sourceDescriptor);constdestination=pipelineRunner.run(destinationTargetDescriptor).getDestination(partialActionDescriptor.destination.insertionMode);returnaction.run(source,destination);case"wrapWithPairedDelimiter":
// Some duplication with default case, but not tooo badconst[targetDescriptor]=inferFullTargets([partialActionDescriptor.target,]);consttarget=pipelineRunner.run(targetDescriptor);returnaction.run(target,partialActionDescriptor.left,partialActionDescriptor.right);default:
// TODO: Could prob expose `inferFullTarget` (singular) that takes single descriptor with no previousTargets// eg const targetDescriptor = inferFullTarget(partialActionDescriptor.target)const[targetDescriptor]=inferFullTargets([partialActionDescriptor.target,]);// TODO: Do we want to handle final stages in the generic case? Most// actions don't have them anyway so we might want special cases for themconsttarget=pipelineRunner.run(targetDescriptor);returnaction.run(target);}}
Fwiw if we don't need post-inference action descriptor types, then maybe we should remove Partial from these names, eg just BringMoveActionDescriptor
Note that it's also tempting to just inline the whole ActionDescriptor into the Command object itself. Not sure what the nested object is buying us here
Extension side
getDestination(insertionMode: InsertionMode)toTarget, and have default implementation inBaseTargetrunfor actions that expect a destination to useDestination"swap", it expects two actual targets (not destinations), but internally converts them to destinations when using them as such.PositionTargetto beDestinationand stop implementingTargetfor this type, removing all unnecessary attributeseditfromTargeteditNew#773 while hereOn the api surface, we'd modify
ActionCommandsomething like the following:We probably don't need to create corresponding full action descriptor types, because we can probably just use local variables in the process of handling the action. Eg
Fwiw if we don't need post-inference action descriptor types, then maybe we should remove
Partialfrom these names, eg justBringMoveActionDescriptorNote that it's also tempting to just inline the whole
ActionDescriptorinto theCommandobject itself. Not sure what the nested object is buying us here