import { IExpression } from '@/application/Parser/Script/Compiler/Expressions/Expression/IExpression'; import { IExpressionParser } from '@/application/Parser/Script/Compiler/Expressions/Parser/IExpressionParser'; export class ExpressionParserStub implements IExpressionParser { public callHistory = new Array(); private results = new Map(); public withResult(code: string, result: readonly IExpression[]) { if (this.results.has(code)) { throw new Error( 'Result for code is already registered.' + `\nCode: ${code}` + `\nResult: ${JSON.stringify(result)}`, ); } this.results.set(code, result); return this; } public findExpressions(code: string): IExpression[] { this.callHistory.push(code); if (this.results.has(code)) { return [...this.results.get(code)]; } return []; } }