Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
);
return;
}
}
//having constructed and adjusted breakpoint, here's now a
//user-readable message describing its location
let sourceNames = Object.assign(
{},
...Object.values(this.session.view(solidity.info.sources)).map(
({ id, sourcePath }) => ({
[id]: path.basename(sourcePath)
})
)
);
let locationMessage = DebugUtils.formatBreakpointLocation(
breakpoint,
true,
currentSourceId,
sourceNames
);
//one last check -- does this breakpoint already exist?
let alreadyExists =
breakpoints.filter(
existingBreakpoint =>
existingBreakpoint.sourceId === breakpoint.sourceId &&
existingBreakpoint.line === breakpoint.line &&
existingBreakpoint.node === breakpoint.node //may be undefined
).length > 0;
//NOTE: in the "set breakpoint" case, the above check is somewhat
printBreakpoints() {
let sourceNames = Object.assign(
{},
...Object.values(this.session.view(solidity.info.sources)).map(
({ id, sourcePath }) => ({
[id]: path.basename(sourcePath)
})
)
);
let breakpoints = this.session.view(controller.breakpoints);
if (breakpoints.length > 0) {
for (let breakpoint of this.session.view(controller.breakpoints)) {
let currentLocation = this.session.view(controller.current.location);
let locationMessage = DebugUtils.formatBreakpointLocation(
breakpoint,
currentLocation.node !== undefined &&
breakpoint.node === currentLocation.node.id,
currentLocation.source.id,
sourceNames
);
this.config.logger.log(" Breakpoint at " + locationMessage);
}
} else {
this.config.logger.log("No breakpoints added.");
}
}