Skip to content

Commit f09f348

Browse files
committed
Merge branch 'master' of https://github.com/eez-open/studio
2 parents 3726167 + ccf27ec commit f09f348

File tree

3 files changed

+6
-104
lines changed

3 files changed

+6
-104
lines changed

packages/eez-studio-types/index.d.ts

-12
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,6 @@ export type LogItemType =
152152
| "info"
153153
| "debug";
154154

155-
export interface IComponentFlowState {
156-
getComponentExecutionState<T>(): T | undefined;
157-
setComponentExecutionState<T>(executionState: T): void;
158-
evalExpression(expression: string): any;
159-
evalTemplateLiteral(expression: string): any;
160-
assignValue(assignableExpression: string, value: any): any;
161-
propagateValue(output: string, value: any): void;
162-
throwError(err: string): void;
163-
log(type: LogItemType, message: string): void;
164-
dispose: (() => void) | undefined;
165-
}
166-
167155
////////////////////////////////////////////////////////////////////////////////
168156

169157
// must be serializable

packages/project-editor/flow/flow-interfaces.ts

-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ export interface IFlow {}
8686

8787
export interface IComponentState {
8888
inputsData: Map<string, any>;
89-
unreadInputsData: Set<string>;
9089
asyncState: boolean;
9190
executionState: any;
9291
}

packages/project-editor/flow/runtime/runtime.ts

+6-91
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ import {
2222
import { Flow } from "project-editor/flow/flow";
2323
import { FlowTabState } from "project-editor/flow/flow-tab-state";
2424
import { ConnectionLine } from "project-editor/flow/connection-line";
25-
import { CatchErrorActionComponent } from "project-editor/flow/components/actions";
2625
import { Component, Widget } from "project-editor/flow/component";
2726
import { IEezObject } from "project-editor/core/object";
2827
import type {
2928
IComponentState,
3029
IDataContext,
31-
IFlowContext
30+
IFlowContext,
31+
IFlowState,
32+
IRuntime
3233
} from "project-editor/flow/flow-interfaces";
3334
import { Page } from "project-editor/features/page/page";
3435
import {
@@ -88,7 +89,7 @@ export enum StateMachineAction {
8889

8990
export type SingleStepMode = "step-into" | "step-over" | "step-out";
9091

91-
export abstract class RuntimeBase {
92+
export abstract class RuntimeBase implements IRuntime {
9293
state: State = State.STARTING;
9394
isDebuggerActive = false;
9495

@@ -375,17 +376,6 @@ export abstract class RuntimeBase {
375376
}
376377
}
377378

378-
removeQueueTasksForFlowState(flowState: FlowState) {
379-
runInAction(() => {
380-
const queueTasksBefore = flowState.runtime.queue.length;
381-
flowState.runtime.queue = flowState.runtime.queue.filter(
382-
queueTask => queueTask.flowState != flowState
383-
);
384-
const queueTasksAfter = flowState.runtime.queue.length;
385-
flowState.numActiveComponents -= queueTasksBefore - queueTasksAfter;
386-
});
387-
}
388-
389379
skipNextQueueTask(nextQueueTask: QueueTask) {
390380
if (this.state != State.PAUSED) {
391381
return false;
@@ -522,8 +512,6 @@ export abstract class RuntimeBase {
522512
);
523513
}
524514

525-
sendResultToWorker(messageId: number, result: any, finalResult?: boolean) {}
526-
527515
onBreakpointAdded(component: Component) {}
528516

529517
onBreakpointRemoved(component: Component) {}
@@ -844,7 +832,7 @@ export abstract class RuntimeBase {
844832
onKeyDown(e: KeyboardEvent) {}
845833
}
846834

847-
export class FlowState {
835+
export class FlowState implements IFlowState {
848836
id = guid();
849837
componentStates = new Map<Component, ComponentState>();
850838
flowStates: FlowState[] = [];
@@ -867,7 +855,6 @@ export class FlowState {
867855
isFinished: observable,
868856
setComponentExecutionState: action,
869857
isRunning: computed,
870-
hasAnyDiposableComponent: computed,
871858
finish: action,
872859
timelinePosition: observable,
873860
setComponentAsyncState: action
@@ -983,50 +970,19 @@ export class FlowState {
983970
);
984971
}
985972

986-
get hasAnyDiposableComponent() {
987-
for (let [_, componentState] of this.componentStates) {
988-
if (componentState.dispose) {
989-
return true;
990-
}
991-
}
992-
return false;
993-
}
994-
995973
finish() {
996974
this.runtime.destroyObjectLocalVariables(this);
997975
this.flowStates.forEach(flowState => flowState.finish());
998-
this.componentStates.forEach(componentState => componentState.finish());
999976
this.runtime.logs.addLogItem(new ActionEndLogItem(this));
1000977
this.isFinished = true;
1001978
}
1002979

1003-
findCatchErrorActionComponent(): ComponentState | undefined {
1004-
const catchErrorActionComponent = this.flow.components.find(
1005-
component => component instanceof CatchErrorActionComponent
1006-
);
1007-
if (catchErrorActionComponent) {
1008-
return this.getComponentState(catchErrorActionComponent);
1009-
}
1010-
1011-
if (this.parentFlowState) {
1012-
return this.parentFlowState.findCatchErrorActionComponent();
1013-
}
1014-
1015-
return undefined;
1016-
}
1017-
1018980
log(type: LogItemType, message: string, component: Component | undefined) {
1019981
this.runtime.logs.addLogItem(
1020982
new LogItem(type, message, this, component)
1021983
);
1022984
}
1023985

1024-
logScpi(message: string, component: Component) {
1025-
this.runtime.logs.addLogItem(
1026-
new LogItem("scpi", message, this, component)
1027-
);
1028-
}
1029-
1030986
get debugInfo(): any {
1031987
return {
1032988
id: this.id,
@@ -1085,22 +1041,17 @@ export class FlowState {
10851041

10861042
export class ComponentState implements IComponentState {
10871043
inputsData = new Map<string, any>();
1088-
unreadInputsData = new Set<string>();
10891044
isRunning: boolean = false;
10901045
asyncState: boolean = false;
10911046
executionState: any;
1092-
dispose: (() => void) | undefined = undefined;
10931047

10941048
constructor(public flowState: FlowState, public component: Component) {
10951049
makeObservable(this, {
10961050
inputsData: observable,
1097-
unreadInputsData: observable,
10981051
isRunning: observable,
10991052
asyncState: observable,
11001053
executionState: observable,
1101-
dispose: observable,
1102-
setInputData: action,
1103-
markInputsDataRead: action
1054+
setInputData: action
11041055
});
11051056
}
11061057

@@ -1110,42 +1061,6 @@ export class ComponentState implements IComponentState {
11101061

11111062
setInputData(input: string, inputData: any) {
11121063
this.inputsData.set(input, inputData);
1113-
this.unreadInputsData.add(input);
1114-
}
1115-
1116-
markInputsDataRead() {
1117-
this.unreadInputsData.clear();
1118-
}
1119-
1120-
get connectedSequenceInputsSet() {
1121-
const inputConnections = new Set<string>();
1122-
for (const connectionLine of this.flowState.flow.connectionLines) {
1123-
if (
1124-
connectionLine.targetComponent == this.component &&
1125-
this.sequenceInputs.find(
1126-
input => input.name == connectionLine.input
1127-
)
1128-
) {
1129-
inputConnections.add(connectionLine.input);
1130-
}
1131-
}
1132-
return inputConnections;
1133-
}
1134-
1135-
get sequenceInputs() {
1136-
return this.component.inputs.filter(input => input.isSequenceInput);
1137-
}
1138-
1139-
get mandatoryDataInputs() {
1140-
return this.component.inputs.filter(
1141-
input => !input.isSequenceInput && !input.isOptionalInput
1142-
);
1143-
}
1144-
1145-
finish() {
1146-
if (this.dispose) {
1147-
this.dispose();
1148-
}
11491064
}
11501065

11511066
get debugInfo() {

0 commit comments

Comments
 (0)