From 29e5bdb4d70ef26772d9c97d593f2fdc2dbc0422 Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Fri, 4 Sep 2020 11:51:56 +0200 Subject: [PATCH] renamed "isAbstractClass" to "is_abstract_class" --- .../extractor/src/com/semmle/js/extractor/ASTExtractor.java | 2 +- javascript/extractor/tests/ts/output/trap/classes.ts.trap | 2 +- javascript/extractor/tests/ts/output/trap/nobody.ts.trap | 4 ++-- .../extractor/tests/ts/output/trap/typeannotations.ts.trap | 2 +- javascript/ql/src/semmle/javascript/Aliases.qll | 5 +++++ javascript/ql/src/semmle/javascript/Classes.qll | 2 +- javascript/ql/src/semmlecode.javascript.dbscheme | 2 +- javascript/ql/src/semmlecode.javascript.dbscheme.stats | 2 +- .../upgrade.properties | 2 ++ 9 files changed, 15 insertions(+), 8 deletions(-) diff --git a/javascript/extractor/src/com/semmle/js/extractor/ASTExtractor.java b/javascript/extractor/src/com/semmle/js/extractor/ASTExtractor.java index 6470ae04459..87e2caf25f6 100644 --- a/javascript/extractor/src/com/semmle/js/extractor/ASTExtractor.java +++ b/javascript/extractor/src/com/semmle/js/extractor/ASTExtractor.java @@ -1287,7 +1287,7 @@ public class ASTExtractor { trapwriter.addTuple("has_declare_keyword", lbl); } if (nd.hasAbstractKeyword()) { - trapwriter.addTuple("isAbstractClass", lbl); + trapwriter.addTuple("is_abstract_class", lbl); } return visit(nd.getClassDef(), lbl, nd, false); } diff --git a/javascript/extractor/tests/ts/output/trap/classes.ts.trap b/javascript/extractor/tests/ts/output/trap/classes.ts.trap index 3131f22709c..41f68fac3cb 100644 --- a/javascript/extractor/tests/ts/output/trap/classes.ts.trap +++ b/javascript/extractor/tests/ts/output/trap/classes.ts.trap @@ -107,7 +107,7 @@ stmts(#20037,26,#20001,0,"abstrac ... F>\n {}") locations_default(#20038,#10000,1,1,2,4) hasLocation(#20037,#20038) stmt_containers(#20037,#20001) -isAbstractClass(#20037) +is_abstract_class(#20037) #20039=* exprs(#20039,78,#20037,0,"C") hasLocation(#20039,#20011) diff --git a/javascript/extractor/tests/ts/output/trap/nobody.ts.trap b/javascript/extractor/tests/ts/output/trap/nobody.ts.trap index 5116196ad1c..1aa25844b45 100644 --- a/javascript/extractor/tests/ts/output/trap/nobody.ts.trap +++ b/javascript/extractor/tests/ts/output/trap/nobody.ts.trap @@ -724,7 +724,7 @@ stmts(#20260,26,#20001,1,"abstrac ... mber;\n}") locations_default(#20261,#10000,4,1,15,1) hasLocation(#20260,#20261) stmt_containers(#20260,#20001) -isAbstractClass(#20260) +is_abstract_class(#20260) #20262=* exprs(#20262,78,#20260,0,"C") hasLocation(#20262,#20091) @@ -941,7 +941,7 @@ locations_default(#20313,#10000,18,1,29,1) hasLocation(#20312,#20313) stmt_containers(#20312,#20001) has_declare_keyword(#20312) -isAbstractClass(#20312) +is_abstract_class(#20312) #20314=* exprs(#20314,78,#20312,0,"D") hasLocation(#20314,#20174) diff --git a/javascript/extractor/tests/ts/output/trap/typeannotations.ts.trap b/javascript/extractor/tests/ts/output/trap/typeannotations.ts.trap index c852a24bc7e..d1186ba2a40 100644 --- a/javascript/extractor/tests/ts/output/trap/typeannotations.ts.trap +++ b/javascript/extractor/tests/ts/output/trap/typeannotations.ts.trap @@ -4175,7 +4175,7 @@ stmts(#21350,26,#20001,44,"abstrac ... ): T;\n}") locations_default(#21351,#10000,54,1,57,1) hasLocation(#21350,#21351) stmt_containers(#21350,#20001) -isAbstractClass(#21350) +is_abstract_class(#21350) #21352=* exprs(#21352,78,#21350,0,"GenericClass") hasLocation(#21352,#20801) diff --git a/javascript/ql/src/semmle/javascript/Aliases.qll b/javascript/ql/src/semmle/javascript/Aliases.qll index 8a7ebd450da..20e7892d140 100644 --- a/javascript/ql/src/semmle/javascript/Aliases.qll +++ b/javascript/ql/src/semmle/javascript/Aliases.qll @@ -165,3 +165,8 @@ deprecated predicate isAbstractMember(Property prop) { is_abstract_member(prop) * Use `EnumDeclaration#isConst()` instead. */ deprecated predicate isConstEnum(EnumDeclaration id) { is_const_enum(id) } +/** + * Alias for the predicate `is_abstract_class` defined in the .dbscheme. + * Use `ClassDefinition#isAbstract()` instead. + */ +deprecated predicate isAbstractClass(ClassDeclStmt id) { is_abstract_class(id) } diff --git a/javascript/ql/src/semmle/javascript/Classes.qll b/javascript/ql/src/semmle/javascript/Classes.qll index 9a2734f15b2..a391027c762 100644 --- a/javascript/ql/src/semmle/javascript/Classes.qll +++ b/javascript/ql/src/semmle/javascript/Classes.qll @@ -215,7 +215,7 @@ class ClassDefinition extends @classdefinition, ClassOrInterface, AST::ValueNode /** * Holds if this class has the `abstract` modifier. */ - override predicate isAbstract() { isAbstractClass(this) } + override predicate isAbstract() { is_abstract_class(this) } override string describe() { if exists(inferNameFromVarDef()) diff --git a/javascript/ql/src/semmlecode.javascript.dbscheme b/javascript/ql/src/semmlecode.javascript.dbscheme index 82a4e785ae1..814b2dd8c2e 100644 --- a/javascript/ql/src/semmlecode.javascript.dbscheme +++ b/javascript/ql/src/semmlecode.javascript.dbscheme @@ -518,7 +518,7 @@ is_method (int id: @property ref); is_static (int id: @property ref); is_abstract_member (int id: @property ref); is_const_enum (int id: @enumdeclaration ref); -isAbstractClass (int id: @classdeclstmt ref); +is_abstract_class (int id: @classdeclstmt ref); hasPublicKeyword (int id: @property ref); hasPrivateKeyword (int id: @property ref); diff --git a/javascript/ql/src/semmlecode.javascript.dbscheme.stats b/javascript/ql/src/semmlecode.javascript.dbscheme.stats index 4c9ef4108c0..bf22097fd75 100644 --- a/javascript/ql/src/semmlecode.javascript.dbscheme.stats +++ b/javascript/ql/src/semmlecode.javascript.dbscheme.stats @@ -8407,7 +8407,7 @@ -isAbstractClass +is_abstract_class 116 diff --git a/javascript/upgrades/c73fbfca57f3d593b9ff50c6aa3a886d6888efec/upgrade.properties b/javascript/upgrades/c73fbfca57f3d593b9ff50c6aa3a886d6888efec/upgrade.properties index 6269625d9a9..52df860c1f3 100644 --- a/javascript/upgrades/c73fbfca57f3d593b9ff50c6aa3a886d6888efec/upgrade.properties +++ b/javascript/upgrades/c73fbfca57f3d593b9ff50c6aa3a886d6888efec/upgrade.properties @@ -40,3 +40,5 @@ is_abstract_member.rel: reorder isAbstractMember.rel(int prop) prop isAbstractMember.rel: delete is_const_enum.rel: reorder isConstEnum.rel(int id) id isConstEnum.rel: delete +is_abstract_class.rel: reorder isAbstractClass.rel(int id) id +isAbstractClass.rel: delete