@lcap/nasl 0.3.10-beta.oom4 → 0.3.12-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/service/app/api.js +17 -17
- package/out/service/app/api.js.map +1 -1
- package/out/service/create/errHandles.js +12 -0
- package/out/service/create/errHandles.js.map +1 -1
- package/out/service/create/index.js +5 -0
- package/out/service/create/index.js.map +1 -1
- package/out/service/logic/logic.d.ts +26 -17
- package/out/service/logic/logic.js +6 -0
- package/out/service/logic/logic.js.map +1 -1
- package/out/types/app/App.d.ts +9 -0
- package/out/types/app/App.js +25 -1
- package/out/types/app/App.js.map +1 -1
- package/out/types/app/History.js +3 -2
- package/out/types/app/History.js.map +1 -1
- package/out/types/app/Service.d.ts +3 -0
- package/out/types/app/Service.js +14 -6
- package/out/types/app/Service.js.map +1 -1
- package/out/types/cacheData.js.map +1 -1
- package/out/types/common/Vertex.js +2 -1
- package/out/types/common/Vertex.js.map +1 -1
- package/out/types/data/Entity.d.ts +4 -0
- package/out/types/data/Entity.js +8 -0
- package/out/types/data/Entity.js.map +1 -1
- package/out/types/data/EntityProperty.d.ts +5 -0
- package/out/types/data/EntityProperty.js +16 -0
- package/out/types/data/EntityProperty.js.map +1 -1
- package/out/types/data/GlobalLogicNode.js +8 -1
- package/out/types/data/GlobalLogicNode.js.map +1 -1
- package/out/types/data/dataTypes.js +1 -1
- package/out/types/data/dataTypes.js.map +1 -1
- package/out/types/data/genBlock/genCurdEditTableBlock.d.ts +3 -0
- package/out/types/data/genBlock/genCurdEditTableBlock.js +578 -0
- package/out/types/data/genBlock/genCurdEditTableBlock.js.map +1 -0
- package/out/types/data/genBlock/genEditTableBlock.d.ts +234 -0
- package/out/types/data/genBlock/genEditTableBlock.js +419 -0
- package/out/types/data/genBlock/genEditTableBlock.js.map +1 -0
- package/out/types/data/genBlock/genQueryComponent.d.ts +20 -0
- package/out/types/data/genBlock/genQueryComponent.js +57 -1
- package/out/types/data/genBlock/genQueryComponent.js.map +1 -1
- package/out/types/data/genBlock/genTableBlock.js +9 -5
- package/out/types/data/genBlock/genTableBlock.js.map +1 -1
- package/out/types/data/genBlock/index.d.ts +2 -0
- package/out/types/data/genBlock/index.js +2 -0
- package/out/types/data/genBlock/index.js.map +1 -1
- package/out/types/data/genBlock/utils.d.ts +7 -0
- package/out/types/data/genBlock/utils.js +38 -1
- package/out/types/data/genBlock/utils.js.map +1 -1
- package/out/types/logic/Logic.d.ts +4 -0
- package/out/types/logic/Logic.js +35 -10
- package/out/types/logic/Logic.js.map +1 -1
- package/out/types/logic/LogicItem.js +6 -8
- package/out/types/logic/LogicItem.js.map +1 -1
- package/out/types/logic/Param.js +5 -13
- package/out/types/logic/Param.js.map +1 -1
- package/out/types/logic/Return.js +3 -11
- package/out/types/logic/Return.js.map +1 -1
- package/out/types/logic/Variable.js +3 -6
- package/out/types/logic/Variable.js.map +1 -1
- package/out/types/logic/translator.js +39 -8
- package/out/types/logic/translator.js.map +1 -1
- package/out/types/page/Element.d.ts +21 -2
- package/out/types/page/Element.js +86 -5
- package/out/types/page/Element.js.map +1 -1
- package/out/types/page/Page.d.ts +4 -0
- package/out/types/page/Page.js +7 -0
- package/out/types/page/Page.js.map +1 -1
- package/out/types/page/View.d.ts +18 -0
- package/out/types/page/View.js +112 -7
- package/out/types/page/View.js.map +1 -1
- package/out/types/page/ViewVariable.js +0 -6
- package/out/types/page/ViewVariable.js.map +1 -1
- package/out/types/process/ProcessParam.js +3 -1
- package/out/types/process/ProcessParam.js.map +1 -1
- package/out/types/utils/index.d.ts +1 -0
- package/out/types/utils/index.js +16 -7
- package/out/types/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/service/app/api.js +4 -4
- package/src/service/create/errHandles.js +12 -0
- package/src/service/create/index.js +6 -0
- package/src/service/logic/logic.js +6 -0
- package/src/types/app/App.ts +32 -9
- package/src/types/app/History.ts +3 -2
- package/src/types/app/Service.ts +18 -9
- package/src/types/cacheData.ts +7 -7
- package/src/types/common/Vertex.ts +2 -1
- package/src/types/data/Entity.ts +7 -0
- package/src/types/data/EntityProperty.ts +12 -0
- package/src/types/data/GlobalLogicNode.ts +8 -1
- package/src/types/data/dataTypes.ts +1 -1
- package/src/types/data/genBlock/genCurdEditTableBlock.ts +581 -0
- package/src/types/data/genBlock/genEditTableBlock.ts +470 -0
- package/src/types/data/genBlock/genQueryComponent.ts +56 -0
- package/src/types/data/genBlock/genTableBlock.ts +14 -10
- package/src/types/data/genBlock/index.ts +2 -0
- package/src/types/data/genBlock/utils.ts +38 -0
- package/src/types/logic/Logic.ts +45 -17
- package/src/types/logic/LogicItem.ts +8 -11
- package/src/types/logic/Param.ts +25 -35
- package/src/types/logic/Return.ts +18 -26
- package/src/types/logic/Variable.ts +18 -20
- package/src/types/logic/translator.js +41 -10
- package/src/types/page/Element.ts +157 -71
- package/src/types/page/Page.ts +7 -0
- package/src/types/page/View.ts +150 -41
- package/src/types/page/ViewVariable.ts +13 -19
- package/src/types/page/dist/View.js +727 -0
- package/src/types/process/ProcessParam.ts +4 -1
- package/src/types/utils/index.ts +16 -7
- package/out/service/debugger/debugger.d.ts +0 -3
- package/out/service/debugger/debugger.js +0 -95
- package/out/service/debugger/debugger.js.map +0 -1
- package/out/test/units/config.spec.d.ts +0 -1
- package/out/test/units/config.spec.js +0 -12
- package/out/test/units/config.spec.js.map +0 -1
- package/out/types/logic/BreakPoint.d.ts +0 -42
- package/out/types/logic/BreakPoint.js +0 -155
- package/out/types/logic/BreakPoint.js.map +0 -1
- package/out/types/logic/Debugger.d.ts +0 -156
- package/out/types/logic/Debugger.js +0 -912
- package/out/types/logic/Debugger.js.map +0 -1
|
@@ -1,912 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Debugger = void 0;
|
|
4
|
-
const { io } = require('socket.io-client');
|
|
5
|
-
const __1 = require("..");
|
|
6
|
-
const debugger_1 = require("../../service/debugger/debugger");
|
|
7
|
-
const LOGIC_BRANCH = ['IfStatement', 'WhileStatement', 'SwitchStatement', 'ForEachStatement'];
|
|
8
|
-
const parentAttrRoot = [undefined, 'consequent', 'alternate', 'cases'];
|
|
9
|
-
function getScopeVariableNames(node) {
|
|
10
|
-
let variables = [];
|
|
11
|
-
let params = [];
|
|
12
|
-
let returns = [];
|
|
13
|
-
if (node?.view) {
|
|
14
|
-
variables = [...node.view.$def.variables];
|
|
15
|
-
params = [...node.view.$def.params];
|
|
16
|
-
}
|
|
17
|
-
if (node) {
|
|
18
|
-
variables = [...variables, ...node.variables];
|
|
19
|
-
params = [...params, ...node.params];
|
|
20
|
-
returns = [...returns, ...node.returns];
|
|
21
|
-
}
|
|
22
|
-
return {
|
|
23
|
-
variables: variables.map((v) => v.name),
|
|
24
|
-
params: params.map((p) => p.name),
|
|
25
|
-
returns: returns.map((r) => r.name),
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function matchVariableValue(names, originData) {
|
|
29
|
-
return names.map((n) => {
|
|
30
|
-
const value = originData[n];
|
|
31
|
-
const type = typeof value;
|
|
32
|
-
return {
|
|
33
|
-
name: n,
|
|
34
|
-
result: {
|
|
35
|
-
type,
|
|
36
|
-
value,
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
function resolveFrontEndTarget(componentId, lineNumber) {
|
|
42
|
-
const view = __1.Vertex.getVertexByRef(componentId);
|
|
43
|
-
const sourceMap = view.sourceMap;
|
|
44
|
-
const targets = Object.values(sourceMap).filter((m) => {
|
|
45
|
-
if (m.node?.type === 'JSBlock')
|
|
46
|
-
return lineNumber >= m.from && lineNumber <= m.to;
|
|
47
|
-
else
|
|
48
|
-
return lineNumber === m.from;
|
|
49
|
-
});
|
|
50
|
-
// const arr = targets.map((item) => vertexsMap.get(item.vertexId));
|
|
51
|
-
// let target;
|
|
52
|
-
// for (let i = 0; i < arr.length; i++) {
|
|
53
|
-
// if (!arr[i] || arr.includes(arr[i].parent)) {
|
|
54
|
-
// continue;
|
|
55
|
-
// }
|
|
56
|
-
// target = targets[i];
|
|
57
|
-
// break;
|
|
58
|
-
// }
|
|
59
|
-
// return {
|
|
60
|
-
// ...target,
|
|
61
|
-
// node: Vertex.getVertexByRef(target.vertexId),
|
|
62
|
-
// };
|
|
63
|
-
let target;
|
|
64
|
-
const arr = targets.map((item) => __1.vertexsMap.get(item.node.id));
|
|
65
|
-
for (let i = 0; i < arr.length; i++) {
|
|
66
|
-
if (!arr[i] || arr.includes(arr[i].parent))
|
|
67
|
-
continue;
|
|
68
|
-
target = targets[i];
|
|
69
|
-
}
|
|
70
|
-
if (!target) {
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
return {
|
|
74
|
-
...target,
|
|
75
|
-
node: __1.Vertex.getVertexByRef(target.node.id),
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
function resolveFrontEndCallFrame(callFrames, currentBreakTarget) {
|
|
79
|
-
const functionStack = callFrames.map((cf) => {
|
|
80
|
-
const view = __1.Vertex.getVertexByRef(cf.componentId);
|
|
81
|
-
const sourceMap = view.sourceMap;
|
|
82
|
-
const target = Object.values(sourceMap).find((m) => cf.line >= m.from && cf.line <= m.to && m.isLogic);
|
|
83
|
-
// const viewInvoke = Vertex.getVertexByRef(cf.componentId);
|
|
84
|
-
// const sourceMapInvoke = view.sourceMap;
|
|
85
|
-
const invokeItem = Object.values(sourceMap).find((m) => m.from === cf.invokeLocation.line && m.node.type === 'CallLogic');
|
|
86
|
-
return {
|
|
87
|
-
...cf,
|
|
88
|
-
target,
|
|
89
|
-
invokeItem,
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
-
return [{
|
|
93
|
-
target: currentBreakTarget,
|
|
94
|
-
}, ...functionStack];
|
|
95
|
-
}
|
|
96
|
-
function resolveCallFrameSimple(callFrames) {
|
|
97
|
-
return callFrames.map((cf) => {
|
|
98
|
-
const view = __1.Vertex.getVertexByRef(cf.componentId);
|
|
99
|
-
const sourceMap = view.sourceMap;
|
|
100
|
-
// const target = Object.values(sourceMap).find((m) => cf.line >= m.from && cf.line <= m.to && m.isLogic);
|
|
101
|
-
const target = Object.values(sourceMap).find((m) => m.from === cf.line && m.node.type === 'CallLogic');
|
|
102
|
-
return {
|
|
103
|
-
...cf,
|
|
104
|
-
target,
|
|
105
|
-
};
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
class SocketEvent extends __1.EventEmitter {
|
|
109
|
-
constructor() {
|
|
110
|
-
super(...arguments);
|
|
111
|
-
this.debuggerClient = null;
|
|
112
|
-
}
|
|
113
|
-
// emitSocket(eventName: string, payload: any) {
|
|
114
|
-
// this.debuggerClient.emit('debug', {
|
|
115
|
-
// event: eventName,
|
|
116
|
-
// payload,
|
|
117
|
-
// });
|
|
118
|
-
// }
|
|
119
|
-
emitSocket(payload) {
|
|
120
|
-
this.debuggerClient.emit('debug', payload);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
const FrontEndProtocol = {
|
|
124
|
-
setbreakpoint(bp) {
|
|
125
|
-
return {
|
|
126
|
-
target: 'Frontend',
|
|
127
|
-
event: 'setbreakpoint',
|
|
128
|
-
payload: {
|
|
129
|
-
componentId: bp.componentId,
|
|
130
|
-
line: bp.lineNumberStart,
|
|
131
|
-
id: bp._uuid,
|
|
132
|
-
isTemporary: bp.isTemporary,
|
|
133
|
-
},
|
|
134
|
-
};
|
|
135
|
-
},
|
|
136
|
-
removeBreakpoint(bp) {
|
|
137
|
-
return {
|
|
138
|
-
target: 'Frontend',
|
|
139
|
-
event: 'removeBreakpoint',
|
|
140
|
-
payload: {
|
|
141
|
-
breakpointId: bp.remoteBreakpointId,
|
|
142
|
-
id: bp._uuid,
|
|
143
|
-
},
|
|
144
|
-
};
|
|
145
|
-
},
|
|
146
|
-
breakPointReceived() {
|
|
147
|
-
return {
|
|
148
|
-
target: 'Frontend',
|
|
149
|
-
event: 'breakPointReceived',
|
|
150
|
-
};
|
|
151
|
-
},
|
|
152
|
-
step(posibleBps) {
|
|
153
|
-
return {
|
|
154
|
-
target: 'Frontend',
|
|
155
|
-
event: 'step',
|
|
156
|
-
payload: {
|
|
157
|
-
posibleBps,
|
|
158
|
-
},
|
|
159
|
-
};
|
|
160
|
-
},
|
|
161
|
-
resume() {
|
|
162
|
-
return {
|
|
163
|
-
target: 'Frontend',
|
|
164
|
-
event: 'resume',
|
|
165
|
-
};
|
|
166
|
-
},
|
|
167
|
-
normalizeResponse(data) {
|
|
168
|
-
if (data.event) {
|
|
169
|
-
return {
|
|
170
|
-
event: data.event,
|
|
171
|
-
payload: data.payload,
|
|
172
|
-
source: 'Frontend',
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
return null;
|
|
176
|
-
},
|
|
177
|
-
evaluatescope(payload) {
|
|
178
|
-
return {
|
|
179
|
-
target: 'Frontend',
|
|
180
|
-
event: 'evaluatescope',
|
|
181
|
-
payload,
|
|
182
|
-
};
|
|
183
|
-
},
|
|
184
|
-
evaluate(payload) {
|
|
185
|
-
return {
|
|
186
|
-
target: 'Frontend',
|
|
187
|
-
event: 'evaluate',
|
|
188
|
-
payload,
|
|
189
|
-
};
|
|
190
|
-
},
|
|
191
|
-
};
|
|
192
|
-
const BackEndProtocol = {
|
|
193
|
-
setbreakpoint(bp) {
|
|
194
|
-
return {
|
|
195
|
-
target: 'Backend',
|
|
196
|
-
operation: {
|
|
197
|
-
appId: bp.appId,
|
|
198
|
-
className: bp.classIdentify,
|
|
199
|
-
lineNumber: bp.lineNumberStart,
|
|
200
|
-
eventType: 'BREAKPOINT',
|
|
201
|
-
breakpointStatus: 'ENABLED',
|
|
202
|
-
},
|
|
203
|
-
};
|
|
204
|
-
},
|
|
205
|
-
removeBreakpoint(bp) {
|
|
206
|
-
return {
|
|
207
|
-
target: 'Backend',
|
|
208
|
-
operation: {
|
|
209
|
-
appId: bp.appId,
|
|
210
|
-
className: bp.classIdentify,
|
|
211
|
-
lineNumber: bp.lineNumberStart,
|
|
212
|
-
eventType: 'BREAKPOINT',
|
|
213
|
-
breakpointStatus: 'DELETED',
|
|
214
|
-
},
|
|
215
|
-
};
|
|
216
|
-
},
|
|
217
|
-
resume(appid, threadId) {
|
|
218
|
-
return {
|
|
219
|
-
target: 'Backend',
|
|
220
|
-
operation: {
|
|
221
|
-
appId: appid,
|
|
222
|
-
eventType: 'RESUME',
|
|
223
|
-
threadId,
|
|
224
|
-
},
|
|
225
|
-
};
|
|
226
|
-
},
|
|
227
|
-
step(appid, threadId) {
|
|
228
|
-
return {
|
|
229
|
-
target: 'Backend',
|
|
230
|
-
operation: {
|
|
231
|
-
appId: appid,
|
|
232
|
-
eventType: 'STEP_OVER',
|
|
233
|
-
threadId,
|
|
234
|
-
},
|
|
235
|
-
};
|
|
236
|
-
},
|
|
237
|
-
normalizeResponse(data) {
|
|
238
|
-
switch (data.type) {
|
|
239
|
-
case 'DebugInfo':
|
|
240
|
-
return {
|
|
241
|
-
event: 'paused',
|
|
242
|
-
payload: data.data,
|
|
243
|
-
source: 'Backend',
|
|
244
|
-
};
|
|
245
|
-
case 'ConnectionInfo':
|
|
246
|
-
return {
|
|
247
|
-
event: 'connection',
|
|
248
|
-
payload: data.data,
|
|
249
|
-
source: 'Backend',
|
|
250
|
-
};
|
|
251
|
-
case 'ExceptionInfo':
|
|
252
|
-
return {
|
|
253
|
-
event: 'exception',
|
|
254
|
-
payload: data.message,
|
|
255
|
-
source: 'Backend',
|
|
256
|
-
};
|
|
257
|
-
default:
|
|
258
|
-
return null;
|
|
259
|
-
}
|
|
260
|
-
},
|
|
261
|
-
};
|
|
262
|
-
class Debugger extends __1.EventEmitter {
|
|
263
|
-
constructor() {
|
|
264
|
-
super();
|
|
265
|
-
this.debuggerClient = null;
|
|
266
|
-
this.currentThread = null;
|
|
267
|
-
this.threads = [];
|
|
268
|
-
this.currentFrontEndThread = null;
|
|
269
|
-
this.frontendConnection = false;
|
|
270
|
-
this.backendConnection = false;
|
|
271
|
-
this.ideConnection = false;
|
|
272
|
-
this.breakPoints = [];
|
|
273
|
-
this.temporaryBreakPoint = null;
|
|
274
|
-
this.temporaryBreakPointTriggered = false;
|
|
275
|
-
this.logicIdClassMap = {};
|
|
276
|
-
this.classLogicIdMap = {};
|
|
277
|
-
this.booting = false;
|
|
278
|
-
this.on('backendConnected', this.onConnectionEnd.bind(this));
|
|
279
|
-
this.on('frontendConnected', this.onConnectionEnd.bind(this));
|
|
280
|
-
}
|
|
281
|
-
get isConnected() {
|
|
282
|
-
// return this.frontendConnection;
|
|
283
|
-
// return this.backendConnection;
|
|
284
|
-
return this.frontendConnection && this.backendConnection;
|
|
285
|
-
}
|
|
286
|
-
get isBreak() {
|
|
287
|
-
return (this.currentThread && this.currentThread.breakPoint);
|
|
288
|
-
}
|
|
289
|
-
get isInFrontendThread() {
|
|
290
|
-
return this.currentFrontEndThread === this.currentThread;
|
|
291
|
-
}
|
|
292
|
-
async closeConnect() {
|
|
293
|
-
if (this.debuggerClient) {
|
|
294
|
-
await new Promise((resolve) => {
|
|
295
|
-
this.debuggerClient.on('disconnect', (reason) => {
|
|
296
|
-
if (reason === 'io client disconnect') {
|
|
297
|
-
this.debuggerClient = null;
|
|
298
|
-
this.frontendConnection = false;
|
|
299
|
-
this.backendConnection = false;
|
|
300
|
-
this.ideConnection = false;
|
|
301
|
-
resolve('closed');
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
this.debuggerClient.disconnect();
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
async boot() {
|
|
309
|
-
try {
|
|
310
|
-
if (this.debuggerClient) {
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
this.ideConnection = false;
|
|
314
|
-
this.debuggerClient = await debugger_1.createSocketClient(this.app.appId);
|
|
315
|
-
this.ideConnection = true;
|
|
316
|
-
this.socketEventEmitter = new SocketEvent();
|
|
317
|
-
this.socketEventEmitter.debuggerClient = this.debuggerClient;
|
|
318
|
-
// this.debuggerClient.emit('debug', { source: 'ide' });
|
|
319
|
-
this.debuggerClient.on('debug', (data) => {
|
|
320
|
-
if (typeof data === 'object') {
|
|
321
|
-
const { event, payload, source, } = FrontEndProtocol.normalizeResponse(data) || BackEndProtocol.normalizeResponse(data);
|
|
322
|
-
this.socketEventEmitter.emit(event, payload, source);
|
|
323
|
-
}
|
|
324
|
-
});
|
|
325
|
-
this.socketEventEmitter.on('getBreakPoint', this.onFetchBreakPoint.bind(this));
|
|
326
|
-
this.socketEventEmitter.on('connection', this.onConnection.bind(this));
|
|
327
|
-
this.socketEventEmitter.on('breakpointsettle', this.onBreakPointSettle.bind(this));
|
|
328
|
-
this.socketEventEmitter.on('removeBreakpointsettle', this.onRemoveBreakpointsettle.bind(this));
|
|
329
|
-
this.socketEventEmitter.on('paused', this.onPaused.bind(this));
|
|
330
|
-
this.socketEventEmitter.on('evaluateresult', this.onEvaluateResult.bind(this));
|
|
331
|
-
this.socketEventEmitter.on('evaluatescoperesult', ({ code, data }) => {
|
|
332
|
-
if (code !== 200) {
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
// const result = data.result.value;
|
|
336
|
-
this.currentFrontEndThread.callFrameScope = data;
|
|
337
|
-
});
|
|
338
|
-
this.socketEventEmitter.on('logictrace', this.onLogicTrace.bind(this));
|
|
339
|
-
this.socketEventEmitter.on('logictraceend', this.onLogicTraceEnd.bind(this));
|
|
340
|
-
this.socketEventEmitter.on('exception', this.onBackEndException.bind(this));
|
|
341
|
-
}
|
|
342
|
-
catch (err) {
|
|
343
|
-
console.error(err);
|
|
344
|
-
throw '连接失败';
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
/*combineCallFrameScope(data) {
|
|
348
|
-
const {
|
|
349
|
-
variables,
|
|
350
|
-
params,
|
|
351
|
-
returns,
|
|
352
|
-
} = data;
|
|
353
|
-
|
|
354
|
-
const {
|
|
355
|
-
variables: currVariable,
|
|
356
|
-
params: currParams,
|
|
357
|
-
returns: currReturns,
|
|
358
|
-
} = this.currentCallFrameScope;
|
|
359
|
-
function comparePart(part, oldpart) {
|
|
360
|
-
const list
|
|
361
|
-
= part.forEach(({ name, result }) => {
|
|
362
|
-
if (result.subtype === 'error') {
|
|
363
|
-
return oldpart.find((v) => v.name === name);
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
}*/
|
|
368
|
-
resetState() {
|
|
369
|
-
this.currentThread = null;
|
|
370
|
-
this.threads = [];
|
|
371
|
-
this.currentFrontEndThread = null;
|
|
372
|
-
this.temporaryBreakPoint = null;
|
|
373
|
-
this.temporaryBreakPointTriggered = false;
|
|
374
|
-
}
|
|
375
|
-
async onFetchBreakPoint(data) {
|
|
376
|
-
const componentId = data.data.sourceCodeId;
|
|
377
|
-
const promises = [];
|
|
378
|
-
this.breakPoints.forEach((bp) => {
|
|
379
|
-
if (bp.status === 'Enabled' && bp.componentId === componentId) {
|
|
380
|
-
const attachResult = bp.attachSourceMap();
|
|
381
|
-
if (attachResult) {
|
|
382
|
-
promises.push(this.setRemoteBreakPointRoundTrip(bp));
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
});
|
|
386
|
-
await Promise.all(promises);
|
|
387
|
-
this.socketEventEmitter.emitSocket(FrontEndProtocol.breakPointReceived());
|
|
388
|
-
}
|
|
389
|
-
onBreakPointSettle(data) {
|
|
390
|
-
// if(!data.data || !data.data.id) {
|
|
391
|
-
// bp.emit('bpsettled', false);
|
|
392
|
-
// return;
|
|
393
|
-
// }
|
|
394
|
-
const bpid = data.data.id;
|
|
395
|
-
const bp = this.breakPoints.find((bp) => bp._uuid === bpid) || this.temporaryBreakPoint;
|
|
396
|
-
if (data.code !== 200) {
|
|
397
|
-
bp.emit('bpsettled', false);
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
if (bp) {
|
|
401
|
-
bp.remoteBreakpointId = data.data.breakpointId;
|
|
402
|
-
bp.emit('bpsettled', true);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
onRemoveBreakpointsettle(data) {
|
|
406
|
-
const bpid = data.data.id;
|
|
407
|
-
const bp = this.breakPoints.find((bp) => bp._uuid === bpid);
|
|
408
|
-
bp.emit('bpremoved');
|
|
409
|
-
}
|
|
410
|
-
async onConnection(data, source) {
|
|
411
|
-
if (source === 'Frontend') {
|
|
412
|
-
this.onFrontEndConnection(data);
|
|
413
|
-
}
|
|
414
|
-
if (source === 'Backend') {
|
|
415
|
-
await this.onBackEndConnection(data);
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
onFrontEndConnection(data) {
|
|
419
|
-
if (data.code === 200) {
|
|
420
|
-
this.frontendConnection = true;
|
|
421
|
-
const currentRequestId = data.data.requestId;
|
|
422
|
-
const idx = this.threads.findIndex((t) => t === this.currentFrontEndThread);
|
|
423
|
-
~idx && this.threads.splice(idx, 1);
|
|
424
|
-
this.currentFrontEndThread = {
|
|
425
|
-
id: null,
|
|
426
|
-
requestId: currentRequestId,
|
|
427
|
-
frontendStack: null,
|
|
428
|
-
callFrameId: null,
|
|
429
|
-
breakPoint: null,
|
|
430
|
-
evaluateExpression: null,
|
|
431
|
-
evaluateValue: null,
|
|
432
|
-
callFrames: null,
|
|
433
|
-
callFrameScope: null,
|
|
434
|
-
};
|
|
435
|
-
this.threads.unshift(this.currentFrontEndThread);
|
|
436
|
-
this.emit('frontendConnected');
|
|
437
|
-
}
|
|
438
|
-
else {
|
|
439
|
-
this.frontendConnection = false;
|
|
440
|
-
this.emit('frontendConnectionFailed');
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
async onBackEndConnection(data) {
|
|
444
|
-
if (data.status === 'Connected') {
|
|
445
|
-
await this.loadBackEndSourceMap();
|
|
446
|
-
this.backendConnection = true;
|
|
447
|
-
this.emit('backendConnected');
|
|
448
|
-
}
|
|
449
|
-
else {
|
|
450
|
-
if (data.name === 'Frontend') {
|
|
451
|
-
this.frontendConnection = false;
|
|
452
|
-
this.emit('frontendConnectionFailed');
|
|
453
|
-
}
|
|
454
|
-
else {
|
|
455
|
-
this.backendConnection = false;
|
|
456
|
-
this.emit('backendConnectionFailed');
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
async loadBackEndSourceMap() {
|
|
461
|
-
const response = await debugger_1.sourceMapService.getSourceMap({
|
|
462
|
-
query: {
|
|
463
|
-
appId: this.app.firstMicroService.id,
|
|
464
|
-
},
|
|
465
|
-
});
|
|
466
|
-
const { vertexMap, logicIdClassMap, classLogicIdMap, } = response;
|
|
467
|
-
this.logicIdClassMap = logicIdClassMap || {};
|
|
468
|
-
this.classLogicIdMap = classLogicIdMap || {};
|
|
469
|
-
const map = Object.values(vertexMap || {});
|
|
470
|
-
Object.keys(this.logicIdClassMap).forEach((logicId) => {
|
|
471
|
-
const classname = this.logicIdClassMap[logicId];
|
|
472
|
-
const logic = __1.Vertex.getVertexByRef(logicId);
|
|
473
|
-
const sourcemap = {};
|
|
474
|
-
map.forEach((m) => {
|
|
475
|
-
if (m.classIdentify === classname) {
|
|
476
|
-
sourcemap[m.vertexId] = m;
|
|
477
|
-
}
|
|
478
|
-
});
|
|
479
|
-
logic.sourceMap = sourcemap;
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
onConnectionEnd() {
|
|
483
|
-
// if (this.isConnected) {
|
|
484
|
-
// this.breakPoints.forEach((bp) => {
|
|
485
|
-
// if (bp.status === 'Enabled') {
|
|
486
|
-
// const attachResult = bp.attachSourceMap();
|
|
487
|
-
// if (attachResult) {
|
|
488
|
-
// this.setRemoteBreakPointRoundTrip(bp);
|
|
489
|
-
// }
|
|
490
|
-
// }
|
|
491
|
-
// });
|
|
492
|
-
// }
|
|
493
|
-
}
|
|
494
|
-
onLogicTrace(data) {
|
|
495
|
-
this.temporaryLogicCallStack = data.data;
|
|
496
|
-
}
|
|
497
|
-
onLogicTraceEnd() {
|
|
498
|
-
// 跳出后端逻辑
|
|
499
|
-
this.currentFrontEndThread.frontendStack = null;
|
|
500
|
-
this.currentFrontEndThread.id = null;
|
|
501
|
-
}
|
|
502
|
-
onPaused(data, source) {
|
|
503
|
-
if (source === 'Frontend') {
|
|
504
|
-
this.onFrontEndPaused(data);
|
|
505
|
-
}
|
|
506
|
-
if (source === 'Backend') {
|
|
507
|
-
this.onBackEndPaused(data);
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
onFrontEndPaused({ code, data }) {
|
|
511
|
-
if (code !== 200) {
|
|
512
|
-
return;
|
|
513
|
-
}
|
|
514
|
-
// const requestId = data.requestId;
|
|
515
|
-
const location = data.location;
|
|
516
|
-
// const isTemporaryBreakPoint = data.isTemporaryBreakPoint;
|
|
517
|
-
// const callFrames = data.payload.callFrames;
|
|
518
|
-
const target = resolveFrontEndTarget(location.componentId, location.line);
|
|
519
|
-
// const view = Vertex.getVertexByRef(location.componentId);
|
|
520
|
-
// const sourceMap = view.sourceMap;
|
|
521
|
-
// const targets = Object.values(sourceMap).filter((m) => {
|
|
522
|
-
// if (m.node?.type === 'JSBlock')
|
|
523
|
-
// return location.line >= m.from && location.line <= m.to;
|
|
524
|
-
// else
|
|
525
|
-
// return location.line === m.from && m.node?.level === 'logicNode';
|
|
526
|
-
// });
|
|
527
|
-
// function getTarget(targets) {
|
|
528
|
-
// const arr = targets.map((item) => vertexsMap.get(item.node.id));
|
|
529
|
-
// for (let i = 0; i < arr.length; i++) {
|
|
530
|
-
// if (!arr[i] || arr.includes(arr[i].parent))
|
|
531
|
-
// continue;
|
|
532
|
-
// return targets[i];
|
|
533
|
-
// }
|
|
534
|
-
// }
|
|
535
|
-
// const target = getTarget(targets);
|
|
536
|
-
if (target) {
|
|
537
|
-
const currentFrontEndThread = this.currentFrontEndThread;
|
|
538
|
-
const logicItem = target.node;
|
|
539
|
-
let breakPoint = logicItem.getBreakPointByLineNumber(location.line);
|
|
540
|
-
if (!breakPoint) {
|
|
541
|
-
breakPoint = logicItem.addTemperaryBreakPoint();
|
|
542
|
-
this.temporaryBreakPoint = breakPoint;
|
|
543
|
-
this.temporaryBreakPointTriggered = true;
|
|
544
|
-
}
|
|
545
|
-
currentFrontEndThread.breakPoint = breakPoint; // isTemporaryBreakPoint ? this.temporaryBreakPoint : ;
|
|
546
|
-
const callframes = resolveFrontEndCallFrame(data.callFramesResolved, target);
|
|
547
|
-
currentFrontEndThread.callFrames = callframes;
|
|
548
|
-
const currentCallFrame = callframes[1];
|
|
549
|
-
const logic = logicItem.logic;
|
|
550
|
-
const frameVariables = getScopeVariableNames(logic);
|
|
551
|
-
this.socketEventEmitter.emitSocket(FrontEndProtocol.evaluatescope(Object.assign({}, frameVariables, {
|
|
552
|
-
callFrameId: currentCallFrame.callFrameId,
|
|
553
|
-
})));
|
|
554
|
-
currentFrontEndThread.callFrameId = currentCallFrame.callFrameId;
|
|
555
|
-
logicItem.folded = false;
|
|
556
|
-
this.app.emit('openLogicItem', logicItem);
|
|
557
|
-
this.app.emit('openDebugger');
|
|
558
|
-
this.currentThread = currentFrontEndThread;
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
async resolveBackEndTarget(className, lineNumber) {
|
|
562
|
-
const logicId = this.classLogicIdMap[className];
|
|
563
|
-
const logic = __1.Vertex.getVertexByRef(logicId);
|
|
564
|
-
const sourceMap = logic.sourceMap;
|
|
565
|
-
const targets = Object.values(sourceMap).filter((m) => lineNumber === m.lineFrom);
|
|
566
|
-
const arr = await Promise.all(targets.map(async (item) => {
|
|
567
|
-
const p = __1.vertexsMap.get(item.vertexId);
|
|
568
|
-
if (!p) {
|
|
569
|
-
const logic = __1.Vertex.getVertexByRef(item.logicId);
|
|
570
|
-
await logic.load();
|
|
571
|
-
return __1.vertexsMap.get(item.vertexId);
|
|
572
|
-
}
|
|
573
|
-
return p;
|
|
574
|
-
}));
|
|
575
|
-
let target;
|
|
576
|
-
for (let i = 0; i < arr.length; i++) {
|
|
577
|
-
if (!arr[i] || arr.includes(arr[i].parent)) {
|
|
578
|
-
continue;
|
|
579
|
-
}
|
|
580
|
-
target = targets[i];
|
|
581
|
-
break;
|
|
582
|
-
}
|
|
583
|
-
return {
|
|
584
|
-
...target,
|
|
585
|
-
node: __1.Vertex.getVertexByRef(target.vertexId),
|
|
586
|
-
};
|
|
587
|
-
}
|
|
588
|
-
async onBackEndPaused(data) {
|
|
589
|
-
const { threadId, requestId: backReqId, className, lineNumber, stackFrames, variables, } = data;
|
|
590
|
-
const target = await this.resolveBackEndTarget(className, lineNumber);
|
|
591
|
-
if (target) {
|
|
592
|
-
const logicItem = __1.Vertex.getVertexByRef(target.vertexId);
|
|
593
|
-
let breakPoint = logicItem.getBreakPointByLineNumber(lineNumber);
|
|
594
|
-
if (!breakPoint) {
|
|
595
|
-
breakPoint = logicItem.addTemperaryBreakPoint();
|
|
596
|
-
this.temporaryBreakPoint = breakPoint;
|
|
597
|
-
this.temporaryBreakPointTriggered = true;
|
|
598
|
-
}
|
|
599
|
-
let threadCurrent;
|
|
600
|
-
if (this.currentFrontEndThread.requestId === backReqId) {
|
|
601
|
-
threadCurrent = this.currentFrontEndThread;
|
|
602
|
-
if (threadCurrent.id !== threadId) {
|
|
603
|
-
Object.assign(this.currentFrontEndThread, {
|
|
604
|
-
id: threadId,
|
|
605
|
-
frontendStack: this.temporaryLogicCallStack?.callFramesResolved,
|
|
606
|
-
});
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
else {
|
|
610
|
-
threadCurrent = this.threads.find((t) => t.id === threadId);
|
|
611
|
-
if (!threadCurrent) {
|
|
612
|
-
threadCurrent = {
|
|
613
|
-
id: threadId,
|
|
614
|
-
frontendStack: null,
|
|
615
|
-
breakPoint: null,
|
|
616
|
-
evaluateValue: null,
|
|
617
|
-
callFrames: null,
|
|
618
|
-
callFrameScope: null,
|
|
619
|
-
};
|
|
620
|
-
this.threads.push(threadCurrent);
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
// TODO resolve frames and scope
|
|
624
|
-
let callFrames = await Promise.all(stackFrames.map(async (cf) => {
|
|
625
|
-
const { className, lineNumber, } = cf;
|
|
626
|
-
const target = await this.resolveBackEndTarget(className, lineNumber);
|
|
627
|
-
return {
|
|
628
|
-
...cf,
|
|
629
|
-
target,
|
|
630
|
-
};
|
|
631
|
-
}));
|
|
632
|
-
const frontendStack = threadCurrent.frontendStack;
|
|
633
|
-
if (frontendStack) {
|
|
634
|
-
callFrames = callFrames.concat(resolveCallFrameSimple(frontendStack));
|
|
635
|
-
}
|
|
636
|
-
const logic = logicItem.logic;
|
|
637
|
-
const frameVariables = getScopeVariableNames(logic);
|
|
638
|
-
const callFrameScope = {
|
|
639
|
-
variables: matchVariableValue(frameVariables.variables, variables),
|
|
640
|
-
params: matchVariableValue(frameVariables.params, variables),
|
|
641
|
-
returns: matchVariableValue(frameVariables.returns, variables),
|
|
642
|
-
};
|
|
643
|
-
Object.assign(threadCurrent, {
|
|
644
|
-
breakPoint,
|
|
645
|
-
evaluateValue: null,
|
|
646
|
-
callFrames,
|
|
647
|
-
callFrameScope,
|
|
648
|
-
});
|
|
649
|
-
this.currentThread = threadCurrent;
|
|
650
|
-
this.app.emit('openLogicItem', logicItem);
|
|
651
|
-
this.app.emit('openDebugger');
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
onBackEndException(data) {
|
|
655
|
-
}
|
|
656
|
-
onEvaluateResult({ code, data }) {
|
|
657
|
-
if (code !== 200) {
|
|
658
|
-
return;
|
|
659
|
-
}
|
|
660
|
-
const result = data.result.value;
|
|
661
|
-
const currentFrontEndThread = this.currentFrontEndThread;
|
|
662
|
-
currentFrontEndThread.evaluateValue = {
|
|
663
|
-
[currentFrontEndThread.evaluateExpression]: result,
|
|
664
|
-
};
|
|
665
|
-
}
|
|
666
|
-
evaluateExpression(expression) {
|
|
667
|
-
const currentFrontEndThread = this.currentFrontEndThread;
|
|
668
|
-
currentFrontEndThread.evaluateExpression = expression;
|
|
669
|
-
this.socketEventEmitter.emitSocket(FrontEndProtocol.evaluate({
|
|
670
|
-
callFrameId: currentFrontEndThread.callFrameId,
|
|
671
|
-
expression,
|
|
672
|
-
}));
|
|
673
|
-
}
|
|
674
|
-
async setRemoteBreakPoint(bp) {
|
|
675
|
-
if (bp.isTemporary) {
|
|
676
|
-
this.temporaryBreakPoint = bp;
|
|
677
|
-
}
|
|
678
|
-
await this.setRemoteBreakPointRoundTrip(bp);
|
|
679
|
-
}
|
|
680
|
-
async removeAllBreakPoint() {
|
|
681
|
-
await debugger_1.breakpointService.removeAllBreakPoints({
|
|
682
|
-
query: {
|
|
683
|
-
appId: this.app.id,
|
|
684
|
-
},
|
|
685
|
-
});
|
|
686
|
-
await Promise.all(this.breakPoints.map(async (bp) => {
|
|
687
|
-
if (this.isConnected) {
|
|
688
|
-
await this.removeRemoteBreakPointRoundTrip(bp);
|
|
689
|
-
}
|
|
690
|
-
bp.removeOnLogicItem();
|
|
691
|
-
}));
|
|
692
|
-
this.breakPoints = [];
|
|
693
|
-
}
|
|
694
|
-
async enableAllBreakPoint() {
|
|
695
|
-
await debugger_1.breakpointService.updateAllBreakPointState({
|
|
696
|
-
query: {
|
|
697
|
-
appId: this.app.id,
|
|
698
|
-
status: 'Enabled',
|
|
699
|
-
},
|
|
700
|
-
});
|
|
701
|
-
await Promise.all(this.breakPoints.map(async (bp) => {
|
|
702
|
-
if (this.isConnected && bp.status === 'Disabled') {
|
|
703
|
-
await this.setRemoteBreakPointRoundTrip(bp);
|
|
704
|
-
}
|
|
705
|
-
bp.status = 'Enabled';
|
|
706
|
-
}));
|
|
707
|
-
}
|
|
708
|
-
async disableAllBreakPoint() {
|
|
709
|
-
await debugger_1.breakpointService.updateAllBreakPointState({
|
|
710
|
-
query: {
|
|
711
|
-
appId: this.app.id,
|
|
712
|
-
status: 'Disabled',
|
|
713
|
-
},
|
|
714
|
-
});
|
|
715
|
-
await Promise.all(this.breakPoints.map(async (bp) => {
|
|
716
|
-
if (this.isConnected && bp.status === 'Enabled') {
|
|
717
|
-
await this.removeRemoteBreakPointRoundTrip(bp);
|
|
718
|
-
}
|
|
719
|
-
bp.status = 'Disabled';
|
|
720
|
-
}));
|
|
721
|
-
}
|
|
722
|
-
async removeRemoteBreakPoint(bp) {
|
|
723
|
-
const index = this.breakPoints.findIndex((b) => b === bp);
|
|
724
|
-
if (index !== -1) {
|
|
725
|
-
if (this.isConnected) {
|
|
726
|
-
await this.removeRemoteBreakPointRoundTrip(bp);
|
|
727
|
-
}
|
|
728
|
-
this.breakPoints.splice(index, 1);
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
async removeRemoteBreakPointRoundTrip(bp) {
|
|
732
|
-
await new Promise((resolve) => {
|
|
733
|
-
let payload;
|
|
734
|
-
if (bp.target === 'Frontend') {
|
|
735
|
-
payload = FrontEndProtocol.removeBreakpoint(bp);
|
|
736
|
-
bp.once('bpremoved', () => {
|
|
737
|
-
resolve(bp);
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
if (bp.target === 'Backend') {
|
|
741
|
-
payload = BackEndProtocol.removeBreakpoint(bp);
|
|
742
|
-
resolve(bp);
|
|
743
|
-
}
|
|
744
|
-
this.socketEventEmitter.emitSocket(payload);
|
|
745
|
-
});
|
|
746
|
-
}
|
|
747
|
-
async setRemoteBreakPointRoundTrip(bp) {
|
|
748
|
-
const result = await new Promise((resolve) => {
|
|
749
|
-
let payload;
|
|
750
|
-
if (bp.target === 'Frontend') {
|
|
751
|
-
payload = FrontEndProtocol.setbreakpoint(bp);
|
|
752
|
-
bp.once('bpsettled', () => {
|
|
753
|
-
resolve(bp);
|
|
754
|
-
});
|
|
755
|
-
}
|
|
756
|
-
if (bp.target === 'Backend') {
|
|
757
|
-
payload = BackEndProtocol.setbreakpoint(bp);
|
|
758
|
-
resolve(bp);
|
|
759
|
-
}
|
|
760
|
-
this.socketEventEmitter.emitSocket(payload);
|
|
761
|
-
});
|
|
762
|
-
return result;
|
|
763
|
-
}
|
|
764
|
-
async step() {
|
|
765
|
-
if (!this.isBreak) {
|
|
766
|
-
return;
|
|
767
|
-
}
|
|
768
|
-
this.resetTemporaryBreakPoint();
|
|
769
|
-
if (this.currentThread) {
|
|
770
|
-
// 后端
|
|
771
|
-
if (this.currentThread === this.currentFrontEndThread && !this.currentThread.id) {
|
|
772
|
-
const thread = this.currentThread;
|
|
773
|
-
const logicitem = thread.breakPoint.logicItem;
|
|
774
|
-
const logic = logicitem.logic;
|
|
775
|
-
const componentId = logic.view.id;
|
|
776
|
-
const sourceMap = logic.view.sourceMap;
|
|
777
|
-
const breakpointTemporary = [];
|
|
778
|
-
function addBp(logicItem) {
|
|
779
|
-
breakpointTemporary.push({
|
|
780
|
-
componentId,
|
|
781
|
-
line: sourceMap[logicItem.id].from,
|
|
782
|
-
isTemporary: true,
|
|
783
|
-
type: logicitem.type,
|
|
784
|
-
});
|
|
785
|
-
}
|
|
786
|
-
function searchLogicItemPosibleBreakPoint(logicItem) {
|
|
787
|
-
const type = logicItem.type;
|
|
788
|
-
if (logicItem.level !== 'logicNode') {
|
|
789
|
-
return;
|
|
790
|
-
}
|
|
791
|
-
if (LOGIC_BRANCH.includes(type)) {
|
|
792
|
-
if (type === 'IfStatement') {
|
|
793
|
-
addBp(logicItem);
|
|
794
|
-
(logicItem.consequent || []).forEach(searchLogicItemPosibleBreakPoint);
|
|
795
|
-
(logicItem.alternate || []).forEach(searchLogicItemPosibleBreakPoint);
|
|
796
|
-
}
|
|
797
|
-
if (type === 'WhileStatement') {
|
|
798
|
-
addBp(logicItem);
|
|
799
|
-
(logicItem.body || []).forEach(searchLogicItemPosibleBreakPoint);
|
|
800
|
-
}
|
|
801
|
-
if (type === 'SwitchStatement') {
|
|
802
|
-
addBp(logicItem);
|
|
803
|
-
const l = (logicItem.cases || []).length - 1;
|
|
804
|
-
(logicItem.cases || []).forEach((c, idx) => {
|
|
805
|
-
if (idx !== l) {
|
|
806
|
-
searchLogicItemPosibleBreakPoint(c);
|
|
807
|
-
}
|
|
808
|
-
(c.consequent || []).forEach(searchLogicItemPosibleBreakPoint);
|
|
809
|
-
(c.alternate || []).forEach(searchLogicItemPosibleBreakPoint);
|
|
810
|
-
});
|
|
811
|
-
}
|
|
812
|
-
if (type === 'ForEachStatement') {
|
|
813
|
-
addBp(logicItem);
|
|
814
|
-
(logicItem.body || []).forEach(searchLogicItemPosibleBreakPoint);
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
else {
|
|
818
|
-
if (logicItem.hasBreakPoint && logicItem.breakPoint && logicItem.breakPoint.status === 'Enabled') {
|
|
819
|
-
return;
|
|
820
|
-
}
|
|
821
|
-
addBp(logicItem);
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
logic.body.forEach(searchLogicItemPosibleBreakPoint);
|
|
825
|
-
this.socketEventEmitter.emitSocket(FrontEndProtocol.step(breakpointTemporary));
|
|
826
|
-
// const index = logicitem.logic.body.findIndex((l) => l === logicitem);
|
|
827
|
-
// const nextLogicItem = logicitem.logic.body[index + 1];
|
|
828
|
-
// if (nextLogicItem && nextLogicItem.type !== 'End') {
|
|
829
|
-
// const breakPoint = nextLogicItem.addTemperaryBreakPoint();
|
|
830
|
-
// await this.setRemoteBreakPoint(breakPoint);
|
|
831
|
-
// this.resume();
|
|
832
|
-
// }
|
|
833
|
-
}
|
|
834
|
-
else {
|
|
835
|
-
this.socketEventEmitter.emitSocket(BackEndProtocol.step(this.app.id, this.currentThread.id));
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
async stepInto() {
|
|
840
|
-
// TODO
|
|
841
|
-
// if (!this.currentBreakPoint) {
|
|
842
|
-
// return;
|
|
843
|
-
// }
|
|
844
|
-
// this.resetTemporaryBreakPoint();
|
|
845
|
-
// const logicitem = this.currentBreakPoint.logicItem;
|
|
846
|
-
// if (logicitem.type === 'CallLogic' && logicitem.callee) {
|
|
847
|
-
// const logicId = logicitem.callee.split('/').pop();
|
|
848
|
-
// const logic = Vertex.getVertexByRef(logicId);
|
|
849
|
-
// const logicItem = logic.body[1];
|
|
850
|
-
// const breakPoint = logicItem.addTemperaryBreakPoint();
|
|
851
|
-
// await this.setRemoteBreakPoint(breakPoint);
|
|
852
|
-
// this.resume();
|
|
853
|
-
// }
|
|
854
|
-
}
|
|
855
|
-
async stepOut() {
|
|
856
|
-
// TODO
|
|
857
|
-
// if (!this.currentBreakPoint) {
|
|
858
|
-
// return;
|
|
859
|
-
// }
|
|
860
|
-
// if (this.currentCallFrames.length < 2) {
|
|
861
|
-
// return;
|
|
862
|
-
// }
|
|
863
|
-
// this.resetTemporaryBreakPoint();
|
|
864
|
-
// const callFrame = this.currentCallFrames[1];
|
|
865
|
-
// const invokeLogicNode = callFrame.invokeItem.node;
|
|
866
|
-
// const logicItem = Vertex.getVertexByRef(invokeLogicNode.id);
|
|
867
|
-
// const invokeLogic = logicItem.logic;
|
|
868
|
-
// const idx = invokeLogic.body.findIndex((i) => i === logicItem);
|
|
869
|
-
// const nextItem = invokeLogic.body[idx + 1];
|
|
870
|
-
// if (nextItem && nextItem.type !== 'End') {
|
|
871
|
-
// const breakPoint = nextItem.addTemperaryBreakPoint();
|
|
872
|
-
// await this.setRemoteBreakPoint(breakPoint);
|
|
873
|
-
// this.resume();
|
|
874
|
-
// }
|
|
875
|
-
}
|
|
876
|
-
resetTemporaryBreakPoint() {
|
|
877
|
-
if (this.temporaryBreakPointTriggered) {
|
|
878
|
-
this.temporaryBreakPoint.logicItem.temporaryBreakPoint = null;
|
|
879
|
-
this.temporaryBreakPoint = null;
|
|
880
|
-
this.temporaryBreakPointTriggered = false;
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
resumeUserAction() {
|
|
884
|
-
this.resetTemporaryBreakPoint();
|
|
885
|
-
this.resume();
|
|
886
|
-
}
|
|
887
|
-
resume() {
|
|
888
|
-
if (this.currentThread) {
|
|
889
|
-
if (this.currentThread === this.currentFrontEndThread) {
|
|
890
|
-
if (this.currentFrontEndThread.id) {
|
|
891
|
-
this.socketEventEmitter.emitSocket(BackEndProtocol.resume(this.app.id, this.currentFrontEndThread.id));
|
|
892
|
-
}
|
|
893
|
-
else {
|
|
894
|
-
this.socketEventEmitter.emitSocket(FrontEndProtocol.resume());
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
else {
|
|
898
|
-
this.socketEventEmitter.emitSocket(BackEndProtocol.resume(this.app.id, this.currentThread.id));
|
|
899
|
-
}
|
|
900
|
-
Object.assign(this.currentThread, {
|
|
901
|
-
callFrameId: null,
|
|
902
|
-
breakPoint: null,
|
|
903
|
-
evaluateExpression: null,
|
|
904
|
-
evaluateValue: null,
|
|
905
|
-
callFrames: null,
|
|
906
|
-
callFrameScope: null,
|
|
907
|
-
});
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
exports.Debugger = Debugger;
|
|
912
|
-
//# sourceMappingURL=Debugger.js.map
|