diff --git a/core/procedures/observable_parameter_model.ts b/core/procedures/observable_parameter_model.ts index 4c74a0505..9255037e1 100644 --- a/core/procedures/observable_parameter_model.ts +++ b/core/procedures/observable_parameter_model.ts @@ -17,7 +17,8 @@ export class ObservableParameterModel implements IParameterModel { constructor( private readonly workspace: Workspace, name: string, id?: string) { this.id = id ?? genUid(); - this.variable = workspace.createVariable(name); + this.variable = + this.workspace.getVariable(name) ?? workspace.createVariable(name); } /** @@ -34,12 +35,14 @@ export class ObservableParameterModel implements IParameterModel { * Unimplemented. The built-in ParameterModel does not support typing. * If you want your procedure blocks to have typed parameters, you need to * implement your own ParameterModel. + * + * @throws Throws for the ObservableParameterModel specifically because this + * method is unimplemented. */ setTypes(_types: string[]): this { - console.warn( + throw new Error( 'The built-in ParameterModel does not support typing. You need to ' + 'implement your own custom ParameterModel.'); - return this; } /** diff --git a/core/procedures/observable_procedure_map.ts b/core/procedures/observable_procedure_map.ts index db5edfe68..35ee4a5e7 100644 --- a/core/procedures/observable_procedure_map.ts +++ b/core/procedures/observable_procedure_map.ts @@ -17,7 +17,7 @@ export class ObservableProcedureMap extends Map { * Adds the given procedure model to the procedure map. */ override set(id: string, proc: IProcedureModel): this { - // TODO(#6156): Fire events. + // TODO(#6516): Fire events. super.set(id, proc); return this; } @@ -27,7 +27,7 @@ export class ObservableProcedureMap extends Map { * exists). */ override delete(id: string): boolean { - // TODO(#6156): Fire events. + // TODO(#6516): Fire events. return super.delete(id); } @@ -35,7 +35,7 @@ export class ObservableProcedureMap extends Map { * Removes all ProcedureModels from the procedure map. */ override clear() { - // TODO(#6156): Fire events. + // TODO(#6516): Fire events. super.clear(); } @@ -44,7 +44,8 @@ export class ObservableProcedureMap extends Map { * blocks can find it. */ add(proc: IProcedureModel): this { - // TODO(#6156): Fire events. + // TODO(#6516): Fire events. + // TODO(#6526): See if this method is actually useful. return this.set(proc.getId(), proc); } }