@lcap/nasl 0.3.10-beta → 0.3.10-beta.oom
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/package.json +1 -2
- package/src/types/app/App.ts +32 -27
- package/src/types/index.ts +2 -4
- package/src/types/logic/Logic.ts +0 -24
- package/src/types/logic/LogicItem.ts +5 -207
- package/src/types/logic/translator.js +86 -146
- package/src/types/page/View.ts +6 -27
- package/tsconfig.json +1 -1
- package/src/service/debugger/debugger.js +0 -90
- package/src/types/logic/BreakPoint.ts +0 -200
- package/src/types/logic/Debugger.ts +0 -1140
- package/src/types/logic/translator.d.ts +0 -16
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lcap/nasl",
|
|
3
3
|
"description": "NetEase Application Specific Language",
|
|
4
|
-
"version": "0.3.10-beta",
|
|
4
|
+
"version": "0.3.10-beta.oom",
|
|
5
5
|
"author": "Forrest <rainforest92@126.com>",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "tsc -watch -p ./",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"module-alias": "^2.2.2",
|
|
39
39
|
"qs": "^6.10.1",
|
|
40
40
|
"request-pre": "^0.4.3",
|
|
41
|
-
"socket.io-client": "^2.4.0",
|
|
42
41
|
"uuid": "^8.3.2",
|
|
43
42
|
"vue-template-compiler": "^2.6.10"
|
|
44
43
|
},
|
package/src/types/app/App.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
const { io } = require('socket.io-client');
|
|
2
1
|
import { excludedInJSON, immutable } from '../decorators';
|
|
3
|
-
import { LEVEL_ENUM, Vertex, Service, WebService, MicroService, SERVICE_TYPE, utils, History, updateGenericTypeList,
|
|
2
|
+
import { LEVEL_ENUM, Vertex, Service, WebService, MicroService, SERVICE_TYPE, utils, History, updateGenericTypeList, vertexsMap, Entity, Structure, Enum, dataTypesMap, BaseVariable, variablesMap, updateDataTypeList } from '..';
|
|
4
3
|
import appService from '../../service/app';
|
|
5
|
-
import { createSocketClient, breakpointService } from '../../service/debugger/debugger';
|
|
6
4
|
|
|
7
5
|
interface AppLoadAllOptions {
|
|
8
6
|
asyncLoadServicesDetail?: boolean,
|
|
@@ -114,10 +112,6 @@ export class App extends Vertex {
|
|
|
114
112
|
*/
|
|
115
113
|
@immutable()
|
|
116
114
|
public readonly firstMicroService: MicroService = undefined;
|
|
117
|
-
|
|
118
|
-
@immutable()
|
|
119
|
-
@excludedInJSON()
|
|
120
|
-
public debuggerClient: Debugger = null;
|
|
121
115
|
/**
|
|
122
116
|
* 历史记录
|
|
123
117
|
* 用于处理撤销重做
|
|
@@ -133,8 +127,6 @@ export class App extends Vertex {
|
|
|
133
127
|
source && this.assign(source);
|
|
134
128
|
|
|
135
129
|
this.history = new History({ app: this });
|
|
136
|
-
this.debuggerClient = new Debugger();
|
|
137
|
-
this.debuggerClient.app = this;
|
|
138
130
|
}
|
|
139
131
|
/**
|
|
140
132
|
* 加载详情并同步 envList 信息
|
|
@@ -167,24 +159,6 @@ export class App extends Vertex {
|
|
|
167
159
|
this.assign(result);
|
|
168
160
|
return this;
|
|
169
161
|
}
|
|
170
|
-
|
|
171
|
-
async loadBreakPoints() {
|
|
172
|
-
const breakpointsMeta = await breakpointService.getAllBreakPoints({
|
|
173
|
-
query: {
|
|
174
|
-
appId: this.id,
|
|
175
|
-
},
|
|
176
|
-
});
|
|
177
|
-
breakpointsMeta.forEach(async (bp: BreakpointMeta) => {
|
|
178
|
-
const bpInstance = await BreakPoint.from(bp);
|
|
179
|
-
if (bpInstance)
|
|
180
|
-
this.debuggerClient.breakPoints.push(bpInstance);
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
async bootDebugger() {
|
|
185
|
-
await this.debuggerClient.boot();
|
|
186
|
-
}
|
|
187
|
-
|
|
188
162
|
/**
|
|
189
163
|
* 加载 App 下的所有服务
|
|
190
164
|
*/
|
|
@@ -288,6 +262,37 @@ export class App extends Vertex {
|
|
|
288
262
|
from(source: any) {
|
|
289
263
|
return new App(source);
|
|
290
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
* 清理内存,避免内存泄漏
|
|
267
|
+
*/
|
|
268
|
+
clear() {
|
|
269
|
+
function traverse(obj: any, callback: (obj: any) => void) {
|
|
270
|
+
if(typeof obj !== 'object' || obj === null) return;
|
|
271
|
+
if(obj.id && !vertexsMap.has(obj.id)) return;
|
|
272
|
+
|
|
273
|
+
if(Array.isArray(obj))
|
|
274
|
+
obj.forEach((item) => {
|
|
275
|
+
traverse(item, callback);
|
|
276
|
+
})
|
|
277
|
+
else {
|
|
278
|
+
callback(obj);
|
|
279
|
+
Object.values(obj).forEach((item) => {
|
|
280
|
+
traverse(item, callback);
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
traverse(this, (obj: any) => {
|
|
286
|
+
vertexsMap.delete(obj?.id);
|
|
287
|
+
|
|
288
|
+
if(obj instanceof Entity || obj instanceof Structure || obj instanceof Enum)
|
|
289
|
+
delete dataTypesMap[obj.schemaRef];
|
|
290
|
+
|
|
291
|
+
if(obj instanceof BaseVariable)
|
|
292
|
+
variablesMap.delete(obj.id);
|
|
293
|
+
});
|
|
294
|
+
updateDataTypeList();
|
|
295
|
+
}
|
|
291
296
|
}
|
|
292
297
|
|
|
293
298
|
export default App;
|
package/src/types/index.ts
CHANGED
|
@@ -20,17 +20,15 @@ export * from './data/dataTypes';
|
|
|
20
20
|
export * from './data/dataTypeUtils';
|
|
21
21
|
export { Interface } from './data/Interface';
|
|
22
22
|
export { Category } from './data/GlobalLogicNode';
|
|
23
|
-
export { default as BreakPoint, BreakpointMeta } from './logic/BreakPoint';
|
|
24
|
-
export { Debugger } from './logic/Debugger';
|
|
25
23
|
export { Logic } from './logic/Logic';
|
|
26
24
|
export { LogicItem, LogicNode, ExpressionNode, evaluate } from './logic/LogicItem';
|
|
27
|
-
export { BaseVariable, updateVariablesChildrenSchema, updateAllVariablesChildrenSchema } from './logic/BaseVariable';
|
|
25
|
+
export { BaseVariable, updateVariablesChildrenSchema, updateAllVariablesChildrenSchema, variablesMap } from './logic/BaseVariable';
|
|
28
26
|
export { Param } from './logic/Param';
|
|
29
27
|
export { Variable } from './logic/Variable';
|
|
30
28
|
export { Return } from './logic/Return';
|
|
31
29
|
|
|
32
30
|
export { Page } from './page/Page';
|
|
33
|
-
export { View
|
|
31
|
+
export { View } from './page/View';
|
|
34
32
|
export { ViewParam } from './page/ViewParam';
|
|
35
33
|
export { ViewVariable } from './page/ViewVariable';
|
|
36
34
|
export { Lifecycle } from './page/Lifecycle';
|
package/src/types/logic/Logic.ts
CHANGED
|
@@ -1,20 +1,10 @@
|
|
|
1
1
|
import { immutable, excludedInJSON, circular, action } from '../decorators';
|
|
2
2
|
import { config, history, utils, Vertex, LEVEL_ENUM, Interface, Param, Return, Variable, vertexsMap, typeCheck, ProcessComponent, ProcessInterface, Process, ActionOptions } from '..';
|
|
3
3
|
import { logicService, paramService } from '../../service/logic';
|
|
4
|
-
import { sourceMapService } from '../../service/debugger/debugger';
|
|
5
4
|
import View from '../page/View';
|
|
6
5
|
import { ExpressionNode, LogicItem, LogicNode } from './LogicItem';
|
|
7
6
|
import { convert2SchemaType } from '../data/dataTypeUtils';
|
|
8
7
|
import { isPlainObject, throttle } from 'lodash';
|
|
9
|
-
interface sourceMapObj {
|
|
10
|
-
node: LogicItem,
|
|
11
|
-
classIdentify: string,
|
|
12
|
-
from: number,
|
|
13
|
-
lineFrom: number,
|
|
14
|
-
end: number
|
|
15
|
-
vertexId: string,
|
|
16
|
-
logicId: string,
|
|
17
|
-
}
|
|
18
8
|
import { refreshInterfaces, refreshView, refreshPages } from '../cache';
|
|
19
9
|
import { BusinessCode } from '../enum';
|
|
20
10
|
|
|
@@ -149,10 +139,6 @@ export class Logic extends Vertex {
|
|
|
149
139
|
*/
|
|
150
140
|
@excludedInJSON()
|
|
151
141
|
public contentPromise: Promise<any> = undefined;
|
|
152
|
-
@excludedInJSON()
|
|
153
|
-
public sourceMap: {
|
|
154
|
-
[id: string]: Partial<sourceMapObj>
|
|
155
|
-
} = {};
|
|
156
142
|
/**
|
|
157
143
|
* 树组件的子节点字段
|
|
158
144
|
*/
|
|
@@ -432,16 +418,6 @@ export class Logic extends Vertex {
|
|
|
432
418
|
|
|
433
419
|
return result as LogicItem;
|
|
434
420
|
}
|
|
435
|
-
// async loadSourceMap() {
|
|
436
|
-
// if (!logic.view) {
|
|
437
|
-
// const result = await sourceMapService.getSourceMap({
|
|
438
|
-
// query: {
|
|
439
|
-
// scopeId: this.id,
|
|
440
|
-
// },
|
|
441
|
-
// });
|
|
442
|
-
// this.sourceMap = result;
|
|
443
|
-
// }
|
|
444
|
-
// }
|
|
445
421
|
/**
|
|
446
422
|
* 从后端 JSON 生成规范的 Logic 对象
|
|
447
423
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { immutable, excludedInJSON, action } from '../decorators';
|
|
2
|
-
import { config, typeCheck, utils, Vertex, LEVEL_ENUM, Logic, Schema, ActionOptions, ACTION_MODE
|
|
2
|
+
import { config, typeCheck, utils, Vertex, LEVEL_ENUM, Logic, Schema, ActionOptions, ACTION_MODE } from '..';
|
|
3
3
|
import { logicService } from '../../service/logic';
|
|
4
4
|
import { traverse } from '../utils';
|
|
5
5
|
import { vertexsMap } from '../cacheData';
|
|
@@ -89,11 +89,11 @@ export function evaluate(node: LogicNode | ExpressionNode, finalCode = true): st
|
|
|
89
89
|
|
|
90
90
|
if (node.type === 'BinaryExpression') {
|
|
91
91
|
let left: string = evaluate(<LogicNode>node.left, finalCode);
|
|
92
|
-
if (!atomicList.includes(node.left?.type
|
|
92
|
+
if (!atomicList.includes(node.left?.type) || (!finalCode && node.left?.type === LOGIC_TYPE.MemberExpression))
|
|
93
93
|
left = `(${left})`;
|
|
94
94
|
|
|
95
95
|
let right: string = evaluate(<LogicNode>node.right, finalCode);
|
|
96
|
-
if (!atomicList.includes(node.right?.type
|
|
96
|
+
if (!atomicList.includes(node.right?.type) || (!finalCode && node.left?.type === LOGIC_TYPE.MemberExpression))
|
|
97
97
|
right = `(${right})`;
|
|
98
98
|
|
|
99
99
|
return `${left} ${node.operator} ${right}`;
|
|
@@ -101,10 +101,10 @@ export function evaluate(node: LogicNode | ExpressionNode, finalCode = true): st
|
|
|
101
101
|
|
|
102
102
|
if (node.type === 'LogicalExpression') {
|
|
103
103
|
let left: string = evaluate(<LogicNode>node.left, finalCode);
|
|
104
|
-
if (!atomicList.includes(node.left?.type
|
|
104
|
+
if (!atomicList.includes(node.left?.type) || (!finalCode && node.left?.type === LOGIC_TYPE.MemberExpression))
|
|
105
105
|
left = `(${left})`;
|
|
106
106
|
let right: string = evaluate(<LogicNode>node.right, finalCode);
|
|
107
|
-
if (!atomicList.includes(node.right?.type
|
|
107
|
+
if (!atomicList.includes(node.right?.type) || (!finalCode && node.left?.type === LOGIC_TYPE.MemberExpression))
|
|
108
108
|
right = `(${right})`;
|
|
109
109
|
return `${left} ${node.operator} ${right}`;
|
|
110
110
|
}
|
|
@@ -310,14 +310,6 @@ export class LogicItem extends Vertex {
|
|
|
310
310
|
public readonly pageParamKey: any = undefined;
|
|
311
311
|
@immutable()
|
|
312
312
|
public readonly pageParamKeyValue: any = undefined;
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
断点集合
|
|
316
|
-
*/
|
|
317
|
-
@immutable()
|
|
318
|
-
@excludedInJSON()
|
|
319
|
-
public breakPoints: Array<BreakPoint> = [];
|
|
320
|
-
public temporaryBreakPoint: BreakPoint = null;
|
|
321
313
|
/**
|
|
322
314
|
* CallQueryComponent 对应的 structure 的 id
|
|
323
315
|
*/
|
|
@@ -806,8 +798,6 @@ export class LogicItem extends Vertex {
|
|
|
806
798
|
|
|
807
799
|
if (actionOptions?.actionMode !== ACTION_MODE.undoRedo) {
|
|
808
800
|
if (this.id) {
|
|
809
|
-
await this.removeAllBreakPointsOfDescendants();
|
|
810
|
-
|
|
811
801
|
const body = this.toPlainJSON();
|
|
812
802
|
/// @TODO: 不知道哪里来的 index
|
|
813
803
|
delete body.index;
|
|
@@ -1149,158 +1139,6 @@ export class LogicItem extends Vertex {
|
|
|
1149
1139
|
parentAttr: activeImage.parentAttr,
|
|
1150
1140
|
};
|
|
1151
1141
|
}
|
|
1152
|
-
|
|
1153
|
-
addBreakPointInstance(bp: BreakPoint) {
|
|
1154
|
-
const finded = this.breakPoints.find((item) => item.offset === bp.offset);
|
|
1155
|
-
if (!finded) {
|
|
1156
|
-
this.breakPoints.push(bp);
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
async addBreakPoint(appId: string, offsetLine = 0) {
|
|
1161
|
-
let bp = this.breakPoints.find((bp) => bp.offset === offsetLine);
|
|
1162
|
-
if (bp) {
|
|
1163
|
-
return bp;
|
|
1164
|
-
}
|
|
1165
|
-
bp = new BreakPoint();
|
|
1166
|
-
await bp.create({
|
|
1167
|
-
appId,
|
|
1168
|
-
logicItem: this,
|
|
1169
|
-
offset: offsetLine,
|
|
1170
|
-
});
|
|
1171
|
-
this.breakPoints.push(bp);
|
|
1172
|
-
const app = config.defaultApp;
|
|
1173
|
-
app.debuggerClient.breakPoints.push(bp);
|
|
1174
|
-
return bp;
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
getBreakPointByLineNumber(lineNumber: number) {
|
|
1178
|
-
return this.breakPoints.find((bp) => bp.lineNumberStart === lineNumber);
|
|
1179
|
-
}
|
|
1180
|
-
|
|
1181
|
-
addTemperaryBreakPoint(offsetLine = 0) {
|
|
1182
|
-
const bp = new BreakPoint({
|
|
1183
|
-
target: this.logic && this.logic.view ? 'Frontend' : 'Backend',
|
|
1184
|
-
logicItem: this,
|
|
1185
|
-
logicItemId: this.id,
|
|
1186
|
-
componentId: this.logic && this.logic.view && this.logic.view.id,
|
|
1187
|
-
component: this.logic && this.logic.view,
|
|
1188
|
-
logic: this.logic,
|
|
1189
|
-
status: 'Enabled',
|
|
1190
|
-
offset: offsetLine,
|
|
1191
|
-
isTemporary: true,
|
|
1192
|
-
});
|
|
1193
|
-
bp.attachSourceMap();
|
|
1194
|
-
this.temporaryBreakPoint = bp;
|
|
1195
|
-
return bp;
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
get breakPoint(): BreakPoint {
|
|
1199
|
-
if (this.parent?.type === 'SwitchCase' && this.parentAttr === 'test')
|
|
1200
|
-
return this.parent.breakPoint;
|
|
1201
|
-
|
|
1202
|
-
return this.breakPoints?.find((bp) => bp.offset === 0);
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
get hasBreakPoint(): boolean {
|
|
1206
|
-
if (this.parent?.type === 'SwitchCase' && this.parentAttr === 'test')
|
|
1207
|
-
return this.parent.hasBreakPoint;
|
|
1208
|
-
|
|
1209
|
-
return !!(this.temporaryBreakPoint || this.breakPoint);
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
get isBreakPointEnabled(): boolean {
|
|
1213
|
-
if (this.parent?.type === 'SwitchCase' && this.parentAttr === 'test')
|
|
1214
|
-
return this.parent.isBreakPointEnabled;
|
|
1215
|
-
|
|
1216
|
-
return this.breakPoint?.status === 'Enabled';
|
|
1217
|
-
}
|
|
1218
|
-
|
|
1219
|
-
get isBreakPointDisabled(): boolean {
|
|
1220
|
-
if (this.parent?.type === 'SwitchCase' && this.parentAttr === 'test')
|
|
1221
|
-
return this.parent.isBreakPointDisabled;
|
|
1222
|
-
|
|
1223
|
-
return this.breakPoint?.status === 'Disabled';
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
get isBreakPointActive(): boolean {
|
|
1227
|
-
if (this.parent?.type === 'SwitchCase' && this.parentAttr === 'test')
|
|
1228
|
-
return this.parent.isBreakPointActive;
|
|
1229
|
-
if (config.defaultApp.debuggerClient?.currentThread) {
|
|
1230
|
-
const bp = this.temporaryBreakPoint || this.breakPoint;
|
|
1231
|
-
return bp === config.defaultApp.debuggerClient?.currentThread.breakPoint;
|
|
1232
|
-
}
|
|
1233
|
-
return false;
|
|
1234
|
-
// if (this.temporaryBreakPoint) {
|
|
1235
|
-
// return true;
|
|
1236
|
-
// }
|
|
1237
|
-
// return this.breakPoint === config.defaultApp.debuggerClient?.currentBreakPoint;
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
async setBreakPoint(offsetLine = 0) {
|
|
1241
|
-
const app = config.defaultApp;
|
|
1242
|
-
if (app.debuggerClient?.isConnected) {
|
|
1243
|
-
const breakPoint = new BreakPoint({
|
|
1244
|
-
target: this.logic && this.logic.view ? 'Frontend' : 'Backend',
|
|
1245
|
-
logicItem: this,
|
|
1246
|
-
logicItemId: this.id,
|
|
1247
|
-
componentId: this.logic && this.logic.view && this.logic.view.id,
|
|
1248
|
-
component: this.logic && this.logic.view,
|
|
1249
|
-
logic: this.logic,
|
|
1250
|
-
status: 'Enabled',
|
|
1251
|
-
offset: offsetLine,
|
|
1252
|
-
});
|
|
1253
|
-
const attachResult = breakPoint.attachSourceMap();
|
|
1254
|
-
if (attachResult) {
|
|
1255
|
-
await app.debuggerClient.setRemoteBreakPoint(breakPoint);
|
|
1256
|
-
await this.addBreakPoint(app.id, offsetLine);
|
|
1257
|
-
} else {
|
|
1258
|
-
this.emit('breakpointattacherror', {
|
|
1259
|
-
message: '未在sourceMap中找到'
|
|
1260
|
-
});
|
|
1261
|
-
}
|
|
1262
|
-
} else {
|
|
1263
|
-
await this.addBreakPoint(app.id, offsetLine);
|
|
1264
|
-
}
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
async removeBreakPoint(offsetLine = 0) {
|
|
1268
|
-
const app = config.defaultApp;
|
|
1269
|
-
const breakPoints = this.parent?.type === 'SwitchCase' && this.parentAttr === 'test' ? this.parent.breakPoints : this.breakPoints;
|
|
1270
|
-
const breakPoint = breakPoints.find((bp) => bp.offset === offsetLine);
|
|
1271
|
-
await app.debuggerClient?.removeRemoteBreakPoint(breakPoint);
|
|
1272
|
-
await breakPoint?.remove();
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
async removeAllBreakPointsOfDescendants() {
|
|
1276
|
-
const promises: Array<Promise<void>> = [];
|
|
1277
|
-
utils.traverse(({ node }) => {
|
|
1278
|
-
if (node.breakPoints?.length > 0) {
|
|
1279
|
-
node.breakPoints.forEach((bp) => {
|
|
1280
|
-
promises.push(node.removeBreakPoint(bp.offset));
|
|
1281
|
-
});
|
|
1282
|
-
}
|
|
1283
|
-
}, { node: this }, {
|
|
1284
|
-
mode: 'anyObject',
|
|
1285
|
-
excludedKeySet: this.JSON_EXCLUDED_KEYS,
|
|
1286
|
-
});
|
|
1287
|
-
await Promise.all(promises);
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
async disableAllBreakPointsOfDescendants() {
|
|
1291
|
-
const promises: Array<Promise<void>> = [];
|
|
1292
|
-
utils.traverse(({ node }) => {
|
|
1293
|
-
if (node.breakPoints?.length > 0) {
|
|
1294
|
-
node.breakPoints.forEach((bp) => {
|
|
1295
|
-
promises.push(bp.disable());
|
|
1296
|
-
});
|
|
1297
|
-
}
|
|
1298
|
-
}, { node: this }, {
|
|
1299
|
-
mode: 'anyObject',
|
|
1300
|
-
excludedKeySet: this.JSON_EXCLUDED_KEYS,
|
|
1301
|
-
});
|
|
1302
|
-
await Promise.all(promises);
|
|
1303
|
-
}
|
|
1304
1142
|
}
|
|
1305
1143
|
|
|
1306
1144
|
export class LogicNode extends LogicItem {
|
|
@@ -1436,44 +1274,4 @@ export class ExpressionNode extends LogicItem {
|
|
|
1436
1274
|
super();
|
|
1437
1275
|
source && this.assign(source);
|
|
1438
1276
|
}
|
|
1439
|
-
|
|
1440
|
-
addBreakPoint(appId: string, offsetLine = 0) {
|
|
1441
|
-
// let switchParent = this.parent;
|
|
1442
|
-
// let switchCase;
|
|
1443
|
-
// while (switchParent && switchParent.type !== 'SwitchStatement') {
|
|
1444
|
-
// if (switchParent.type === 'SwitchCase') {
|
|
1445
|
-
// switchCase = switchParent;
|
|
1446
|
-
// }
|
|
1447
|
-
// switchParent = switchParent.parent;
|
|
1448
|
-
// }
|
|
1449
|
-
|
|
1450
|
-
// switchCase 是个 logicNode,直接加好了
|
|
1451
|
-
if (this.parent?.type === 'SwitchCase' && this.parentAttr === 'test')
|
|
1452
|
-
return this.parent.addBreakPoint(appId, offsetLine);
|
|
1453
|
-
// const index = switchParent.cases.findIndex((c) => c === switchCase);
|
|
1454
|
-
// const id = switchCase.id;
|
|
1455
|
-
|
|
1456
|
-
// const view = this.logic.view;
|
|
1457
|
-
// const sourceMap = view.sourceMap;
|
|
1458
|
-
// const componentId = view.id;
|
|
1459
|
-
// // const id = `${switchParent.id}-case${index}`;
|
|
1460
|
-
// const map = sourceMap[id];
|
|
1461
|
-
// if (map) {
|
|
1462
|
-
// const lineNumberStart = map.from + offsetLine;
|
|
1463
|
-
// let bp = this.breakPoints.find((bp) => bp.lineNumberStart === lineNumberStart);
|
|
1464
|
-
// if (bp) {
|
|
1465
|
-
// return bp;
|
|
1466
|
-
// }
|
|
1467
|
-
// bp = new BreakPoint({
|
|
1468
|
-
// lineNumberStart,
|
|
1469
|
-
// logicItem: switchCase,
|
|
1470
|
-
// logicItemId: switchCase.id,
|
|
1471
|
-
// componentId,
|
|
1472
|
-
// });
|
|
1473
|
-
// switchCase.breakPoints.push(bp);
|
|
1474
|
-
// return bp;
|
|
1475
|
-
// }
|
|
1476
|
-
// return null;
|
|
1477
|
-
return super.addBreakPoint(appId, offsetLine);
|
|
1478
|
-
}
|
|
1479
1277
|
}
|