-
Notifications
You must be signed in to change notification settings - Fork 1.8k
JS: Extractor handle error instead of exiting. #18984
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
Conversation
5c50f61
to
3cdd34d
Compare
3cdd34d
to
c3ecf70
Compare
In @Override
public Integer visit(ParenthesizedExpression nd, Void c) {
return parenthesizedTypeExpr;
} |
09f41bc
to
6d3761f
Compare
6d3761f
to
1468e81
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the extractor to handle errors gracefully by introducing validity checks in type expression conversions. Key changes include:
- Adding test files with invalid extends to trigger extractor error handling.
- Introducing a default method isValidExpression in ITypeExpression.
- Implementing an override of isValidExpression in MemberExpression.
- Modifying TypeScriptASTConverter to use isValidExpression in type conversion.
Reviewed Changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated no comments.
File | Description |
---|---|
javascript/extractor/tests/ts/input/invalidExtends.ts | Adds test cases with invalid "extends" constructs for extractor error handling |
javascript/extractor/src/com/semmle/ts/ast/ITypeExpression.java | Adds default validity check method in the ITypeExpression interface |
javascript/extractor/src/com/semmle/js/ast/MemberExpression.java | Adds an override for isValidExpression to check allowed object types |
javascript/extractor/src/com/semmle/ts/extractor/TypeScriptASTConverter.java | Updates the asType method to apply the validity check from ITypeExpression |
Files not reviewed (2)
- javascript/ql/test/library-tests/TypeScript/Types/printAst.expected: Language not supported
- javascript/ql/test/library-tests/TypeScript/Types/tests.expected: Language not supported
Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more
javascript/extractor/src/com/semmle/js/ast/MemberExpression.java
Outdated
Show resolved
Hide resolved
javascript/extractor/src/com/semmle/js/ast/MemberExpression.java
Outdated
Show resolved
Hide resolved
…ll for type validation. Co-authored-by: Asgerf <asgerf@github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Fixes extractor error discovered in #18899 (comment)