mirror of
https://github.com/github/codeql.git
synced 2025-12-31 16:16:34 +01:00
TS: Support readonly type expressions
This commit is contained in:
@@ -66,6 +66,7 @@ public class TypeExprKinds {
|
||||
private static final int optionalTypeExpr = 33;
|
||||
private static final int restTypeExpr = 34;
|
||||
private static final int bigintLiteralTypeExpr = 35;
|
||||
private static final int readonlyTypeExpr = 36;
|
||||
|
||||
public static int getTypeExprKind(final INode type, final IdContext idcontext) {
|
||||
Integer kind =
|
||||
@@ -127,7 +128,11 @@ public class TypeExprKinds {
|
||||
|
||||
@Override
|
||||
public Integer visit(UnaryTypeExpr nd, Void c) {
|
||||
return keyofTypeExpr;
|
||||
switch (nd.getKind()) {
|
||||
case Keyof: return keyofTypeExpr;
|
||||
case Readonly: return readonlyTypeExpr;
|
||||
}
|
||||
throw new CatastrophicError("Unhandled UnaryTypeExpr kind: " + nd.getKind());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2132,6 +2132,9 @@ public class TypeScriptASTConverter {
|
||||
if (operator.equals("KeyOfKeyword")) {
|
||||
return new UnaryTypeExpr(loc, UnaryTypeExpr.Kind.Keyof, convertChildAsType(node, "type"));
|
||||
}
|
||||
if (operator.equals("ReadonlyKeyword")) {
|
||||
return new UnaryTypeExpr(loc, UnaryTypeExpr.Kind.Readonly, convertChildAsType(node, "type"));
|
||||
}
|
||||
if (operator.equals("UniqueKeyword")) {
|
||||
return new KeywordTypeExpr(loc, "unique symbol");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user