Skip to content

Commit c93be70

Browse files
Napalysasgerf
andcommitted
Rename validation methods for type expressions and added recursive call for type validation.
Co-authored-by: Asgerf <[email protected]>
1 parent 1468e81 commit c93be70

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

javascript/extractor/src/com/semmle/js/ast/MemberExpression.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void setSymbol(int symbol) {
7171
}
7272

7373
@Override
74-
public boolean isValidExpression() {
75-
return object instanceof ITypeExpression || object instanceof DynamicImport;
74+
public boolean isValidTypeExpression() {
75+
return object instanceof ITypeExpression && ((ITypeExpression)object).isValidTypeExpression() || object instanceof DynamicImport;
7676
}
7777
}

javascript/extractor/src/com/semmle/ts/ast/ITypeExpression.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
* TypeScript AST does not distinguish <code>null</code> literals from the <code>null</code> type.
1212
*/
1313
public interface ITypeExpression extends INode, ITypedAstNode {
14-
public default boolean isValidExpression() { return true; }
14+
public default boolean isValidTypeExpression() { return true; }
1515
}

javascript/extractor/src/com/semmle/ts/extractor/TypeScriptASTConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1907,7 +1907,7 @@ private Node convertOptionalType(JsonObject node, SourceLocation loc) throws Par
19071907
}
19081908

19091909
private ITypeExpression asType(Node node) {
1910-
return node instanceof ITypeExpression && ((ITypeExpression)node).isValidExpression() ? (ITypeExpression) node : null;
1910+
return node instanceof ITypeExpression && ((ITypeExpression)node).isValidTypeExpression() ? (ITypeExpression) node : null;
19111911
}
19121912

19131913
private List<ITypeExpression> convertChildrenAsTypes(JsonObject node, String child)

0 commit comments

Comments
 (0)