8000 cfg 解析给class新增函数报错 · Issue #4 · SMAT-Lab/ArkAnalyzer · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
cfg 解析给class新增函数报错 #4
Open
@code-sunbo

Description

@code-sunbo

测试代码:

class GenericNumber<T> {
    zeroValue: T;
    add: (x: T, y: T) => T;
}
let myGenericNumber = new GenericNumber<number>();
myGenericNumber.zeroValue = 0;
myGenericNumber.add = function(x, y) { return x + y; };

let stringNumeric = new GenericNumber<string>();
stringNumeric.zeroValue = "";
stringNumeric.add = function(x, y) { return x + y; };

console.log(stringNumeric.add(stringNumeric.zeroValue, "test"));

log如下:

D:\code\ArkAnalyzer\src\core\graph\Cfg.ts:341                                 
             leftOp.setType(method.getReturnType().join('|'));                                                       
                                                          ^ 
TypeError: method.getReturnType is not a function     
    at Cfg.typeReference (D:\code\ArkAnalyzer\src\core\graph\Cfg.ts:341:55)     
    at Scene.typeReference (D:\code\ArkAnalyzer\src\Scene.ts:263:50)     
    at new Scene (D:\code\ArkAnalyzer\src\Scene.ts:65:14)     
    at run (D:\code\ArkAnalyzer\tests\SaveTest.ts:11:24)     
    at Object.<anonymous> (D:\code\ArkAnalyzer\tests\SaveTest.ts:17:1)     
    at Module._compile (node:internal/modules/cjs/loader:1376:14)     
    at Module.m._compile (D:\code\ArkAnalyzer\node_modules\ts-node\src\index.ts:1618:23)     
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)     
    at Object.require.extensions.<computed> [as .ts] (D:\code\ArkAnalyzer\node_modules\ts-node\src\index.ts:1621:12)     
    at Module.load (node:internal/modules/cjs/loader:1207:32) 
Process exited with code 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0