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.
@@ -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;AAErE,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;IA2DtE,SAAS,CAAC,gBAAgB,IAAI,QAAQ,EAAE;CAI3C"}
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
- // TODO: super class method should be placed at the end
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,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD,qBAAa,iBAAkB,SAAQ,gBAAgB;IAEnD,OAAO,CAAC,gBAAgB,CAAkC;IAE1D,OAAO,CAAC,YAAY,CAA2F;gBAEnG,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS;IAIhC,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,GAAG,QAAQ,EAAE;IAgEtE,SAAS,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAE;IAqBtD,OAAO,CAAC,+BAA+B;IA4BhC,eAAe,CAAC,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,GAAG,IAAI;CAK/G"}
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,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD,qBAAa,iBAAkB,SAAQ,gBAAgB;IAEnD,OAAO,CAAC,gBAAgB,CAAkC;IAE1D,OAAO,CAAC,YAAY,CAA2F;gBAEnG,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS;IAIhC,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,GAAG,QAAQ,EAAE;IA4DtE,SAAS,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAE;IAqBtD,OAAO,CAAC,+BAA+B;IA4BhC,eAAe,CAAC,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,GAAG,IAAI;CAK/G"}
@@ -72,9 +72,6 @@ class RapidTypeAnalysis extends 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()) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "arkanalyzer",
3
- "version": "1.0.49",
4
- "commit_id": "4ee0dc84",
3
+ "version": "1.0.50",
4
+ "commit_id": "21055a22",
5
5
  "files": [
6
6
  "docs",
7
7
  "lib",