renamed "hasDeclareKeyword" to "has_declare_keyword"

This commit is contained in:
Erik Krogh Kristensen
2020-09-04 11:51:46 +02:00
parent 49b71d515c
commit 621e702e99
17 changed files with 35 additions and 29 deletions

View File

@@ -46,7 +46,7 @@ public class DeclarationFlags {
"hasProtectedKeyword", "hasProtectedKeyword",
"isOptionalMember", "isOptionalMember",
"hasDefiniteAssignmentAssertion", "hasDefiniteAssignmentAssertion",
"hasDeclareKeyword"); "has_declare_keyword");
public static boolean isComputed(int flags) { public static boolean isComputed(int flags) {
return (flags & computed) != 0; return (flags & computed) != 0;

View File

@@ -822,7 +822,7 @@ public class ASTExtractor {
public Label visit(VariableDeclaration nd, Context c) { public Label visit(VariableDeclaration nd, Context c) {
Label key = super.visit(nd, c); Label key = super.visit(nd, c);
if (nd.hasDeclareKeyword()) { if (nd.hasDeclareKeyword()) {
trapwriter.addTuple("hasDeclareKeyword", key); trapwriter.addTuple("has_declare_keyword", key);
} }
visitAll(nd.getDeclarations(), key); visitAll(nd.getDeclarations(), key);
return key; return key;
@@ -881,7 +881,7 @@ public class ASTExtractor {
public Label visit(FunctionDeclaration nd, Context c) { public Label visit(FunctionDeclaration nd, Context c) {
Label key = super.visit(nd, c); Label key = super.visit(nd, c);
if (nd.hasDeclareKeyword()) { if (nd.hasDeclareKeyword()) {
trapwriter.addTuple("hasDeclareKeyword", key); trapwriter.addTuple("has_declare_keyword", key);
} }
extractFunction(nd, key); extractFunction(nd, key);
emitStaticType(nd, key); emitStaticType(nd, key);
@@ -1284,7 +1284,7 @@ public class ASTExtractor {
public Label visit(ClassDeclaration nd, Context c) { public Label visit(ClassDeclaration nd, Context c) {
Label lbl = super.visit(nd, c); Label lbl = super.visit(nd, c);
if (nd.hasDeclareKeyword()) { if (nd.hasDeclareKeyword()) {
trapwriter.addTuple("hasDeclareKeyword", lbl); trapwriter.addTuple("has_declare_keyword", lbl);
} }
if (nd.hasAbstractKeyword()) { if (nd.hasAbstractKeyword()) {
trapwriter.addTuple("isAbstractClass", lbl); trapwriter.addTuple("isAbstractClass", lbl);
@@ -1361,7 +1361,7 @@ public class ASTExtractor {
nd.isInstantiated() ? IdContext.varAndNamespaceDecl : IdContext.namespaceDecl; nd.isInstantiated() ? IdContext.varAndNamespaceDecl : IdContext.namespaceDecl;
visit(nd.getName(), lbl, -1, context); visit(nd.getName(), lbl, -1, context);
if (nd.hasDeclareKeyword()) { if (nd.hasDeclareKeyword()) {
trapwriter.addTuple("hasDeclareKeyword", lbl); trapwriter.addTuple("has_declare_keyword", lbl);
} }
DeclaredNames hoistedVars = DeclaredNames hoistedVars =
scopeManager.collectDeclaredNames(nd.getBody(), isStrict, false, DeclKind.none); scopeManager.collectDeclaredNames(nd.getBody(), isStrict, false, DeclKind.none);
@@ -1539,7 +1539,7 @@ public class ASTExtractor {
} }
if (nd.hasDeclareKeyword()) { if (nd.hasDeclareKeyword()) {
trapwriter.addTuple("hasDeclareKeyword", methkey); trapwriter.addTuple("has_declare_keyword", methkey);
} }
return methkey; return methkey;
@@ -1947,7 +1947,7 @@ public class ASTExtractor {
trapwriter.addTuple("isConstEnum", key); trapwriter.addTuple("isConstEnum", key);
} }
if (nd.hasDeclareKeyword()) { if (nd.hasDeclareKeyword()) {
trapwriter.addTuple("hasDeclareKeyword", key); trapwriter.addTuple("has_declare_keyword", key);
} }
emitNodeSymbol(nd, key); emitNodeSymbol(nd, key);
return key; return key;
@@ -1968,7 +1968,7 @@ public class ASTExtractor {
@Override @Override
public Label visit(ExternalModuleDeclaration nd, Context c) { public Label visit(ExternalModuleDeclaration nd, Context c) {
Label key = super.visit(nd, c); Label key = super.visit(nd, c);
trapwriter.addTuple("hasDeclareKeyword", key); trapwriter.addTuple("has_declare_keyword", key);
visit(nd.getName(), key, -1, IdContext.label); visit(nd.getName(), key, -1, IdContext.label);
DeclaredNames hoistedVars = DeclaredNames hoistedVars =
scopeManager.collectDeclaredNames(nd.getBody(), isStrict, false, DeclKind.none); scopeManager.collectDeclaredNames(nd.getBody(), isStrict, false, DeclKind.none);
@@ -2013,7 +2013,7 @@ public class ASTExtractor {
// The fake scope does not exist at the QL level, as it is indistinguishable // The fake scope does not exist at the QL level, as it is indistinguishable
// from the global scope. // from the global scope.
Label key = super.visit(nd, c); Label key = super.visit(nd, c);
trapwriter.addTuple("hasDeclareKeyword", key); trapwriter.addTuple("has_declare_keyword", key);
DeclaredNames hoistedVars = DeclaredNames hoistedVars =
scopeManager.collectDeclaredNames(nd.getBody(), isStrict, false, DeclKind.none); scopeManager.collectDeclaredNames(nd.getBody(), isStrict, false, DeclKind.none);
DeclaredNames lexicalVars = DeclaredNames lexicalVars =

View File

@@ -9711,7 +9711,7 @@ stmts(#23113,17,#22805,13,"declare ... number;")
locations_default(#23114,#10000,94,3,94,42) locations_default(#23114,#10000,94,3,94,42)
hasLocation(#23113,#23114) hasLocation(#23113,#23114)
stmt_containers(#23113,#22805) stmt_containers(#23113,#22805)
hasDeclareKeyword(#23113) has_declare_keyword(#23113)
#23115=* #23115=*
exprs(#23115,78,#23113,-1,"foo") exprs(#23115,78,#23113,-1,"foo")
hasLocation(#23115,#22008) hasLocation(#23115,#22008)
@@ -9751,7 +9751,7 @@ stmts(#23123,17,#22805,14,"declare ... string;")
locations_default(#23124,#10000,95,3,95,42) locations_default(#23124,#10000,95,3,95,42)
hasLocation(#23123,#23124) hasLocation(#23123,#23124)
stmt_containers(#23123,#22805) stmt_containers(#23123,#22805)
hasDeclareKeyword(#23123) has_declare_keyword(#23123)
#23125=* #23125=*
exprs(#23125,78,#23123,-1,"foo") exprs(#23125,78,#23123,-1,"foo")
hasLocation(#23125,#22030) hasLocation(#23125,#22030)
@@ -9789,7 +9789,7 @@ stmts(#23132,17,#22805,15,"declare ... number;")
locations_default(#23133,#10000,96,3,96,60) locations_default(#23133,#10000,96,3,96,60)
hasLocation(#23132,#23133) hasLocation(#23132,#23133)
stmt_containers(#23132,#22805) stmt_containers(#23132,#22805)
hasDeclareKeyword(#23132) has_declare_keyword(#23132)
#23134=* #23134=*
exprs(#23134,78,#23132,-1,"foo") exprs(#23134,78,#23132,-1,"foo")
hasLocation(#23134,#22052) hasLocation(#23134,#22052)

View File

@@ -54,7 +54,7 @@ hasLocation(#20001,#20016)
stmts(#20017,26,#20001,0,"declare class C {}") stmts(#20017,26,#20001,0,"declare class C {}")
hasLocation(#20017,#20003) hasLocation(#20017,#20003)
stmt_containers(#20017,#20001) stmt_containers(#20017,#20001)
hasDeclareKeyword(#20017) has_declare_keyword(#20017)
#20018=* #20018=*
exprs(#20018,78,#20017,0,"C") exprs(#20018,78,#20017,0,"C")
hasLocation(#20018,#20009) hasLocation(#20018,#20009)

View File

@@ -688,7 +688,7 @@ exprContainers(#20248,#20001)
literals("b","b",#20248) literals("b","b",#20248)
decl(#20248,#20243) decl(#20248,#20243)
typedecl(#20248,#20244) typedecl(#20248,#20244)
hasDeclareKeyword(#20238) has_declare_keyword(#20238)
#20249=* #20249=*
stmts(#20249,36,#20001,2,"const e ... +2, b }") stmts(#20249,36,#20001,2,"const e ... +2, b }")
hasLocation(#20249,#20009) hasLocation(#20249,#20009)
@@ -806,7 +806,7 @@ literals("b","b",#20275)
decl(#20275,#20270) decl(#20275,#20270)
typedecl(#20275,#20271) typedecl(#20275,#20271)
isConstEnum(#20265) isConstEnum(#20265)
hasDeclareKeyword(#20265) has_declare_keyword(#20265)
#20276=* #20276=*
stmts(#20276,17,#20001,4,"functio ... rn x; }") stmts(#20276,17,#20001,4,"functio ... rn x; }")
hasLocation(#20276,#20015) hasLocation(#20276,#20015)

View File

@@ -107,7 +107,7 @@ stmts(#20035,17,#20034,-1,"declare ... foo();")
locations_default(#20036,#10000,1,8,1,30) locations_default(#20036,#10000,1,8,1,30)
hasLocation(#20035,#20036) hasLocation(#20035,#20036)
stmt_containers(#20035,#20001) stmt_containers(#20035,#20001)
hasDeclareKeyword(#20035) has_declare_keyword(#20035)
#20037=* #20037=*
exprs(#20037,78,#20035,-1,"foo") exprs(#20037,78,#20035,-1,"foo")
hasLocation(#20037,#20013) hasLocation(#20037,#20013)

View File

@@ -234,7 +234,7 @@ stmts(#20082,37,#20001,0,"declare ... = M;\n}")
locations_default(#20083,#10000,1,1,9,1) locations_default(#20083,#10000,1,1,9,1)
hasLocation(#20082,#20083) hasLocation(#20082,#20083)
stmt_containers(#20082,#20001) stmt_containers(#20082,#20001)
hasDeclareKeyword(#20082) has_declare_keyword(#20082)
#20084=* #20084=*
exprs(#20084,4,#20082,-1,"""X""") exprs(#20084,4,#20082,-1,"""X""")
hasLocation(#20084,#20025) hasLocation(#20084,#20025)

View File

@@ -592,7 +592,7 @@ local_type_names(#20223,"C",#20000)
stmts(#20224,18,#20001,0,"declare var A : any;") stmts(#20224,18,#20001,0,"declare var A : any;")
hasLocation(#20224,#20003) hasLocation(#20224,#20003)
stmt_containers(#20224,#20001) stmt_containers(#20224,#20001)
hasDeclareKeyword(#20224) has_declare_keyword(#20224)
#20225=* #20225=*
exprs(#20225,64,#20224,0,"A : any") exprs(#20225,64,#20224,0,"A : any")
#20226=@"loc,{#10000},1,13,1,19" #20226=@"loc,{#10000},1,13,1,19"
@@ -619,7 +619,7 @@ literals("any","any",#20229)
stmts(#20230,18,#20001,1,"declare var B : any;") stmts(#20230,18,#20001,1,"declare var B : any;")
hasLocation(#20230,#20005) hasLocation(#20230,#20005)
stmt_containers(#20230,#20001) stmt_containers(#20230,#20001)
hasDeclareKeyword(#20230) has_declare_keyword(#20230)
#20231=* #20231=*
exprs(#20231,64,#20230,0,"B : any") exprs(#20231,64,#20230,0,"B : any")
#20232=@"loc,{#10000},2,13,2,19" #20232=@"loc,{#10000},2,13,2,19"
@@ -646,7 +646,7 @@ literals("any","any",#20235)
stmts(#20236,18,#20001,2,"declare var C : any;") stmts(#20236,18,#20001,2,"declare var C : any;")
hasLocation(#20236,#20007) hasLocation(#20236,#20007)
stmt_containers(#20236,#20001) stmt_containers(#20236,#20001)
hasDeclareKeyword(#20236) has_declare_keyword(#20236)
#20237=* #20237=*
exprs(#20237,64,#20236,0,"C : any") exprs(#20237,64,#20236,0,"C : any")
#20238=@"loc,{#10000},3,13,3,19" #20238=@"loc,{#10000},3,13,3,19"

View File

@@ -702,7 +702,7 @@ local_type_names(#20254,"C",#20000)
stmts(#20255,17,#20001,0,"declare ... on f();") stmts(#20255,17,#20001,0,"declare ... on f();")
hasLocation(#20255,#20020) hasLocation(#20255,#20020)
stmt_containers(#20255,#20001) stmt_containers(#20255,#20001)
hasDeclareKeyword(#20255) has_declare_keyword(#20255)
#20256=* #20256=*
exprs(#20256,78,#20255,-1,"f") exprs(#20256,78,#20255,-1,"f")
hasLocation(#20256,#20079) hasLocation(#20256,#20079)
@@ -940,7 +940,7 @@ stmts(#20312,26,#20001,2,"declare ... mber;\n}")
locations_default(#20313,#10000,18,1,29,1) locations_default(#20313,#10000,18,1,29,1)
hasLocation(#20312,#20313) hasLocation(#20312,#20313)
stmt_containers(#20312,#20001) stmt_containers(#20312,#20001)
hasDeclareKeyword(#20312) has_declare_keyword(#20312)
isAbstractClass(#20312) isAbstractClass(#20312)
#20314=* #20314=*
exprs(#20314,78,#20312,0,"D") exprs(#20314,78,#20312,0,"D")

View File

@@ -532,7 +532,7 @@ stmt_containers(#20186,#20178)
stmts(#20188,17,#20001,2,"declare ... umber);") stmts(#20188,17,#20001,2,"declare ... umber);")
hasLocation(#20188,#20011) hasLocation(#20188,#20011)
stmt_containers(#20188,#20001) stmt_containers(#20188,#20001)
hasDeclareKeyword(#20188) has_declare_keyword(#20188)
#20189=* #20189=*
exprs(#20189,78,#20188,-1,"ambient") exprs(#20189,78,#20188,-1,"ambient")
hasLocation(#20189,#20091) hasLocation(#20189,#20091)

View File

@@ -148,12 +148,12 @@ class ASTNode extends @ast_node, NodeInStmtContainer {
or or
this instanceof InterfaceDeclaration this instanceof InterfaceDeclaration
or or
hasDeclareKeyword(this) has_declare_keyword(this)
or or
hasTypeKeyword(this) hasTypeKeyword(this)
or or
// An export such as `export declare function f()` should be seen as ambient. // An export such as `export declare function f()` should be seen as ambient.
hasDeclareKeyword(this.(ExportNamedDeclaration).getOperand()) has_declare_keyword(this.(ExportNamedDeclaration).getOperand())
or or
exists(Function f | exists(Function f |
this = f and this = f and

View File

@@ -106,3 +106,7 @@ deprecated predicate jumpTargets(Stmt jump, Stmt target) { jump_targets(jump, ta
* Use `NamespaceDeclaration#isInstantiated() instead.` * Use `NamespaceDeclaration#isInstantiated() instead.`
*/ */
deprecated predicate isInstantiated(NamespaceDeclaration decl) { is_instantiated(decl) } deprecated predicate isInstantiated(NamespaceDeclaration decl) { is_instantiated(decl) }
/**
* Alias for the predicate `has_declare_keyword` defined in the .dbscheme.
*/
deprecated predicate hasDeclareKeyword(ASTNode stmt) { has_declare_keyword(stmt) }

View File

@@ -276,7 +276,7 @@ class ClassDefinition extends @classdefinition, ClassOrInterface, AST::ValueNode
*/ */
class ClassDeclStmt extends @classdeclstmt, ClassDefinition, Stmt { class ClassDeclStmt extends @classdeclstmt, ClassDefinition, Stmt {
override ControlFlowNode getFirstControlFlowNode() { override ControlFlowNode getFirstControlFlowNode() {
if hasDeclareKeyword(this) then result = this else result = getIdentifier() if has_declare_keyword(this) then result = this else result = getIdentifier()
} }
} }

View File

@@ -86,7 +86,7 @@ class NamespaceDeclaration extends NamespaceDefinition, StmtContainer, @namespac
predicate isInstantiated() { is_instantiated(this) } predicate isInstantiated() { is_instantiated(this) }
override ControlFlowNode getFirstControlFlowNode() { override ControlFlowNode getFirstControlFlowNode() {
if hasDeclareKeyword(this) then result = this else result = getIdentifier() if has_declare_keyword(this) then result = this else result = getIdentifier()
} }
} }

View File

@@ -201,7 +201,7 @@ case @stmt.kind of
is_instantiated(unique int decl: @namespacedeclaration ref); is_instantiated(unique int decl: @namespacedeclaration ref);
@declarablenode = @declstmt | @namespacedeclaration | @classdeclstmt | @functiondeclstmt | @enumdeclaration | @externalmoduledeclaration | @globalaugmentationdeclaration | @field; @declarablenode = @declstmt | @namespacedeclaration | @classdeclstmt | @functiondeclstmt | @enumdeclaration | @externalmoduledeclaration | @globalaugmentationdeclaration | @field;
hasDeclareKeyword(unique int stmt: @declarablenode ref); has_declare_keyword(unique int stmt: @declarablenode ref);
isForAwaitOf(unique int forof: @forofstmt ref); isForAwaitOf(unique int forof: @forofstmt ref);

View File

@@ -7919,7 +7919,7 @@
<dependencies/> <dependencies/>
</relation> </relation>
<relation> <relation>
<name>hasDeclareKeyword</name> <name>has_declare_keyword</name>
<cardinality>66</cardinality> <cardinality>66</cardinality>
<columnsizes> <columnsizes>
<e> <e>

View File

@@ -16,3 +16,5 @@ jump_targets.rel: reorder jumpTargets.rel(int jump, int target) jump target
jumpTargets.rel: delete jumpTargets.rel: delete
is_instantiated.rel: reorder isInstantiated.rel(int decl) decl is_instantiated.rel: reorder isInstantiated.rel(int decl) decl
isInstantiated.rel: delete isInstantiated.rel: delete
has_declare_keyword.rel: reorder hasDeclareKeyword.rel(int stmt) stmt
hasDeclareKeyword.rel: delete