mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Merge pull request #10184 from erik-krogh/ts48
JavaScript: Update to TypeScript 4.8
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"name": "typescript-parser-wrapper",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"typescript": "4.7.2"
|
||||
"typescript": "4.8.2"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc --project tsconfig.json",
|
||||
|
||||
@@ -241,7 +241,7 @@ const astProperties: string[] = [
|
||||
"constructor",
|
||||
"declarationList",
|
||||
"declarations",
|
||||
"decorators",
|
||||
"illegalDecorators",
|
||||
"default",
|
||||
"delete",
|
||||
"dotDotDotToken",
|
||||
|
||||
@@ -947,7 +947,7 @@ export class TypeTable {
|
||||
* Returns a unique string for the given call/constructor signature.
|
||||
*/
|
||||
private getSignatureString(kind: ts.SignatureKind, signature: AugmentedSignature): string {
|
||||
let modifiers : ts.ModifiersArray = signature.getDeclaration()?.modifiers;
|
||||
let modifiers = signature.getDeclaration()?.modifiers;
|
||||
let isAbstract = modifiers && modifiers.filter(modifier => modifier.kind == ts.SyntaxKind.AbstractKeyword).length > 0
|
||||
|
||||
let parameters = signature.getParameters();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
version "12.7.11"
|
||||
resolved node-12.7.11.tgz#be879b52031cfb5d295b047f5462d8ef1a716446
|
||||
|
||||
typescript@4.7.2:
|
||||
version "4.7.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.2.tgz#1f9aa2ceb9af87cca227813b4310fff0b51593c4"
|
||||
integrity sha512-Mamb1iX2FDUpcTRzltPxgWMKy3fhg0TN378ylbktPGPK/99KbDtMQ4W1hwgsbPAsG3a0xKa1vmw4VKZQbkvz5A==
|
||||
typescript@4.8.2:
|
||||
version "4.8.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.2.tgz#e3b33d5ccfb5914e4eeab6699cf208adee3fd790"
|
||||
integrity sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==
|
||||
|
||||
@@ -41,7 +41,7 @@ public class Main {
|
||||
* A version identifier that should be updated every time the extractor changes in such a way that
|
||||
* it may produce different tuples for the same file under the same {@link ExtractorConfig}.
|
||||
*/
|
||||
public static final String EXTRACTOR_VERSION = "2022-07-11";
|
||||
public static final String EXTRACTOR_VERSION = "2022-08-25";
|
||||
|
||||
public static final Pattern NEWLINE = Pattern.compile("\n");
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1139,7 +1151,7 @@ public class TypeScriptASTConverter {
|
||||
loc,
|
||||
hasModifier(node, "ConstKeyword"),
|
||||
hasModifier(node, "DeclareKeyword"),
|
||||
convertChildrenNotNull(node, "decorators"),
|
||||
convertChildrenNotNull(node, "illegalDecorators"), // as of https://github.com/microsoft/TypeScript/pull/50343/ the property is called `illegalDecorators` instead of `decorators`
|
||||
convertChild(node, "name"),
|
||||
convertChildren(node, "members"));
|
||||
attachSymbolInformation(enumDeclaration, node);
|
||||
@@ -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