Skip to content

Commit 20cb359

Browse files
committed
Fix: Resolve Issue with Negative Infinity
1 parent 1e8e18b commit 20cb359

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/tracer/__tests__/tracer_debug.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ function h(f, x) {
112112
// TODO: Check for -Infinity
113113
test('general', () => {
114114
const code = `
115-
const x = 1;
116-
const f = x => x + "";
117-
f(2);
115+
-Infinity;
118116
`
119117
const program = parse(code, { ecmaVersion: 10, locations: true })!
120118
const steps = getSteps(convert(program), { stepLimit: 200 })

src/tracer/nodes/Expression/UnaryExpression.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export class StepperUnaryExpression implements UnaryExpression, StepperBaseNode
4141
&& (node.argument as Literal).value as number > 0
4242
) {
4343
return new StepperLiteral(
44-
- ((node.argument as Literal).value as number),
45-
undefined,
44+
-((node.argument as Literal).value as number),
45+
(-((node.argument as Literal).value as number)).toString(),
4646
node.leadingComments,
4747
node.trailingComments,
4848
node.loc,

0 commit comments

Comments
 (0)