From 6541f7fcbaa22c981ffa488dc7a70b4066be3eed Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 18 Mar 2020 00:38:27 -0400 Subject: [PATCH] Fix some bugs in tracing, and add a reset() function. --- src/core/Trace.ts | 9 +++++++-- src/fed2019/Schedule1.ts | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/core/Trace.ts b/src/core/Trace.ts index 69c4138..512e2e7 100644 --- a/src/core/Trace.ts +++ b/src/core/Trace.ts @@ -35,11 +35,16 @@ export function mark(id: string) { export function end() { stack.pop(); if (stack.length == 0) { - previous = current; - current = null; + reset(); } } +export function reset() { + previous = current; + current = null; + stack = []; +} + export function getLastTraceList(): readonly Edge[] { if (previous === null) return null; diff --git a/src/fed2019/Schedule1.ts b/src/fed2019/Schedule1.ts index 53d8365..60544cd 100644 --- a/src/fed2019/Schedule1.ts +++ b/src/fed2019/Schedule1.ts @@ -5,6 +5,7 @@ import { Form, TaxReturn } from '../core'; import { ComputedLine, InputLine } from '../core/Line'; +import * as Trace from '../core/Trace'; import { NotFoundError, UnsupportedFeatureError } from '../core/Errors'; import { undefinedToZero } from '../core/Math'; @@ -49,6 +50,7 @@ class Input extends InputLine try { value = super.value(tr); } catch (NotFoundError) { + Trace.end(); } if (this._predicate) this._predicate(value); -- 2.43.5