mirror of
https://github.com/google/blockly.git
synced 2026-01-15 04:47:10 +01:00
This reverts commit 5f70fc415b.
This commit is contained in:
@@ -602,7 +602,6 @@ export {Css};
|
||||
export {Events};
|
||||
export {Extensions};
|
||||
export {Procedures};
|
||||
export {Procedures as procedures};
|
||||
export {ShortcutItems};
|
||||
export {Themes};
|
||||
export {Tooltip};
|
||||
|
||||
@@ -25,9 +25,6 @@ import * as eventUtils from './events/utils.js';
|
||||
import {Field, UnattachedFieldError} from './field.js';
|
||||
import {Msg} from './msg.js';
|
||||
import {Names} from './names.js';
|
||||
import {ObservableProcedureMap} from './procedures/observable_procedure_map.js';
|
||||
import {ObservableProcedureModel} from './procedures/observable_procedure_model.js';
|
||||
import {ObservableParameterModel} from './procedures/observable_parameter_model.js';
|
||||
import * as utilsXml from './utils/xml.js';
|
||||
import * as Variables from './variables.js';
|
||||
import type {Workspace} from './workspace.js';
|
||||
@@ -453,9 +450,3 @@ export function getDefinition(name: string, workspace: Workspace): Block|null {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export {
|
||||
ObservableProcedureMap,
|
||||
ObservableProcedureModel,
|
||||
ObservableParameterModel,
|
||||
};
|
||||
|
||||
@@ -17,15 +17,13 @@ export class ObservableParameterModel implements IParameterModel {
|
||||
constructor(
|
||||
private readonly workspace: Workspace, name: string, id?: string) {
|
||||
this.id = id ?? genUid();
|
||||
this.variable =
|
||||
this.workspace.getVariable(name) ?? workspace.createVariable(name);
|
||||
this.variable = workspace.createVariable(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name of this parameter to the given name.
|
||||
*/
|
||||
setName(name: string): this {
|
||||
// TODO(#6516): Fire events.
|
||||
if (name == this.variable.name) return this;
|
||||
this.variable =
|
||||
this.workspace.getVariable(name) ?? this.workspace.createVariable(name);
|
||||
@@ -36,14 +34,12 @@ 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 {
|
||||
throw new Error(
|
||||
console.warn(
|
||||
'The built-in ParameterModel does not support typing. You need to ' +
|
||||
'implement your own custom ParameterModel.');
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@ export class ObservableProcedureMap extends Map<string, IProcedureModel> {
|
||||
* Adds the given procedure model to the procedure map.
|
||||
*/
|
||||
override set(id: string, proc: IProcedureModel): this {
|
||||
// TODO(#6516): Fire events.
|
||||
// TODO(#6156): Fire events.
|
||||
super.set(id, proc);
|
||||
return this;
|
||||
}
|
||||
@@ -27,7 +27,7 @@ export class ObservableProcedureMap extends Map<string, IProcedureModel> {
|
||||
* exists).
|
||||
*/
|
||||
override delete(id: string): boolean {
|
||||
// TODO(#6516): Fire events.
|
||||
// TODO(#6156): Fire events.
|
||||
return super.delete(id);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ export class ObservableProcedureMap extends Map<string, IProcedureModel> {
|
||||
* Removes all ProcedureModels from the procedure map.
|
||||
*/
|
||||
override clear() {
|
||||
// TODO(#6516): Fire events.
|
||||
// TODO(#6156): Fire events.
|
||||
super.clear();
|
||||
}
|
||||
|
||||
@@ -44,8 +44,7 @@ export class ObservableProcedureMap extends Map<string, IProcedureModel> {
|
||||
* blocks can find it.
|
||||
*/
|
||||
add(proc: IProcedureModel): this {
|
||||
// TODO(#6516): Fire events.
|
||||
// TODO(#6526): See if this method is actually useful.
|
||||
// TODO(#6156): Fire events.
|
||||
return this.set(proc.getId(), proc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ export class ObservableProcedureModel implements IProcedureModel {
|
||||
|
||||
/** Sets the human-readable name of the procedure. */
|
||||
setName(name: string): this {
|
||||
// TODO(#6516): Fire events.
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
@@ -34,14 +33,12 @@ export class ObservableProcedureModel implements IProcedureModel {
|
||||
* To move a parameter, first delete it, and then re-insert.
|
||||
*/
|
||||
insertParameter(parameterModel: IParameterModel, index: number): this {
|
||||
// TODO(#6516): Fire events.
|
||||
this.parameters.splice(index, 0, parameterModel);
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Removes the parameter at the given index from the parameter list. */
|
||||
deleteParameter(index: number): this {
|
||||
// TODO(#6516): Fire events.
|
||||
this.parameters.splice(index, 1);
|
||||
return this;
|
||||
}
|
||||
@@ -52,7 +49,6 @@ export class ObservableProcedureModel implements IProcedureModel {
|
||||
* Pass null to represent a procedure that does not return.
|
||||
*/
|
||||
setReturnTypes(types: string[]|null): this {
|
||||
// TODO(#6516): Fire events.
|
||||
this.returnTypes = types;
|
||||
return this;
|
||||
}
|
||||
@@ -62,7 +58,6 @@ export class ObservableProcedureModel implements IProcedureModel {
|
||||
* all procedure caller blocks should be disabled as well.
|
||||
*/
|
||||
setEnabled(enabled: boolean): this {
|
||||
// TODO(#6516): Fire events.
|
||||
this.enabled = enabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user