Skip to content

Commit

Permalink
making expression debug info serializable (#78727) (#78744)
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar committed Sep 29, 2020
1 parent 282a1d6 commit 1ba7d22
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions src/plugins/expressions/common/ast/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/

import { ExpressionValue, ExpressionValueError } from '../expression_types';
import { ExpressionFunction } from '../../common';

export type ExpressionAstNode =
| ExpressionAstExpression
Expand Down Expand Up @@ -48,9 +47,9 @@ export interface ExpressionAstFunctionDebug {
success: boolean;

/**
* Reference to the expression function this AST node represents.
* Id of expression function.
*/
fn: ExpressionFunction;
fn: string;

/**
* Input that expression function received as its first argument.
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/expressions/common/execution/execution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ describe('Execution', () => {
await execution.result;

for (const node of execution.state.get().ast.chain) {
expect(node.debug?.fn.name).toBe('add');
expect(node.debug?.fn).toBe('add');
}
});

Expand Down Expand Up @@ -667,7 +667,7 @@ describe('Execution', () => {

expect(node2.debug).toMatchObject({
success: false,
fn: expect.any(Object),
fn: 'throws',
input: expect.any(Object),
args: expect.any(Object),
error: expect.any(Object),
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/expressions/common/execution/execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export class Execution<
const timeEnd: number = now();
(link as ExpressionAstFunction).debug = {
success: true,
fn,
fn: fn.name,
input,
args: resolvedArgs,
output,
Expand All @@ -253,7 +253,7 @@ export class Execution<
if (this.params.debug) {
(link as ExpressionAstFunction).debug = {
success: false,
fn,
fn: fn.name,
input,
args,
error,
Expand Down

0 comments on commit 1ba7d22

Please sign in to comment.