public ICommandResult Execute(ExecutionInformation info, IReadOnlyList <ICommand> arguments, IReadOnlyList <CommandResultType> returnTypes) { info.UseComplexityTokens(1); IReadOnlyList <ICommand> backupArguments = null; if (!info.TryGet <AliasContext>(out var aliasContext)) { aliasContext = new AliasContext(); info.AddModule(aliasContext); } else { backupArguments = aliasContext.Arguments; } aliasContext.Arguments = arguments.Select(c => new LazyCommand(c)).ToArray(); var ret = aliasCommand.Execute(info, Array.Empty <ICommand>(), returnTypes); aliasContext.Arguments = backupArguments; return(ret); }
public async ValueTask <object?> Execute(ExecutionInformation info, IReadOnlyList <ICommand> arguments) { info.UseComplexityTokens(1); IReadOnlyList <ICommand>?backupArguments = null; if (!info.TryGet <AliasContext>(out var aliasContext)) { aliasContext = new AliasContext(); info.AddModule(aliasContext); } else { backupArguments = aliasContext.Arguments; } aliasContext.Arguments = arguments.Select(c => new LazyCommand(c)).ToArray(); var ret = await aliasCommand.Execute(info, Array.Empty <ICommand>()); aliasContext.Arguments = backupArguments; return(ret); }