MCPcopy Create free account
hub / github.com/aiscript-dev/aiscript / _eval

Method _eval

src/interpreter/index.ts:448–466  ·  view source on GitHub ↗
(node: Ast.Node, scope: Scope, callStack: readonly CallInfo[])

Source from the content-addressed store, hash-verified

446
447 @autobind
448 private _eval(node: Ast.Node, scope: Scope, callStack: readonly CallInfo[]): Promise<Value | Control> {
449 return this.__eval(node, scope, callStack).catch(e => {
450 if (e.pos) throw e;
451 else {
452 const e2 = (e instanceof AiScriptError) ? e : new NonAiScriptError(e);
453 e2.pos = node.loc.start;
454 e2.message = [
455 e2.message,
456 ...[...callStack, { pos: e2.pos }].map(({ pos }, i) => {
457 const name = callStack[i - 1]?.name ?? '<root>';
458 return pos
459 ? ` at ${name} (Line ${pos.line}, Column ${pos.column})`
460 : ` at ${name}`;
461 }).reverse(),
462 ].join('\n');
463 throw e2;
464 }
465 });
466 }
467
468 @autobind
469 private _evalSync(node: Ast.Node, scope: Scope, callStack: readonly CallInfo[]): Value | Control {

Callers 7

collectNsMemberMethod · 0.95
_evalClauseMethod · 0.95
_evalBinaryOperationMethod · 0.95
__evalMethod · 0.95
_runMethod · 0.95
evalAndSetAttrMethod · 0.95
getReferenceMethod · 0.95

Calls 1

__evalMethod · 0.95

Tested by

no test coverage detected