arkanalyzer 1.0.49 → 1.0.50
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/lib/callgraph/algorithm/ClassHierarchyAnalysis.d.ts +1 -0
- package/lib/callgraph/algorithm/ClassHierarchyAnalysis.d.ts.map +1 -1
- package/lib/callgraph/algorithm/ClassHierarchyAnalysis.js +16 -4
- package/lib/callgraph/algorithm/RapidTypeAnalysis.d.ts.map +1 -1
- package/lib/callgraph/algorithm/RapidTypeAnalysis.js +0 -3
- package/package.json +2 -2
|
@@ -8,5 +8,6 @@ export declare class ClassHierarchyAnalysis extends AbstractAnalysis {
|
|
|
8
8
|
constructor(scene: Scene, cg: CallGraph, cb: CallGraphBuilder);
|
|
9
9
|
resolveCall(callerMethod: NodeID, invokeStmt: Stmt): CallSite[];
|
|
10
10
|
protected preProcessMethod(): CallSite[];
|
|
11
|
+
private checkSuperInvoke;
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=ClassHierarchyAnalysis.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClassHierarchyAnalysis.d.ts","sourceRoot":"","sources":["../../../src/callgraph/algorithm/ClassHierarchyAnalysis.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"ClassHierarchyAnalysis.d.ts","sourceRoot":"","sources":["../../../src/callgraph/algorithm/ClassHierarchyAnalysis.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGrE,qBAAa,sBAAuB,SAAQ,gBAAgB;gBAC5C,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,gBAAgB;IAKtD,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,GAAG,QAAQ,EAAE;IA+DtE,SAAS,CAAC,gBAAgB,IAAI,QAAQ,EAAE;IAKxC,OAAO,CAAC,gBAAgB;CAU3B"}
|
|
@@ -24,6 +24,7 @@ class ClassHierarchyAnalysis extends AbstractAnalysis_1.AbstractAnalysis {
|
|
|
24
24
|
}
|
|
25
25
|
resolveCall(callerMethod, invokeStmt) {
|
|
26
26
|
let invokeExpr = invokeStmt.getInvokeExpr();
|
|
27
|
+
const stmtDeclareClass = invokeStmt.getCfg().getDeclaringMethod().getDeclaringArkClass().getSignature();
|
|
27
28
|
let resolveResult = [];
|
|
28
29
|
if (!invokeExpr) {
|
|
29
30
|
return [];
|
|
@@ -42,11 +43,12 @@ class ClassHierarchyAnalysis extends AbstractAnalysis_1.AbstractAnalysis {
|
|
|
42
43
|
}
|
|
43
44
|
else {
|
|
44
45
|
let declareClass = calleeMethod.getDeclaringArkClass();
|
|
45
|
-
//
|
|
46
|
+
// block super invoke
|
|
47
|
+
if (this.checkSuperInvoke(invokeStmt, declareClass, stmtDeclareClass)) {
|
|
48
|
+
resolveResult.push(this.cg.getCallSiteManager().newCallSite(invokeStmt, undefined, this.cg.getCallGraphNodeByMethod(calleeMethod.getSignature()).getID(), callerMethod));
|
|
49
|
+
return resolveResult;
|
|
50
|
+
}
|
|
46
51
|
this.getClassHierarchy(declareClass).forEach((arkClass) => {
|
|
47
|
-
if (arkClass.isAbstract()) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
52
|
let possibleCalleeMethod = arkClass.getMethodWithName(calleeMethod.getName());
|
|
51
53
|
if (possibleCalleeMethod &&
|
|
52
54
|
possibleCalleeMethod.isGenerated() &&
|
|
@@ -65,5 +67,15 @@ class ClassHierarchyAnalysis extends AbstractAnalysis_1.AbstractAnalysis {
|
|
|
65
67
|
// do nothing
|
|
66
68
|
return [];
|
|
67
69
|
}
|
|
70
|
+
checkSuperInvoke(invokeStmt, declareClass, stmtDeclareClass) {
|
|
71
|
+
const invokeExpr = invokeStmt.getInvokeExpr();
|
|
72
|
+
if (invokeExpr instanceof Expr_1.ArkInstanceInvokeExpr) {
|
|
73
|
+
const baseLocalName = invokeExpr.getBase().getName();
|
|
74
|
+
if (baseLocalName === 'this' && declareClass.getSignature() !== stmtDeclareClass) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
68
80
|
}
|
|
69
81
|
exports.ClassHierarchyAnalysis = ClassHierarchyAnalysis;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RapidTypeAnalysis.d.ts","sourceRoot":"","sources":["../../../src/callgraph/algorithm/RapidTypeAnalysis.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,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AbstractAnalysis_1.AbstractAnalysis {
|
|
|
72
72
|
let declareClass = calleeMethod.getDeclaringArkClass();
|
|
73
73
|
// TODO: super class method should be placed at the end
|
|
74
74
|
this.getClassHierarchy(declareClass).forEach((arkClass) => {
|
|
75
|
-
if (arkClass.isAbstract()) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
75
|
let possibleCalleeMethod = arkClass.getMethodWithName(calleeMethod.getName());
|
|
79
76
|
if (possibleCalleeMethod && possibleCalleeMethod.isGenerated() &&
|
|
80
77
|
arkClass.getSignature().toString() !== declareClass.getSignature().toString()) {
|