Skip to content

Commit 50ba633

Browse files
committed
fault injection
1 parent 6668b23 commit 50ba633

2 files changed

Lines changed: 1 addition & 111 deletions

File tree

.github/workflows/regression.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
#if: "!contains(github.event.pull_request.title, '[NO-REGRESSION-TEST]')"
1515
env:
16-
LANGS: "go rust python java typescript"
16+
LANGS: "typescript"
1717
DIFFJSON_IGNORE: " ['id'] ['Path'] "
1818
steps:
1919
- name: Checkout pull request code

ts-parser/src/parser/FunctionParser.ts

Lines changed: 0 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -41,116 +41,6 @@ export class FunctionParser {
4141

4242
parseFunctions(sourceFile: SourceFile, moduleName: string, packagePath: string): Record<string, UniFunction> {
4343
const functions: Record<string, UniFunction> = {};
44-
45-
this.defaultExportSymbol = sourceFile.getDefaultExportSymbol()?.getAliasedSymbol()
46-
47-
// Parse function declarations
48-
const functionDeclarations = sourceFile.getFunctions();
49-
for (const func of functionDeclarations) {
50-
try {
51-
const funcObj = this.parseFunction(func, moduleName, packagePath, sourceFile);
52-
functions[funcObj.Name] = funcObj;
53-
} catch (error) {
54-
console.error('Error processing function:', func, error);
55-
}
56-
57-
}
58-
59-
// Parse method declarations in classes
60-
const classes = sourceFile.getClasses();
61-
for (const cls of classes) {
62-
const sym = cls.getSymbol();
63-
let className = ""
64-
if (sym) {
65-
className = assignSymbolName(sym)
66-
} else {
67-
className = "anonymous_" + cls.getStart()
68-
}
69-
const methods = cls.getMethods();
70-
71-
for (const method of methods) {
72-
try {
73-
const methodObj = this.parseMethod(method, moduleName, packagePath, sourceFile, className);
74-
functions[methodObj.Name] = methodObj;
75-
} catch (error) {
76-
console.error('Error processing method:', method, error);
77-
}
78-
}
79-
80-
// Parse constructors
81-
const constructors = cls.getConstructors();
82-
for (const ctor of constructors) {
83-
try {
84-
const ctorObj = this.parseConstructor(ctor, moduleName, packagePath, sourceFile, className);
85-
functions[ctorObj.Name] = ctorObj;
86-
} catch (error) {
87-
console.error('Error processing constructor:', ctor, error);
88-
}
89-
}
90-
91-
// Parse static methods
92-
const staticMethods = cls.getStaticMethods();
93-
for (const staticMethod of staticMethods) {
94-
try {
95-
const methodObj = this.parseMethod(staticMethod, moduleName, packagePath, sourceFile, className);
96-
functions[methodObj.Name] = methodObj;
97-
} catch (error) {
98-
console.error('Error processing static method:', staticMethod, error);
99-
}
100-
}
101-
}
102-
103-
// Parse arrow functions assigned to variables
104-
const variableDeclarations = sourceFile.getVariableDeclarations();
105-
for (const varDecl of variableDeclarations) {
106-
const initializer = varDecl.getInitializer();
107-
if (initializer && (Node.isArrowFunction(initializer) || Node.isFunctionExpression(initializer))) {
108-
const sym = varDecl.getSymbol()
109-
let funcName = ""
110-
if (sym) {
111-
funcName = assignSymbolName(sym)
112-
} else {
113-
funcName = "anonymous_" + varDecl.getStart()
114-
}
115-
try {
116-
const funcObj = this.parseArrowFunction(initializer, funcName, moduleName, packagePath, sourceFile, varDecl);
117-
functions[funcObj.Name] = funcObj;
118-
} catch (error) {
119-
console.error('Error processing arrow function:', initializer, error);
120-
}
121-
122-
}
123-
}
124-
125-
// CORNER CASE: Parse arrow function declared as a default export
126-
const defaultExport = sourceFile.getDefaultExportSymbol()
127-
if (defaultExport !== undefined) {
128-
const decl = defaultExport.getDeclarations()[0]
129-
if(Node.isExportAssignment(decl)) {
130-
const expr = decl.getExpression()
131-
const funcName = assignSymbolName(defaultExport)
132-
if(Node.isArrowFunction(expr)) {
133-
const funcObj = this.parseArrowFunction(expr, funcName, moduleName, packagePath, sourceFile, decl);
134-
functions[funcObj.Name] = funcObj;
135-
}
136-
}
137-
}
138-
139-
// Parse interface methods
140-
const interfaces = sourceFile.getInterfaces();
141-
for (const iface of interfaces) {
142-
const methods = iface.getMethods();
143-
144-
for (const method of methods) {
145-
try {
146-
const methodObj = this.parseInterfaceMethod(method, moduleName, packagePath, sourceFile);
147-
functions[methodObj.Name] = methodObj;
148-
} catch (error) {
149-
console.error('Error processing interface method:', method, error);
150-
}
151-
}
152-
}
153-
15444
return functions;
15545
}
15646

0 commit comments

Comments
 (0)