Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 14 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@
"dependencies": {
"@babel/parser": "^7.25.6",
"@babel/types": "^7.25.6",
"tree-sitter": "^0.21.0",
"tree-sitter-python": "^0.21.0",
"tree-sitter": "^0.25.0",
"tree-sitter-python": "^0.25.0",
"typescript": "^5.6.2",
"web-tree-sitter": "^0.21.0",
"yargs": "^18.0.0"
Expand Down
4 changes: 3 additions & 1 deletion src/core/analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
const log = getComponentLogger('Analyzer');

const UNKNOWN_TYPE: PythonType = { kind: 'custom', name: 'Any', module: 'typing' };
// tree-sitter-python >=0.25 updates its typings, but Parser#setLanguage still expects the package export at runtime.
const PYTHON_LANGUAGE = Python as unknown as Parser.Language;

export class PyAnalyzer {
private parser: Parser;
Expand All @@ -44,7 +46,7 @@
}

try {
await this.parser.setLanguage(Python);
await this.parser.setLanguage(PYTHON_LANGUAGE);
this.initialized = true;
} catch (error) {
throw new Error(`Failed to initialize Python parser: ${error}`);
Expand Down Expand Up @@ -660,7 +662,7 @@
results.push(n);
}
for (let i = n.children.length - 1; i >= 0; i--) {
const child = n.children[i];

Check warning on line 665 in src/core/analyzer.ts

View workflow job for this annotation

GitHub Actions / lint

Variable Assigned to Object Injection Sink
if (child) {
stack.push(child);
}
Expand Down
Loading