From 22bce641b7f92f6e6470a1a57ab2fcbc5da81242 Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Fri, 4 Sep 2020 11:52:16 +0200 Subject: [PATCH] renamed "isAsync" to "is_async" --- .../src/com/semmle/js/extractor/ASTExtractor.java | 2 +- .../tests/es2017/output/trap/async-await.js.trap | 2 +- .../tests/es2017/output/trap/export-async-1.js.trap | 2 +- .../tests/es2017/output/trap/export-async-2.js.trap | 2 +- .../tests/es2017/output/trap/invalid-async-fn.js.trap | 2 +- .../tests/es2018/output/trap/asyncIter.js.trap | 10 +++++----- .../tests/esnext/output/trap/async-generators.js.trap | 4 ++-- .../extractor/tests/flow/output/trap/async.js.trap | 2 +- javascript/ql/src/semmle/javascript/Aliases.qll | 5 +++++ javascript/ql/src/semmle/javascript/Functions.qll | 2 +- javascript/ql/src/semmlecode.javascript.dbscheme | 2 +- javascript/ql/src/semmlecode.javascript.dbscheme.stats | 2 +- .../upgrade.properties | 2 ++ 13 files changed, 23 insertions(+), 16 deletions(-) diff --git a/javascript/extractor/src/com/semmle/js/extractor/ASTExtractor.java b/javascript/extractor/src/com/semmle/js/extractor/ASTExtractor.java index 719d4881dca..ba6ef39efd2 100644 --- a/javascript/extractor/src/com/semmle/js/extractor/ASTExtractor.java +++ b/javascript/extractor/src/com/semmle/js/extractor/ASTExtractor.java @@ -891,7 +891,7 @@ public class ASTExtractor { private void extractFunctionAttributes(IFunction nd, Label key) { if (nd.isGenerator()) trapwriter.addTuple("is_generator", key); if (nd.hasRest()) trapwriter.addTuple("has_rest_parameter", key); - if (nd.isAsync()) trapwriter.addTuple("isAsync", key); + if (nd.isAsync()) trapwriter.addTuple("is_async", key); } @Override diff --git a/javascript/extractor/tests/es2017/output/trap/async-await.js.trap b/javascript/extractor/tests/es2017/output/trap/async-await.js.trap index bc3f77e86cd..cd79c3985ef 100644 --- a/javascript/extractor/tests/es2017/output/trap/async-await.js.trap +++ b/javascript/extractor/tests/es2017/output/trap/async-await.js.trap @@ -232,7 +232,7 @@ decl(#20078,#20077) #20079=@"var;{arguments};{#20076}" variables(#20079,"arguments",#20076) is_arguments_object(#20079) -isAsync(#20073) +is_async(#20073) #20080=* stmts(#20080,1,#20073,-2,"{\n try ... ;\n }\n}") #20081=@"loc,{#10000},1,30,7,1" diff --git a/javascript/extractor/tests/es2017/output/trap/export-async-1.js.trap b/javascript/extractor/tests/es2017/output/trap/export-async-1.js.trap index f9739c67bb4..86da62095d0 100644 --- a/javascript/extractor/tests/es2017/output/trap/export-async-1.js.trap +++ b/javascript/extractor/tests/es2017/output/trap/export-async-1.js.trap @@ -108,7 +108,7 @@ scopenesting(#20034,#20027) #20035=@"var;{arguments};{#20034}" variables(#20035,"arguments",#20034) is_arguments_object(#20035) -isAsync(#20031) +is_async(#20031) #20036=* stmts(#20036,1,#20031,-2,"{}") #20037=@"loc,{#10000},1,35,1,36" diff --git a/javascript/extractor/tests/es2017/output/trap/export-async-2.js.trap b/javascript/extractor/tests/es2017/output/trap/export-async-2.js.trap index 004c49b7c2e..d13cc444d29 100644 --- a/javascript/extractor/tests/es2017/output/trap/export-async-2.js.trap +++ b/javascript/extractor/tests/es2017/output/trap/export-async-2.js.trap @@ -96,7 +96,7 @@ scopenesting(#20030,#20025) #20031=@"var;{arguments};{#20030}" variables(#20031,"arguments",#20030) is_arguments_object(#20031) -isAsync(#20028) +is_async(#20028) #20032=* stmts(#20032,1,#20028,-2,"{}") #20033=@"loc,{#10000},1,34,1,35" diff --git a/javascript/extractor/tests/es2017/output/trap/invalid-async-fn.js.trap b/javascript/extractor/tests/es2017/output/trap/invalid-async-fn.js.trap index 8215bd97037..03b1c5fb16c 100644 --- a/javascript/extractor/tests/es2017/output/trap/invalid-async-fn.js.trap +++ b/javascript/extractor/tests/es2017/output/trap/invalid-async-fn.js.trap @@ -109,7 +109,7 @@ hasLocation(#20034,#20015) expr_containers(#20034,#20030) literals("x","x",#20034) decl(#20034,#20033) -isAsync(#20030) +is_async(#20030) #20035=* exprs(#20035,79,#20030,-2,"x") hasLocation(#20035,#20023) diff --git a/javascript/extractor/tests/es2018/output/trap/asyncIter.js.trap b/javascript/extractor/tests/es2018/output/trap/asyncIter.js.trap index 66d4f544f7a..cd9b4fbd27e 100644 --- a/javascript/extractor/tests/es2018/output/trap/asyncIter.js.trap +++ b/javascript/extractor/tests/es2018/output/trap/asyncIter.js.trap @@ -381,7 +381,7 @@ scopenesting(#20139,#20000) variables(#20140,"arguments",#20139) is_arguments_object(#20140) is_generator(#20137) -isAsync(#20137) +is_async(#20137) #20141=* stmts(#20141,1,#20137,-2,"{}") #20142=@"loc,{#10000},1,27,1,28" @@ -432,7 +432,7 @@ scopenesting(#20152,#20146) variables(#20153,"arguments",#20152) is_arguments_object(#20153) is_generator(#20150) -isAsync(#20150) +is_async(#20150) #20154=* stmts(#20154,1,#20150,-2,"{}") #20155=@"loc,{#10000},4,22,4,23" @@ -482,7 +482,7 @@ scopenesting(#20165,#20146) variables(#20166,"arguments",#20165) is_arguments_object(#20166) is_generator(#20163) -isAsync(#20163) +is_async(#20163) #20167=* stmts(#20167,1,#20163,-2,"{}") #20168=@"loc,{#10000},5,35,5,36" @@ -572,7 +572,7 @@ scopenesting(#20188,#20000) variables(#20189,"arguments",#20188) is_arguments_object(#20189) is_generator(#20186) -isAsync(#20186) +is_async(#20186) #20190=* stmts(#20190,1,#20186,-2,"{}") #20191=@"loc,{#10000},9,22,9,23" @@ -620,7 +620,7 @@ scopenesting(#20200,#20000) variables(#20201,"arguments",#20200) is_arguments_object(#20201) is_generator(#20198) -isAsync(#20198) +is_async(#20198) #20202=* stmts(#20202,1,#20198,-2,"{}") #20203=@"loc,{#10000},10,35,10,36" diff --git a/javascript/extractor/tests/esnext/output/trap/async-generators.js.trap b/javascript/extractor/tests/esnext/output/trap/async-generators.js.trap index 0fc53eab7c8..67f29efe9f8 100644 --- a/javascript/extractor/tests/esnext/output/trap/async-generators.js.trap +++ b/javascript/extractor/tests/esnext/output/trap/async-generators.js.trap @@ -206,7 +206,7 @@ scopenesting(#20072,#20000) variables(#20073,"arguments",#20072) is_arguments_object(#20073) is_generator(#20069) -isAsync(#20069) +is_async(#20069) #20074=* stmts(#20074,1,#20069,-2,"{\n}") #20075=@"loc,{#10000},1,23,2,1" @@ -234,7 +234,7 @@ variables(#20080,"x",#20079) #20081=@"var;{arguments};{#20079}" variables(#20081,"arguments",#20079) is_arguments_object(#20081) -isAsync(#20076) +is_async(#20076) #20082=* stmts(#20082,1,#20076,-2,"{\n for ... o());\n}") #20083=@"loc,{#10000},4,22,6,1" diff --git a/javascript/extractor/tests/flow/output/trap/async.js.trap b/javascript/extractor/tests/flow/output/trap/async.js.trap index bdee37ef303..b53ba8247ff 100644 --- a/javascript/extractor/tests/flow/output/trap/async.js.trap +++ b/javascript/extractor/tests/flow/output/trap/async.js.trap @@ -141,7 +141,7 @@ expr_containers(#20046,#20001) scopes(#20048,1) scopenodes(#20046,#20048) scopenesting(#20048,#20000) -isAsync(#20046) +is_async(#20046) #20049=* exprs(#20049,92,#20046,-2,"await foo()") #20050=@"loc,{#10000},1,38,1,48" diff --git a/javascript/ql/src/semmle/javascript/Aliases.qll b/javascript/ql/src/semmle/javascript/Aliases.qll index d9ec2b0077d..b97e5911e45 100644 --- a/javascript/ql/src/semmle/javascript/Aliases.qll +++ b/javascript/ql/src/semmle/javascript/Aliases.qll @@ -290,3 +290,8 @@ deprecated predicate isGenerator(Function fun) { is_generator(fun) } * Use `Function#hasRestParameter()` instead. */ deprecated predicate hasRestParameter(Function fun) { has_rest_parameter(fun) } +/** + * Alias for the predicate `is_async` defined in the .dbscheme. + * Use `Function#isAsync()` instead. + */ +deprecated predicate isAsync(Function fun) { is_async(fun) } diff --git a/javascript/ql/src/semmle/javascript/Functions.qll b/javascript/ql/src/semmle/javascript/Functions.qll index 68f336074bc..43c293417c2 100644 --- a/javascript/ql/src/semmle/javascript/Functions.qll +++ b/javascript/ql/src/semmle/javascript/Functions.qll @@ -202,7 +202,7 @@ class Function extends @function, Parameterized, TypeParameterized, StmtContaine predicate hasTrailingComma() { lastTokenOfParameterList().getNextToken().getValue() = "," } /** Holds if this function is an asynchronous function. */ - predicate isAsync() { isAsync(this) } + predicate isAsync() { is_async(this) } /** Holds if this function is asynchronous or a generator. */ predicate isAsyncOrGenerator() { isAsync() or isGenerator() } diff --git a/javascript/ql/src/semmlecode.javascript.dbscheme b/javascript/ql/src/semmlecode.javascript.dbscheme index 76c1efe798f..89a04b25086 100644 --- a/javascript/ql/src/semmlecode.javascript.dbscheme +++ b/javascript/ql/src/semmlecode.javascript.dbscheme @@ -441,7 +441,7 @@ scopenesting (unique int inner: @scope ref, is_generator (int fun: @function ref); has_rest_parameter (int fun: @function ref); -isAsync (int fun: @function ref); +is_async (int fun: @function ref); // variables and lexically scoped type names #keyset[scope, name] diff --git a/javascript/ql/src/semmlecode.javascript.dbscheme.stats b/javascript/ql/src/semmlecode.javascript.dbscheme.stats index b231d1c1e74..7b0782d0265 100644 --- a/javascript/ql/src/semmlecode.javascript.dbscheme.stats +++ b/javascript/ql/src/semmlecode.javascript.dbscheme.stats @@ -11709,7 +11709,7 @@ -isAsync +is_async 50 diff --git a/javascript/upgrades/c73fbfca57f3d593b9ff50c6aa3a886d6888efec/upgrade.properties b/javascript/upgrades/c73fbfca57f3d593b9ff50c6aa3a886d6888efec/upgrade.properties index b3ead7f8d42..3b782318fcb 100644 --- a/javascript/upgrades/c73fbfca57f3d593b9ff50c6aa3a886d6888efec/upgrade.properties +++ b/javascript/upgrades/c73fbfca57f3d593b9ff50c6aa3a886d6888efec/upgrade.properties @@ -90,3 +90,5 @@ is_generator.rel: reorder isGenerator.rel(int fun) fun isGenerator.rel: delete has_rest_parameter.rel: reorder hasRestParameter.rel(int fun) fun hasRestParameter.rel: delete +is_async.rel: reorder isAsync.rel(int fun) fun +isAsync.rel: delete