mirror of
https://github.com/github/codeql.git
synced 2025-12-27 22:26:31 +01:00
update to TypeScript 4.8RC
This commit is contained in:
@@ -976,8 +976,9 @@ public class TypeScriptASTConverter {
|
||||
hasDeclareKeyword,
|
||||
hasAbstractKeyword);
|
||||
attachSymbolInformation(classDecl.getClassDef(), node);
|
||||
if (node.has("decorators")) {
|
||||
classDecl.addDecorators(convertChildren(node, "decorators"));
|
||||
List<Decorator> decorators = getDecorators(node);
|
||||
if (!decorators.isEmpty()) {
|
||||
classDecl.addDecorators(decorators);
|
||||
advanceUntilAfter(loc, classDecl.getDecorators());
|
||||
}
|
||||
Node exportedDecl = fixExports(loc, classDecl);
|
||||
@@ -989,6 +990,17 @@ public class TypeScriptASTConverter {
|
||||
return exportedDecl;
|
||||
}
|
||||
|
||||
List<Decorator> getDecorators(JsonObject node) throws ParseError {
|
||||
List<Decorator> result = new ArrayList<>();
|
||||
for (JsonElement elt : getChildIterable(node, "modifiers")) {
|
||||
JsonObject modifier = elt.getAsJsonObject();
|
||||
if (hasKind(modifier, "Decorator")) {
|
||||
result.add((Decorator) convertNode(modifier));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Node convertCommaListExpression(JsonObject node, SourceLocation loc) throws ParseError {
|
||||
return new SequenceExpression(loc, convertChildren(node, "elements"));
|
||||
}
|
||||
@@ -1041,7 +1053,7 @@ public class TypeScriptASTConverter {
|
||||
private List<DecoratorList> convertParameterDecorators(JsonObject function) throws ParseError {
|
||||
List<DecoratorList> decoratorLists = new ArrayList<>();
|
||||
for (JsonElement parameter : getProperParameters(function)) {
|
||||
decoratorLists.add(makeDecoratorList(parameter.getAsJsonObject().get("decorators")));
|
||||
decoratorLists.add(makeDecoratorList(parameter.getAsJsonObject().get("modifiers")));
|
||||
}
|
||||
return decoratorLists;
|
||||
}
|
||||
@@ -1664,8 +1676,9 @@ public class TypeScriptASTConverter {
|
||||
FunctionExpression method = convertImplicitFunction(node, loc);
|
||||
MethodDefinition methodDefinition =
|
||||
new MethodDefinition(loc, flags, methodKind, convertChild(node, "name"), method);
|
||||
if (node.has("decorators")) {
|
||||
methodDefinition.addDecorators(convertChildren(node, "decorators"));
|
||||
List<Decorator> decorators = getDecorators(node);
|
||||
if (!decorators.isEmpty()) {
|
||||
methodDefinition.addDecorators(decorators);
|
||||
advanceUntilAfter(loc, methodDefinition.getDecorators());
|
||||
}
|
||||
return methodDefinition;
|
||||
@@ -2079,8 +2092,9 @@ public class TypeScriptASTConverter {
|
||||
convertChild(node, "name"),
|
||||
convertChild(node, "initializer"),
|
||||
convertChildAsType(node, "type"));
|
||||
if (node.has("decorators")) {
|
||||
fieldDefinition.addDecorators(convertChildren(node, "decorators"));
|
||||
List<Decorator> decorators = getDecorators(node);
|
||||
if (!decorators.isEmpty()) {
|
||||
fieldDefinition.addDecorators(decorators);
|
||||
advanceUntilAfter(loc, fieldDefinition.getDecorators());
|
||||
}
|
||||
return fieldDefinition;
|
||||
|
||||
Reference in New Issue
Block a user