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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
code-sunbo opened this issue Feb 5, 2024 · 0 comments
Open

cfg 解析给class新增函数报错 #4

code-sunbo opened this issue Feb 5, 2024 · 0 comments

Comments

@code-sunbo
Copy link
Collaborator

测试代码:

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0