MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / doSetAllBreakpoint

Method doSetAllBreakpoint

tools/xsbug-log/xsbug-machine.js:241–279  ·  view source on GitHub ↗
(breakpoints, atStart, atExceptions)

Source from the content-addressed store, hash-verified

239 this.output.write(this.encoder.encode(string));
240 }
241 doSetAllBreakpoint(breakpoints, atStart, atExceptions) {
242 let string = `\r\n<set-all-breakpoints>`;
243 if (atStart)
244 string += `<breakpoint path="start" line="0" id="@0"/>`;
245 if (atExceptions)
246 string += `<breakpoint path="exceptions" line="0" id="@0"/>`;
247 for (let breakpoint of breakpoints) {
248 // Compile expression strings on-the-fly if needed
249 let condition = breakpoint.condition;
250 let hitCount = breakpoint.hitCount || breakpoint.hitCountExpr;
251 let trace = breakpoint.trace;
252 try {
253 if (!condition && breakpoint.conditionExpr)
254 condition = Machine.compileExpression(breakpoint.conditionExpr);
255 if (!trace && breakpoint.traceExpr)
256 trace = Machine.compileExpression(breakpoint.traceExpr);
257 }
258 catch (e) {
259 // Skip advanced features for this breakpoint if compilation fails
260 condition = undefined;
261 trace = undefined;
262 }
263 if (condition || hitCount || trace) {
264 string += `<breakpoint path="${breakpoint.path}" line="${breakpoint.line}" id="@1">`;
265 if (condition)
266 string += `<breakpoint-condition path="${condition}"/>`;
267 if (hitCount)
268 string += `<breakpoint-hit-count path="${hitCount}"/>`;
269 if (trace)
270 string += `<breakpoint-trace path="${trace}"/>`;
271 string += `</breakpoint>`;
272 }
273 else {
274 string += `<breakpoint path="${breakpoint.path}" line="${breakpoint.line}"/>`;
275 }
276 }
277 string += `</set-all-breakpoints>\r\n`;
278 this.output.write(this.encoder.encode(string));
279 }
280 doSetBreakpoint(path, line, options) {
281 if (options && (options.condition || options.hitCount || options.trace)) {
282 let string = `\r\n<set-breakpoint path="${path}" line="${line}" id="@1">`;

Callers 2

onTitleChangedMethod · 0.80
onParsedMethod · 0.80

Calls 2

writeMethod · 0.65
encodeMethod · 0.65

Tested by

no test coverage detected