diff --git a/src/models/Project.ts b/src/models/Project.ts index e802532a4..0d31cbb38 100644 --- a/src/models/Project.ts +++ b/src/models/Project.ts @@ -226,14 +226,10 @@ export default class Project { } /** Given a path, try to resolve a corresponding node in one of the sources. */ - resolvePath(path: Path) { - // Resolve the node from the path. - let evaluate: Node | undefined = undefined; - for (const root of this.roots) { - evaluate = root.resolvePath(path); - if (evaluate !== undefined) break; - } - return evaluate; + resolvePath(sourceNumber: number, path: Path) { + const source = this.getSources()[sourceNumber]; + if (source === undefined) return undefined; + else return source.root.resolvePath(path); } /** True if one of the project's contains the given node. */ diff --git a/src/runtime/Evaluator.ts b/src/runtime/Evaluator.ts index a149e4db8..1382570cd 100644 --- a/src/runtime/Evaluator.ts +++ b/src/runtime/Evaluator.ts @@ -122,9 +122,15 @@ export default class Evaluator { * can have multiple streams associated with it. */ #inputs: (null | { + /** The index of the source from which the stream originated */ + source: number; + /** The path to the node in the source */ path: Path; + /** The count of the stream created */ number: number; + /** Exactly when the input occurred */ stepIndex: number; + /** The raw data of the event */ raw: unknown; silent: boolean; })[] = []; @@ -308,7 +314,10 @@ export default class Evaluator { // See if we can find the corresponding stream. else { // Resolve the node from the path. - const evaluate = this.project.resolvePath(input.path); + const evaluate = this.project.resolvePath( + input.source, + input.path + ); // Couldn't find the node, or it's not an evaluate? Stop here. if (evaluate === undefined) { @@ -1230,7 +1239,11 @@ export default class Evaluator { "Warning: Couldn't find the stream associated with an evaluate." ); else { + const source = this.project + .getSources() + .findIndex((source) => source.root === root); this.#inputs.push({ + source, path: root.getPath(evaluate), number, stepIndex: this.#stepIndex,