Skip to content

Commit dad6216

Browse files
committed
Remove dual purpose func storage
1 parent 40c166e commit dad6216

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

src/StudioCore/Editor/MassEdit/MassEdit.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,6 @@ public class MassParamEditRegex
144144
private ParamBank bank;
145145
private ParamEditorSelectionState context;
146146
private Func<object, string[], object> genericFunc;
147-
148-
private Func<int, object[], string, Param.Row, List<EditorAction>,
149-
MassEditResult> rowOpOrCellStageFunc;
150147
private object[] paramArgFuncs;
151148
private string[] argNames;
152149

@@ -283,21 +280,19 @@ private static (MassEditResult, List<EditorAction>) ParseFilterStep(int currentL
283280
{
284281
return (new MassEditResult(MassEditResultType.PARSEERROR, $@"Invalid number of arguments for operation {globalOperationInfo.command} (line {currentLine})"), null);
285282
}
283+
284+
286285
//hacks for now
287286
if (globalOperationInfo.command != null)
288287
return SandboxMassEditExecution(currentLine, partials => ExecGlobalOp(currentLine));
289288
if (varOperationInfo.command != null)
290289
return SandboxMassEditExecution(currentLine, partials => ExecVarStage(currentLine));
291290

292-
if (cellStageInfo.command != null)
293-
rowOpOrCellStageFunc = ExecCellStage;
294-
else
295-
rowOpOrCellStageFunc = ExecRowOp;
296-
297291
if (paramRowStageInfo.command != null)
298292
return SandboxMassEditExecution(currentLine, partials => ExecParamRowStage(currentLine, partials));
299-
else
293+
if (paramStageInfo.command != null)
300294
return SandboxMassEditExecution(currentLine, partials => ExecParamStage(currentLine, partials));
295+
throw new MEParseException("No initial stage or op was parsed", currentLine);
301296
}
302297

303298
private (MassEditResult, List<EditorAction>) SandboxMassEditExecution(int currentLine,
@@ -371,7 +366,14 @@ private MassEditResult ExecParamRowStage(int currentLine, List<EditorAction> par
371366
var paramname = source == MassEditRowSource.Selection
372367
? context.GetActiveParam()
373368
: ParamBank.ClipboardParam;
374-
MassEditResult res = rowOpOrCellStageFunc(currentLine, rowArgFunc, paramname, row, partialActions);
369+
370+
MassEditResult res;
371+
if (rowOperationInfo.command != null)
372+
res = ExecRowOp(currentLine, rowArgFunc, paramname, row, partialActions);
373+
else if (cellStageInfo.command != null)
374+
res = ExecCellStage(currentLine, rowArgFunc, paramname, row, partialActions);
375+
else
376+
throw new MEParseException("No row op or cell stage was parsed", currentLine);
375377
if (res.Type != MassEditResultType.SUCCESS)
376378
{
377379
return res;

0 commit comments

Comments
 (0)