Merge pull request #1257 from asger-semmle/jsdoc

JS: Add common interface between TypeExpr and JSDocTypeExpr
This commit is contained in:
Max Schaefer
2019-04-29 16:20:17 +01:00
committed by GitHub
26 changed files with 3398 additions and 851 deletions

View File

@@ -42,3 +42,6 @@
## Changes to QL libraries
* `RegExpLiteral` is now a `DataFlow::SourceNode`.
* `JSDocTypeExpr` now has source locations and is a subclass of `Locatable` and `TypeAnnotation`.
* Various predicates named `getTypeAnnotation()` now return `TypeAnnotation` instead of `TypeExpr`.
In rare cases, this may cause compilation errors. Cast the result to `TypeExpr` if this happens.

View File

@@ -70,6 +70,7 @@ public class JSDocExtractor {
Label key = trapwriter.localID(nd);
int kind = jsdocTypeExprKinds.get(nd.getType());
trapwriter.addTuple("jsdoc_type_exprs", key, kind, parent, idx, nd.pp());
locationManager.emitNodeLocation(nd, key);
return key;
}

View File

@@ -37,7 +37,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 = "2019-03-21";
public static final String EXTRACTOR_VERSION = "2019-04-17";
public static final Pattern NEWLINE = Pattern.compile("\n");

View File

@@ -1000,7 +1000,7 @@ public class JSDocParser {
case STAR:
loc = loc();
consume(Token.STAR);
return new AllLiteral(loc);
return finishNode(new AllLiteral(loc));
case LPAREN:
return parseUnionType();
@@ -1015,13 +1015,13 @@ public class JSDocParser {
if (value.equals("null")) {
loc = loc();
consume(Token.NAME);
return new NullLiteral(loc);
return finishNode(new NullLiteral(loc));
}
if (value.equals("undefined")) {
loc = loc();
consume(Token.NAME);
return new UndefinedLiteral(loc);
return finishNode(new UndefinedLiteral(loc));
}
context = save();

View File

@@ -394,194 +394,267 @@ hasLocation(#20110,#20111)
jsdoc_tag_names(#20110,"klass")
#20112=*
jsdoc_type_exprs(#20112,5,#20110,0,"Object")
#20113=*
jsdoc(#20113,"",#20006)
hasLocation(#20113,#20007)
#20113=@"loc,{#10000},1,8,1,7"
locations_default(#20113,#10000,1,8,1,7)
hasLocation(#20112,#20113)
#20114=*
jsdoc_tags(#20114,"deprecated",#20113,0,"@deprecated")
#20115=@"loc,{#10000},7,5,7,15"
locations_default(#20115,#10000,7,5,7,15)
hasLocation(#20114,#20115)
#20116=*
jsdoc(#20116,"",#20008)
hasLocation(#20116,#20009)
jsdoc(#20114,"",#20006)
hasLocation(#20114,#20007)
#20115=*
jsdoc_tags(#20115,"deprecated",#20114,0,"@deprecated")
#20116=@"loc,{#10000},7,5,7,15"
locations_default(#20116,#10000,7,5,7,15)
hasLocation(#20115,#20116)
#20117=*
jsdoc_tags(#20117,"param",#20116,0,"@param")
#20118=@"loc,{#10000},8,5,8,10"
locations_default(#20118,#10000,8,5,8,10)
hasLocation(#20117,#20118)
jsdoc_tag_names(#20117,"x")
#20119=*
jsdoc_type_exprs(#20119,11,#20117,0,"(int|bool)")
jsdoc(#20117,"",#20008)
hasLocation(#20117,#20009)
#20118=*
jsdoc_tags(#20118,"param",#20117,0,"@param")
#20119=@"loc,{#10000},8,5,8,10"
locations_default(#20119,#10000,8,5,8,10)
hasLocation(#20118,#20119)
jsdoc_tag_names(#20118,"x")
#20120=*
jsdoc_type_exprs(#20120,5,#20119,0,"int")
#20121=*
jsdoc_type_exprs(#20121,5,#20119,1,"bool")
jsdoc_type_exprs(#20120,11,#20118,0,"(int|bool)")
#20121=@"loc,{#10000},1,3,1,11"
locations_default(#20121,#10000,1,3,1,11)
hasLocation(#20120,#20121)
#20122=*
jsdoc_tags(#20122,"param",#20116,1,"@param")
#20123=@"loc,{#10000},9,5,9,10"
locations_default(#20123,#10000,9,5,9,10)
jsdoc_type_exprs(#20122,5,#20120,0,"int")
#20123=@"loc,{#10000},1,6,1,6"
locations_default(#20123,#10000,1,6,1,6)
hasLocation(#20122,#20123)
jsdoc_tag_names(#20122,"ys")
#20124=*
jsdoc_type_exprs(#20124,6,#20122,0,"Array.<String, Number>")
#20125=*
jsdoc_type_exprs(#20125,5,#20124,-1,"Array")
jsdoc_type_exprs(#20124,5,#20120,1,"bool")
#20125=@"loc,{#10000},1,11,1,11"
locations_default(#20125,#10000,1,11,1,11)
hasLocation(#20124,#20125)
#20126=*
jsdoc_type_exprs(#20126,5,#20124,0,"String")
#20127=*
jsdoc_type_exprs(#20127,5,#20124,1,"Number")
jsdoc_tags(#20126,"param",#20117,1,"@param")
#20127=@"loc,{#10000},9,5,9,10"
locations_default(#20127,#10000,9,5,9,10)
hasLocation(#20126,#20127)
jsdoc_tag_names(#20126,"ys")
#20128=*
jsdoc_tags(#20128,"param",#20116,2,"@param")
#20129=@"loc,{#10000},10,5,10,10"
locations_default(#20129,#10000,10,5,10,10)
jsdoc_type_exprs(#20128,6,#20126,0,"Array.<String, Number>")
#20129=@"loc,{#10000},1,7,1,23"
locations_default(#20129,#10000,1,7,1,23)
hasLocation(#20128,#20129)
jsdoc_tag_names(#20128,"zs")
#20130=*
jsdoc_type_exprs(#20130,6,#20128,0,"Array.<String>")
#20131=*
jsdoc_type_exprs(#20131,5,#20130,-1,"Array")
jsdoc_type_exprs(#20130,5,#20128,-1,"Array")
#20131=@"loc,{#10000},1,7,1,8"
locations_default(#20131,#10000,1,7,1,8)
hasLocation(#20130,#20131)
#20132=*
jsdoc_type_exprs(#20132,5,#20130,0,"String")
#20133=*
jsdoc_tags(#20133,"param",#20116,3,"@param")
#20134=@"loc,{#10000},11,5,11,10"
locations_default(#20134,#10000,11,5,11,10)
hasLocation(#20133,#20134)
jsdoc_tag_names(#20133,"f")
#20135=*
jsdoc_type_exprs(#20135,12,#20133,0,"function (new: goog.ui.Menu, ?string=, number=): void")
jsdoc_type_exprs(#20132,5,#20128,0,"String")
#20133=@"loc,{#10000},1,15,1,15"
locations_default(#20133,#10000,1,15,1,15)
hasLocation(#20132,#20133)
#20134=*
jsdoc_type_exprs(#20134,5,#20128,1,"Number")
#20135=@"loc,{#10000},1,23,1,23"
locations_default(#20135,#10000,1,23,1,23)
hasLocation(#20134,#20135)
#20136=*
jsdoc_type_exprs(#20136,13,#20135,0,"?string=")
#20137=*
jsdoc_type_exprs(#20137,7,#20136,0,"?string")
jsdoc_tags(#20136,"param",#20117,2,"@param")
#20137=@"loc,{#10000},10,5,10,10"
locations_default(#20137,#10000,10,5,10,10)
hasLocation(#20136,#20137)
jsdoc_tag_names(#20136,"zs")
#20138=*
jsdoc_type_exprs(#20138,5,#20137,0,"string")
jsdoc_prefix_qualifier(#20137)
#20139=*
jsdoc_type_exprs(#20139,13,#20135,1,"number=")
jsdoc_type_exprs(#20138,6,#20136,0,"Array.<String>")
#20139=@"loc,{#10000},1,8,1,9"
locations_default(#20139,#10000,1,8,1,9)
hasLocation(#20138,#20139)
#20140=*
jsdoc_type_exprs(#20140,5,#20139,0,"number")
jsdoc_type_exprs(#20140,5,#20138,-1,"Array")
hasLocation(#20140,#20139)
#20141=*
jsdoc_type_exprs(#20141,4,#20135,-1,"void")
#20142=*
jsdoc_type_exprs(#20142,5,#20135,-2,"goog.ui.Menu")
jsdoc_has_new_parameter(#20135)
jsdoc_type_exprs(#20141,5,#20138,0,"String")
#20142=@"loc,{#10000},1,8,1,8"
locations_default(#20142,#10000,1,8,1,8)
hasLocation(#20141,#20142)
#20143=*
jsdoc_tags(#20143,"param",#20116,4,"@param")
#20144=@"loc,{#10000},12,5,12,10"
locations_default(#20144,#10000,12,5,12,10)
jsdoc_tags(#20143,"param",#20117,3,"@param")
#20144=@"loc,{#10000},11,5,11,10"
locations_default(#20144,#10000,11,5,11,10)
hasLocation(#20143,#20144)
jsdoc_tag_names(#20143,"var_args")
jsdoc_tag_names(#20143,"f")
#20145=*
jsdoc_type_exprs(#20145,14,#20143,0,"...number")
#20146=*
jsdoc_type_exprs(#20146,5,#20145,0,"number")
jsdoc_type_exprs(#20145,12,#20143,0,"function (new: goog.ui.Menu, ?string=, number=): void")
#20146=@"loc,{#10000},1,10,1,52"
locations_default(#20146,#10000,1,10,1,52)
hasLocation(#20145,#20146)
#20147=*
jsdoc(#20147,"",#20010)
hasLocation(#20147,#20011)
#20148=*
jsdoc_tags(#20148,"param",#20147,0,"@param")
#20149=@"loc,{#10000},15,4,15,9"
locations_default(#20149,#10000,15,4,15,9)
hasLocation(#20148,#20149)
#20150=*
jsdoc_errors(#20150,#20148,"Missing or invalid tag name","Missing ... ag name")
jsdoc_type_exprs(#20147,13,#20145,0,"?string=")
#20148=@"loc,{#10000},1,30,1,37"
locations_default(#20148,#10000,1,30,1,37)
hasLocation(#20147,#20148)
#20149=*
jsdoc_type_exprs(#20149,7,#20147,0,"?string")
#20150=@"loc,{#10000},1,30,1,36"
locations_default(#20150,#10000,1,30,1,36)
hasLocation(#20149,#20150)
#20151=*
jsdoc_tags(#20151,"param",#20147,1,"@param")
#20152=@"loc,{#10000},16,4,16,9"
locations_default(#20152,#10000,16,4,16,9)
jsdoc_type_exprs(#20151,5,#20149,0,"string")
#20152=@"loc,{#10000},1,36,1,36"
locations_default(#20152,#10000,1,36,1,36)
hasLocation(#20151,#20152)
jsdoc_tag_names(#20151,"x")
jsdoc_prefix_qualifier(#20149)
#20153=*
jsdoc(#20153,"",#20012)
hasLocation(#20153,#20013)
#20154=*
jsdoc_tags(#20154,"",#20153,0,"@")
#20155=@"loc,{#10000},20,4,20,4"
locations_default(#20155,#10000,20,4,20,4)
hasLocation(#20154,#20155)
jsdoc_tag_descriptions(#20154,"{link a}")
#20156=*
jsdoc_errors(#20156,#20154,"Missing or invalid title","Missing ... d title")
jsdoc_type_exprs(#20153,13,#20145,1,"number=")
#20154=@"loc,{#10000},1,45,1,46"
locations_default(#20154,#10000,1,45,1,46)
hasLocation(#20153,#20154)
#20155=*
jsdoc_type_exprs(#20155,5,#20153,0,"number")
#20156=@"loc,{#10000},1,45,1,45"
locations_default(#20156,#10000,1,45,1,45)
hasLocation(#20155,#20156)
#20157=*
jsdoc(#20157,"",#20014)
hasLocation(#20157,#20015)
#20158=*
jsdoc_tags(#20158,"typedef",#20157,0,"@typedef")
#20159=@"loc,{#10000},24,4,24,11"
locations_default(#20159,#10000,24,4,24,11)
hasLocation(#20158,#20159)
jsdoc_tag_descriptions(#20158,"{a}")
#20160=*
jsdoc_errors(#20160,#20158,"Missing or invalid tag type","Missing ... ag type")
jsdoc_type_exprs(#20157,4,#20145,-1,"void")
#20158=@"loc,{#10000},1,53,1,52"
locations_default(#20158,#10000,1,53,1,52)
hasLocation(#20157,#20158)
#20159=*
jsdoc_type_exprs(#20159,5,#20145,-2,"goog.ui.Menu")
#20160=@"loc,{#10000},1,27,1,27"
locations_default(#20160,#10000,1,27,1,27)
hasLocation(#20159,#20160)
jsdoc_has_new_parameter(#20145)
#20161=*
jsdoc(#20161,"[resize description]",#20016)
hasLocation(#20161,#20017)
#20162=*
jsdoc_tags(#20162,"param",#20161,0,"@param")
#20163=@"loc,{#10000},30,4,30,9"
locations_default(#20163,#10000,30,4,30,9)
hasLocation(#20162,#20163)
jsdoc_tag_descriptions(#20162,"[description]
")
jsdoc_tag_names(#20162,"w")
#20164=*
jsdoc_type_exprs(#20164,10,#20162,0,"[type]")
jsdoc_tags(#20161,"param",#20117,4,"@param")
#20162=@"loc,{#10000},12,5,12,10"
locations_default(#20162,#10000,12,5,12,10)
hasLocation(#20161,#20162)
jsdoc_tag_names(#20161,"var_args")
#20163=*
jsdoc_type_exprs(#20163,14,#20161,0,"...number")
#20164=@"loc,{#10000},1,5,1,10"
locations_default(#20164,#10000,1,5,1,10)
hasLocation(#20163,#20164)
#20165=*
jsdoc_type_exprs(#20165,5,#20164,0,"type")
#20166=*
jsdoc_tags(#20166,"param",#20161,1,"@param")
#20167=@"loc,{#10000},31,4,31,9"
locations_default(#20167,#10000,31,4,31,9)
hasLocation(#20166,#20167)
jsdoc_tag_descriptions(#20166,"[description]
")
jsdoc_type_exprs(#20165,5,#20163,0,"number")
#20166=@"loc,{#10000},1,11,1,10"
locations_default(#20166,#10000,1,11,1,10)
hasLocation(#20165,#20166)
#20167=*
jsdoc(#20167,"",#20010)
hasLocation(#20167,#20011)
#20168=*
jsdoc_tags(#20168,"return",#20161,2,"@return")
#20169=@"loc,{#10000},32,4,32,10"
locations_default(#20169,#10000,32,4,32,10)
jsdoc_tags(#20168,"param",#20167,0,"@param")
#20169=@"loc,{#10000},15,4,15,9"
locations_default(#20169,#10000,15,4,15,9)
hasLocation(#20168,#20169)
jsdoc_tag_descriptions(#20168,"[description]")
#20170=*
jsdoc_type_exprs(#20170,10,#20168,0,"[type]")
jsdoc_errors(#20170,#20168,"Missing or invalid tag name","Missing ... ag name")
#20171=*
jsdoc_type_exprs(#20171,5,#20170,0,"type")
#20172=*
jsdoc(#20172,"",#20018)
hasLocation(#20172,#20019)
jsdoc_tags(#20171,"param",#20167,1,"@param")
#20172=@"loc,{#10000},16,4,16,9"
locations_default(#20172,#10000,16,4,16,9)
hasLocation(#20171,#20172)
jsdoc_tag_names(#20171,"x")
#20173=*
jsdoc_tags(#20173,"exports",#20172,0,"@exports")
#20174=@"loc,{#10000},36,3,36,10"
locations_default(#20174,#10000,36,3,36,10)
hasLocation(#20173,#20174)
jsdoc_tag_descriptions(#20173,"R
")
#20175=*
jsdoc(#20175,"",#20020)
hasLocation(#20175,#20021)
jsdoc(#20173,"",#20012)
hasLocation(#20173,#20013)
#20174=*
jsdoc_tags(#20174,"",#20173,0,"@")
#20175=@"loc,{#10000},20,4,20,4"
locations_default(#20175,#10000,20,4,20,4)
hasLocation(#20174,#20175)
jsdoc_tag_descriptions(#20174,"{link a}")
#20176=*
jsdoc_tags(#20176,"typedef",#20175,0,"@typedef")
#20177=@"loc,{#10000},41,4,41,11"
locations_default(#20177,#10000,41,4,41,11)
hasLocation(#20176,#20177)
jsdoc_errors(#20176,#20174,"Missing or invalid title","Missing ... d title")
#20177=*
jsdoc(#20177,"",#20014)
hasLocation(#20177,#20015)
#20178=*
jsdoc_type_exprs(#20178,9,#20176,0,"{0: number}")
jsdoc_record_field_name(#20178,0,"0")
#20179=*
jsdoc_type_exprs(#20179,5,#20178,0,"number")
toplevels(#20001,0)
#20180=@"loc,{#10000},1,1,43,0"
locations_default(#20180,#10000,1,1,43,0)
hasLocation(#20001,#20180)
jsdoc_tags(#20178,"typedef",#20177,0,"@typedef")
#20179=@"loc,{#10000},24,4,24,11"
locations_default(#20179,#10000,24,4,24,11)
hasLocation(#20178,#20179)
jsdoc_tag_descriptions(#20178,"{a}")
#20180=*
jsdoc_errors(#20180,#20178,"Missing or invalid tag type","Missing ... ag type")
#20181=*
entry_cfg_node(#20181,#20001)
#20182=@"loc,{#10000},1,1,1,0"
locations_default(#20182,#10000,1,1,1,0)
hasLocation(#20181,#20182)
#20183=*
exit_cfg_node(#20183,#20001)
hasLocation(#20183,#20105)
successor(#20181,#20183)
jsdoc(#20181,"[resize description]",#20016)
hasLocation(#20181,#20017)
#20182=*
jsdoc_tags(#20182,"param",#20181,0,"@param")
#20183=@"loc,{#10000},30,4,30,9"
locations_default(#20183,#10000,30,4,30,9)
hasLocation(#20182,#20183)
jsdoc_tag_descriptions(#20182,"[description]
")
jsdoc_tag_names(#20182,"w")
#20184=*
jsdoc_type_exprs(#20184,10,#20182,0,"[type]")
#20185=@"loc,{#10000},1,7,1,7"
locations_default(#20185,#10000,1,7,1,7)
hasLocation(#20184,#20185)
#20186=*
jsdoc_type_exprs(#20186,5,#20184,0,"type")
hasLocation(#20186,#20185)
#20187=*
jsdoc_tags(#20187,"param",#20181,1,"@param")
#20188=@"loc,{#10000},31,4,31,9"
locations_default(#20188,#10000,31,4,31,9)
hasLocation(#20187,#20188)
jsdoc_tag_descriptions(#20187,"[description]
")
#20189=*
jsdoc_tags(#20189,"return",#20181,2,"@return")
#20190=@"loc,{#10000},32,4,32,10"
locations_default(#20190,#10000,32,4,32,10)
hasLocation(#20189,#20190)
jsdoc_tag_descriptions(#20189,"[description]")
#20191=*
jsdoc_type_exprs(#20191,10,#20189,0,"[type]")
hasLocation(#20191,#20185)
#20192=*
jsdoc_type_exprs(#20192,5,#20191,0,"type")
hasLocation(#20192,#20185)
#20193=*
jsdoc(#20193,"",#20018)
hasLocation(#20193,#20019)
#20194=*
jsdoc_tags(#20194,"exports",#20193,0,"@exports")
#20195=@"loc,{#10000},36,3,36,10"
locations_default(#20195,#10000,36,3,36,10)
hasLocation(#20194,#20195)
jsdoc_tag_descriptions(#20194,"R
")
#20196=*
jsdoc(#20196,"",#20020)
hasLocation(#20196,#20021)
#20197=*
jsdoc_tags(#20197,"typedef",#20196,0,"@typedef")
#20198=@"loc,{#10000},41,4,41,11"
locations_default(#20198,#10000,41,4,41,11)
hasLocation(#20197,#20198)
#20199=*
jsdoc_type_exprs(#20199,9,#20197,0,"{0: number}")
#20200=@"loc,{#10000},1,3,1,12"
locations_default(#20200,#10000,1,3,1,12)
hasLocation(#20199,#20200)
jsdoc_record_field_name(#20199,0,"0")
#20201=*
jsdoc_type_exprs(#20201,5,#20199,0,"number")
#20202=@"loc,{#10000},1,12,1,12"
locations_default(#20202,#10000,1,12,1,12)
hasLocation(#20201,#20202)
toplevels(#20001,0)
#20203=@"loc,{#10000},1,1,43,0"
locations_default(#20203,#10000,1,1,43,0)
hasLocation(#20001,#20203)
#20204=*
entry_cfg_node(#20204,#20001)
#20205=@"loc,{#10000},1,1,1,0"
locations_default(#20205,#10000,1,1,1,0)
hasLocation(#20204,#20205)
#20206=*
exit_cfg_node(#20206,#20001)
hasLocation(#20206,#20105)
successor(#20204,#20206)
numlines(#10000,42,0,37)
filetype(#10000,"javascript")

View File

@@ -470,472 +470,475 @@ locations_default(#20177,#10000,12,5,12,12)
hasLocation(#20176,#20177)
#20178=*
jsdoc_type_exprs(#20178,5,#20176,0,"String")
#20179=@"loc,{#10000},1,8,1,7"
locations_default(#20179,#10000,1,8,1,7)
hasLocation(#20178,#20179)
toplevels(#20001,0)
#20179=@"loc,{#10000},1,1,17,13"
locations_default(#20179,#10000,1,1,17,13)
hasLocation(#20001,#20179)
#20180=@"var;{Point};{#20000}"
variables(#20180,"Point",#20000)
#20181=@"var;{someGlobal};{#20000}"
variables(#20181,"someGlobal",#20000)
#20182=@"var;{MyString};{#20000}"
variables(#20182,"MyString",#20000)
#20183=*
stmts(#20183,17,#20001,0,"functio ... , y) {}")
hasLocation(#20183,#20005)
stmtContainers(#20183,#20001)
#20180=@"loc,{#10000},1,1,17,13"
locations_default(#20180,#10000,1,1,17,13)
hasLocation(#20001,#20180)
#20181=@"var;{Point};{#20000}"
variables(#20181,"Point",#20000)
#20182=@"var;{someGlobal};{#20000}"
variables(#20182,"someGlobal",#20000)
#20183=@"var;{MyString};{#20000}"
variables(#20183,"MyString",#20000)
#20184=*
exprs(#20184,78,#20183,-1,"Point")
hasLocation(#20184,#20040)
exprContainers(#20184,#20183)
literals("Point","Point",#20184)
decl(#20184,#20180)
stmts(#20184,17,#20001,0,"functio ... , y) {}")
hasLocation(#20184,#20005)
stmtContainers(#20184,#20001)
#20185=*
scopes(#20185,1)
scopenodes(#20183,#20185)
scopenesting(#20185,#20000)
#20186=@"var;{x};{#20185}"
variables(#20186,"x",#20185)
#20187=*
exprs(#20187,78,#20183,0,"x")
hasLocation(#20187,#20044)
exprContainers(#20187,#20183)
literals("x","x",#20187)
decl(#20187,#20186)
#20188=@"var;{y};{#20185}"
variables(#20188,"y",#20185)
#20189=*
exprs(#20189,78,#20183,1,"y")
hasLocation(#20189,#20048)
exprContainers(#20189,#20183)
literals("y","y",#20189)
decl(#20189,#20188)
#20190=@"var;{arguments};{#20185}"
variables(#20190,"arguments",#20185)
isArgumentsObject(#20190)
#20191=*
stmts(#20191,1,#20183,-2,"{}")
#20192=@"loc,{#10000},1,22,1,23"
locations_default(#20192,#10000,1,22,1,23)
hasLocation(#20191,#20192)
stmtContainers(#20191,#20183)
#20193=*
stmts(#20193,2,#20001,1,"Point.p ... dy) {};")
hasLocation(#20193,#20009)
stmtContainers(#20193,#20001)
exprs(#20185,78,#20184,-1,"Point")
hasLocation(#20185,#20040)
exprContainers(#20185,#20184)
literals("Point","Point",#20185)
decl(#20185,#20181)
#20186=*
scopes(#20186,1)
scopenodes(#20184,#20186)
scopenesting(#20186,#20000)
#20187=@"var;{x};{#20186}"
variables(#20187,"x",#20186)
#20188=*
exprs(#20188,78,#20184,0,"x")
hasLocation(#20188,#20044)
exprContainers(#20188,#20184)
literals("x","x",#20188)
decl(#20188,#20187)
#20189=@"var;{y};{#20186}"
variables(#20189,"y",#20186)
#20190=*
exprs(#20190,78,#20184,1,"y")
hasLocation(#20190,#20048)
exprContainers(#20190,#20184)
literals("y","y",#20190)
decl(#20190,#20189)
#20191=@"var;{arguments};{#20186}"
variables(#20191,"arguments",#20186)
isArgumentsObject(#20191)
#20192=*
stmts(#20192,1,#20184,-2,"{}")
#20193=@"loc,{#10000},1,22,1,23"
locations_default(#20193,#10000,1,22,1,23)
hasLocation(#20192,#20193)
stmtContainers(#20192,#20184)
#20194=*
exprs(#20194,47,#20193,0,"Point.p ... dy) {}")
#20195=@"loc,{#10000},3,1,3,42"
locations_default(#20195,#10000,3,1,3,42)
hasLocation(#20194,#20195)
enclosingStmt(#20194,#20193)
exprContainers(#20194,#20001)
#20196=*
exprs(#20196,14,#20194,0,"Point.prototype.move")
#20197=@"loc,{#10000},3,1,3,20"
locations_default(#20197,#10000,3,1,3,20)
hasLocation(#20196,#20197)
enclosingStmt(#20196,#20193)
exprContainers(#20196,#20001)
#20198=*
exprs(#20198,14,#20196,0,"Point.prototype")
#20199=@"loc,{#10000},3,1,3,15"
locations_default(#20199,#10000,3,1,3,15)
hasLocation(#20198,#20199)
enclosingStmt(#20198,#20193)
exprContainers(#20198,#20001)
#20200=*
exprs(#20200,79,#20198,0,"Point")
hasLocation(#20200,#20056)
enclosingStmt(#20200,#20193)
exprContainers(#20200,#20001)
literals("Point","Point",#20200)
bind(#20200,#20180)
stmts(#20194,2,#20001,1,"Point.p ... dy) {};")
hasLocation(#20194,#20009)
stmtContainers(#20194,#20001)
#20195=*
exprs(#20195,47,#20194,0,"Point.p ... dy) {}")
#20196=@"loc,{#10000},3,1,3,42"
locations_default(#20196,#10000,3,1,3,42)
hasLocation(#20195,#20196)
enclosingStmt(#20195,#20194)
exprContainers(#20195,#20001)
#20197=*
exprs(#20197,14,#20195,0,"Point.prototype.move")
#20198=@"loc,{#10000},3,1,3,20"
locations_default(#20198,#10000,3,1,3,20)
hasLocation(#20197,#20198)
enclosingStmt(#20197,#20194)
exprContainers(#20197,#20001)
#20199=*
exprs(#20199,14,#20197,0,"Point.prototype")
#20200=@"loc,{#10000},3,1,3,15"
locations_default(#20200,#10000,3,1,3,15)
hasLocation(#20199,#20200)
enclosingStmt(#20199,#20194)
exprContainers(#20199,#20001)
#20201=*
exprs(#20201,0,#20198,1,"prototype")
hasLocation(#20201,#20060)
enclosingStmt(#20201,#20193)
exprs(#20201,79,#20199,0,"Point")
hasLocation(#20201,#20056)
enclosingStmt(#20201,#20194)
exprContainers(#20201,#20001)
literals("prototype","prototype",#20201)
literals("Point","Point",#20201)
bind(#20201,#20181)
#20202=*
exprs(#20202,0,#20196,1,"move")
hasLocation(#20202,#20064)
enclosingStmt(#20202,#20193)
exprs(#20202,0,#20199,1,"prototype")
hasLocation(#20202,#20060)
enclosingStmt(#20202,#20194)
exprContainers(#20202,#20001)
literals("move","move",#20202)
literals("prototype","prototype",#20202)
#20203=*
exprs(#20203,9,#20194,1,"function(dx, dy) {}")
#20204=@"loc,{#10000},3,24,3,42"
locations_default(#20204,#10000,3,24,3,42)
hasLocation(#20203,#20204)
enclosingStmt(#20203,#20193)
exprs(#20203,0,#20197,1,"move")
hasLocation(#20203,#20064)
enclosingStmt(#20203,#20194)
exprContainers(#20203,#20001)
#20205=*
scopes(#20205,1)
scopenodes(#20203,#20205)
scopenesting(#20205,#20000)
#20206=@"var;{dx};{#20205}"
variables(#20206,"dx",#20205)
#20207=*
exprs(#20207,78,#20203,0,"dx")
hasLocation(#20207,#20072)
exprContainers(#20207,#20203)
literals("dx","dx",#20207)
decl(#20207,#20206)
#20208=@"var;{dy};{#20205}"
variables(#20208,"dy",#20205)
#20209=*
exprs(#20209,78,#20203,1,"dy")
hasLocation(#20209,#20076)
exprContainers(#20209,#20203)
literals("dy","dy",#20209)
decl(#20209,#20208)
#20210=@"var;{arguments};{#20205}"
variables(#20210,"arguments",#20205)
isArgumentsObject(#20210)
#20211=*
stmts(#20211,1,#20203,-2,"{}")
#20212=@"loc,{#10000},3,41,3,42"
locations_default(#20212,#10000,3,41,3,42)
hasLocation(#20211,#20212)
stmtContainers(#20211,#20203)
#20213=*
stmts(#20213,2,#20001,2,"Point.p ... j = {};")
hasLocation(#20213,#20011)
stmtContainers(#20213,#20001)
literals("move","move",#20203)
#20204=*
exprs(#20204,9,#20195,1,"function(dx, dy) {}")
#20205=@"loc,{#10000},3,24,3,42"
locations_default(#20205,#10000,3,24,3,42)
hasLocation(#20204,#20205)
enclosingStmt(#20204,#20194)
exprContainers(#20204,#20001)
#20206=*
scopes(#20206,1)
scopenodes(#20204,#20206)
scopenesting(#20206,#20000)
#20207=@"var;{dx};{#20206}"
variables(#20207,"dx",#20206)
#20208=*
exprs(#20208,78,#20204,0,"dx")
hasLocation(#20208,#20072)
exprContainers(#20208,#20204)
literals("dx","dx",#20208)
decl(#20208,#20207)
#20209=@"var;{dy};{#20206}"
variables(#20209,"dy",#20206)
#20210=*
exprs(#20210,78,#20204,1,"dy")
hasLocation(#20210,#20076)
exprContainers(#20210,#20204)
literals("dy","dy",#20210)
decl(#20210,#20209)
#20211=@"var;{arguments};{#20206}"
variables(#20211,"arguments",#20206)
isArgumentsObject(#20211)
#20212=*
stmts(#20212,1,#20204,-2,"{}")
#20213=@"loc,{#10000},3,41,3,42"
locations_default(#20213,#10000,3,41,3,42)
hasLocation(#20212,#20213)
stmtContainers(#20212,#20204)
#20214=*
exprs(#20214,47,#20213,0,"Point.p ... bj = {}")
#20215=@"loc,{#10000},4,1,4,24"
locations_default(#20215,#10000,4,1,4,24)
hasLocation(#20214,#20215)
enclosingStmt(#20214,#20213)
exprContainers(#20214,#20001)
#20216=*
exprs(#20216,14,#20214,0,"Point.prototype.obj")
#20217=@"loc,{#10000},4,1,4,19"
locations_default(#20217,#10000,4,1,4,19)
hasLocation(#20216,#20217)
enclosingStmt(#20216,#20213)
exprContainers(#20216,#20001)
#20218=*
exprs(#20218,14,#20216,0,"Point.prototype")
#20219=@"loc,{#10000},4,1,4,15"
locations_default(#20219,#10000,4,1,4,15)
hasLocation(#20218,#20219)
enclosingStmt(#20218,#20213)
exprContainers(#20218,#20001)
#20220=*
exprs(#20220,79,#20218,0,"Point")
hasLocation(#20220,#20086)
enclosingStmt(#20220,#20213)
exprContainers(#20220,#20001)
literals("Point","Point",#20220)
bind(#20220,#20180)
stmts(#20214,2,#20001,2,"Point.p ... j = {};")
hasLocation(#20214,#20011)
stmtContainers(#20214,#20001)
#20215=*
exprs(#20215,47,#20214,0,"Point.p ... bj = {}")
#20216=@"loc,{#10000},4,1,4,24"
locations_default(#20216,#10000,4,1,4,24)
hasLocation(#20215,#20216)
enclosingStmt(#20215,#20214)
exprContainers(#20215,#20001)
#20217=*
exprs(#20217,14,#20215,0,"Point.prototype.obj")
#20218=@"loc,{#10000},4,1,4,19"
locations_default(#20218,#10000,4,1,4,19)
hasLocation(#20217,#20218)
enclosingStmt(#20217,#20214)
exprContainers(#20217,#20001)
#20219=*
exprs(#20219,14,#20217,0,"Point.prototype")
#20220=@"loc,{#10000},4,1,4,15"
locations_default(#20220,#10000,4,1,4,15)
hasLocation(#20219,#20220)
enclosingStmt(#20219,#20214)
exprContainers(#20219,#20001)
#20221=*
exprs(#20221,0,#20218,1,"prototype")
hasLocation(#20221,#20090)
enclosingStmt(#20221,#20213)
exprs(#20221,79,#20219,0,"Point")
hasLocation(#20221,#20086)
enclosingStmt(#20221,#20214)
exprContainers(#20221,#20001)
literals("prototype","prototype",#20221)
literals("Point","Point",#20221)
bind(#20221,#20181)
#20222=*
exprs(#20222,0,#20216,1,"obj")
hasLocation(#20222,#20094)
enclosingStmt(#20222,#20213)
exprs(#20222,0,#20219,1,"prototype")
hasLocation(#20222,#20090)
enclosingStmt(#20222,#20214)
exprContainers(#20222,#20001)
literals("obj","obj",#20222)
literals("prototype","prototype",#20222)
#20223=*
exprs(#20223,8,#20214,1,"{}")
#20224=@"loc,{#10000},4,23,4,24"
locations_default(#20224,#10000,4,23,4,24)
hasLocation(#20223,#20224)
enclosingStmt(#20223,#20213)
exprs(#20223,0,#20217,1,"obj")
hasLocation(#20223,#20094)
enclosingStmt(#20223,#20214)
exprContainers(#20223,#20001)
#20225=*
stmts(#20225,2,#20001,3,"Point.p ... secret;")
hasLocation(#20225,#20013)
stmtContainers(#20225,#20001)
literals("obj","obj",#20223)
#20224=*
exprs(#20224,8,#20215,1,"{}")
#20225=@"loc,{#10000},4,23,4,24"
locations_default(#20225,#10000,4,23,4,24)
hasLocation(#20224,#20225)
enclosingStmt(#20224,#20214)
exprContainers(#20224,#20001)
#20226=*
exprs(#20226,14,#20225,0,"Point.p ... .secret")
#20227=@"loc,{#10000},5,1,5,22"
locations_default(#20227,#10000,5,1,5,22)
hasLocation(#20226,#20227)
enclosingStmt(#20226,#20225)
exprContainers(#20226,#20001)
#20228=*
exprs(#20228,14,#20226,0,"Point.prototype")
#20229=@"loc,{#10000},5,1,5,15"
locations_default(#20229,#10000,5,1,5,15)
hasLocation(#20228,#20229)
enclosingStmt(#20228,#20225)
exprContainers(#20228,#20001)
#20230=*
exprs(#20230,79,#20228,0,"Point")
hasLocation(#20230,#20104)
enclosingStmt(#20230,#20225)
exprContainers(#20230,#20001)
literals("Point","Point",#20230)
bind(#20230,#20180)
stmts(#20226,2,#20001,3,"Point.p ... secret;")
hasLocation(#20226,#20013)
stmtContainers(#20226,#20001)
#20227=*
exprs(#20227,14,#20226,0,"Point.p ... .secret")
#20228=@"loc,{#10000},5,1,5,22"
locations_default(#20228,#10000,5,1,5,22)
hasLocation(#20227,#20228)
enclosingStmt(#20227,#20226)
exprContainers(#20227,#20001)
#20229=*
exprs(#20229,14,#20227,0,"Point.prototype")
#20230=@"loc,{#10000},5,1,5,15"
locations_default(#20230,#10000,5,1,5,15)
hasLocation(#20229,#20230)
enclosingStmt(#20229,#20226)
exprContainers(#20229,#20001)
#20231=*
exprs(#20231,0,#20228,1,"prototype")
hasLocation(#20231,#20108)
enclosingStmt(#20231,#20225)
exprs(#20231,79,#20229,0,"Point")
hasLocation(#20231,#20104)
enclosingStmt(#20231,#20226)
exprContainers(#20231,#20001)
literals("prototype","prototype",#20231)
literals("Point","Point",#20231)
bind(#20231,#20181)
#20232=*
exprs(#20232,0,#20226,1,"secret")
hasLocation(#20232,#20112)
enclosingStmt(#20232,#20225)
exprs(#20232,0,#20229,1,"prototype")
hasLocation(#20232,#20108)
enclosingStmt(#20232,#20226)
exprContainers(#20232,#20001)
literals("secret","secret",#20232)
literals("prototype","prototype",#20232)
#20233=*
stmts(#20233,2,#20001,4,"Point.ORIGIN;")
hasLocation(#20233,#20017)
stmtContainers(#20233,#20001)
exprs(#20233,0,#20227,1,"secret")
hasLocation(#20233,#20112)
enclosingStmt(#20233,#20226)
exprContainers(#20233,#20001)
literals("secret","secret",#20233)
#20234=*
exprs(#20234,14,#20233,0,"Point.ORIGIN")
#20235=@"loc,{#10000},7,1,7,12"
locations_default(#20235,#10000,7,1,7,12)
hasLocation(#20234,#20235)
enclosingStmt(#20234,#20233)
exprContainers(#20234,#20001)
#20236=*
exprs(#20236,79,#20234,0,"Point")
hasLocation(#20236,#20116)
enclosingStmt(#20236,#20233)
exprContainers(#20236,#20001)
literals("Point","Point",#20236)
bind(#20236,#20180)
stmts(#20234,2,#20001,4,"Point.ORIGIN;")
hasLocation(#20234,#20017)
stmtContainers(#20234,#20001)
#20235=*
exprs(#20235,14,#20234,0,"Point.ORIGIN")
#20236=@"loc,{#10000},7,1,7,12"
locations_default(#20236,#10000,7,1,7,12)
hasLocation(#20235,#20236)
enclosingStmt(#20235,#20234)
exprContainers(#20235,#20001)
#20237=*
exprs(#20237,0,#20234,1,"ORIGIN")
hasLocation(#20237,#20120)
enclosingStmt(#20237,#20233)
exprs(#20237,79,#20235,0,"Point")
hasLocation(#20237,#20116)
enclosingStmt(#20237,#20234)
exprContainers(#20237,#20001)
literals("ORIGIN","ORIGIN",#20237)
literals("Point","Point",#20237)
bind(#20237,#20181)
#20238=*
stmts(#20238,2,#20001,5,"Point.f ... n() {};")
hasLocation(#20238,#20019)
stmtContainers(#20238,#20001)
exprs(#20238,0,#20235,1,"ORIGIN")
hasLocation(#20238,#20120)
enclosingStmt(#20238,#20234)
exprContainers(#20238,#20001)
literals("ORIGIN","ORIGIN",#20238)
#20239=*
exprs(#20239,47,#20238,0,"Point.f ... on() {}")
#20240=@"loc,{#10000},8,1,8,25"
locations_default(#20240,#10000,8,1,8,25)
hasLocation(#20239,#20240)
enclosingStmt(#20239,#20238)
exprContainers(#20239,#20001)
#20241=*
exprs(#20241,14,#20239,0,"Point.foo")
#20242=@"loc,{#10000},8,1,8,9"
locations_default(#20242,#10000,8,1,8,9)
hasLocation(#20241,#20242)
enclosingStmt(#20241,#20238)
exprContainers(#20241,#20001)
#20243=*
exprs(#20243,79,#20241,0,"Point")
hasLocation(#20243,#20124)
enclosingStmt(#20243,#20238)
exprContainers(#20243,#20001)
literals("Point","Point",#20243)
bind(#20243,#20180)
stmts(#20239,2,#20001,5,"Point.f ... n() {};")
hasLocation(#20239,#20019)
stmtContainers(#20239,#20001)
#20240=*
exprs(#20240,47,#20239,0,"Point.f ... on() {}")
#20241=@"loc,{#10000},8,1,8,25"
locations_default(#20241,#10000,8,1,8,25)
hasLocation(#20240,#20241)
enclosingStmt(#20240,#20239)
exprContainers(#20240,#20001)
#20242=*
exprs(#20242,14,#20240,0,"Point.foo")
#20243=@"loc,{#10000},8,1,8,9"
locations_default(#20243,#10000,8,1,8,9)
hasLocation(#20242,#20243)
enclosingStmt(#20242,#20239)
exprContainers(#20242,#20001)
#20244=*
exprs(#20244,0,#20241,1,"foo")
hasLocation(#20244,#20128)
enclosingStmt(#20244,#20238)
exprs(#20244,79,#20242,0,"Point")
hasLocation(#20244,#20124)
enclosingStmt(#20244,#20239)
exprContainers(#20244,#20001)
literals("foo","foo",#20244)
literals("Point","Point",#20244)
bind(#20244,#20181)
#20245=*
exprs(#20245,9,#20239,1,"function() {}")
#20246=@"loc,{#10000},8,13,8,25"
locations_default(#20246,#10000,8,13,8,25)
hasLocation(#20245,#20246)
enclosingStmt(#20245,#20238)
exprs(#20245,0,#20242,1,"foo")
hasLocation(#20245,#20128)
enclosingStmt(#20245,#20239)
exprContainers(#20245,#20001)
#20247=*
scopes(#20247,1)
scopenodes(#20245,#20247)
scopenesting(#20247,#20000)
#20248=@"var;{arguments};{#20247}"
variables(#20248,"arguments",#20247)
isArgumentsObject(#20248)
#20249=*
stmts(#20249,1,#20245,-2,"{}")
#20250=@"loc,{#10000},8,24,8,25"
locations_default(#20250,#10000,8,24,8,25)
hasLocation(#20249,#20250)
stmtContainers(#20249,#20245)
#20251=*
stmts(#20251,18,#20001,6,"var someGlobal;")
hasLocation(#20251,#20023)
stmtContainers(#20251,#20001)
literals("foo","foo",#20245)
#20246=*
exprs(#20246,9,#20240,1,"function() {}")
#20247=@"loc,{#10000},8,13,8,25"
locations_default(#20247,#10000,8,13,8,25)
hasLocation(#20246,#20247)
enclosingStmt(#20246,#20239)
exprContainers(#20246,#20001)
#20248=*
scopes(#20248,1)
scopenodes(#20246,#20248)
scopenesting(#20248,#20000)
#20249=@"var;{arguments};{#20248}"
variables(#20249,"arguments",#20248)
isArgumentsObject(#20249)
#20250=*
stmts(#20250,1,#20246,-2,"{}")
#20251=@"loc,{#10000},8,24,8,25"
locations_default(#20251,#10000,8,24,8,25)
hasLocation(#20250,#20251)
stmtContainers(#20250,#20246)
#20252=*
exprs(#20252,64,#20251,0,"someGlobal")
hasLocation(#20252,#20146)
enclosingStmt(#20252,#20251)
exprContainers(#20252,#20001)
stmts(#20252,18,#20001,6,"var someGlobal;")
hasLocation(#20252,#20023)
stmtContainers(#20252,#20001)
#20253=*
exprs(#20253,78,#20252,0,"someGlobal")
exprs(#20253,64,#20252,0,"someGlobal")
hasLocation(#20253,#20146)
enclosingStmt(#20253,#20251)
enclosingStmt(#20253,#20252)
exprContainers(#20253,#20001)
literals("someGlobal","someGlobal",#20253)
decl(#20253,#20181)
#20254=*
stmts(#20254,18,#20001,7,"var MyString;")
hasLocation(#20254,#20028)
stmtContainers(#20254,#20001)
exprs(#20254,78,#20253,0,"someGlobal")
hasLocation(#20254,#20146)
enclosingStmt(#20254,#20252)
exprContainers(#20254,#20001)
literals("someGlobal","someGlobal",#20254)
decl(#20254,#20182)
#20255=*
exprs(#20255,64,#20254,0,"MyString")
hasLocation(#20255,#20152)
enclosingStmt(#20255,#20254)
exprContainers(#20255,#20001)
stmts(#20255,18,#20001,7,"var MyString;")
hasLocation(#20255,#20028)
stmtContainers(#20255,#20001)
#20256=*
exprs(#20256,78,#20255,0,"MyString")
exprs(#20256,64,#20255,0,"MyString")
hasLocation(#20256,#20152)
enclosingStmt(#20256,#20254)
enclosingStmt(#20256,#20255)
exprContainers(#20256,#20001)
literals("MyString","MyString",#20256)
decl(#20256,#20182)
#20257=*
stmts(#20257,2,#20001,8,"Point.p ... inal'];")
hasLocation(#20257,#20032)
stmtContainers(#20257,#20001)
exprs(#20257,78,#20256,0,"MyString")
hasLocation(#20257,#20152)
enclosingStmt(#20257,#20255)
exprContainers(#20257,#20001)
literals("MyString","MyString",#20257)
decl(#20257,#20183)
#20258=*
exprs(#20258,15,#20257,0,"Point.p ... final']")
#20259=@"loc,{#10000},15,1,15,24"
locations_default(#20259,#10000,15,1,15,24)
hasLocation(#20258,#20259)
enclosingStmt(#20258,#20257)
exprContainers(#20258,#20001)
#20260=*
exprs(#20260,14,#20258,0,"Point.prototype")
#20261=@"loc,{#10000},15,1,15,15"
locations_default(#20261,#10000,15,1,15,15)
hasLocation(#20260,#20261)
enclosingStmt(#20260,#20257)
exprContainers(#20260,#20001)
#20262=*
exprs(#20262,79,#20260,0,"Point")
hasLocation(#20262,#20156)
enclosingStmt(#20262,#20257)
exprContainers(#20262,#20001)
literals("Point","Point",#20262)
bind(#20262,#20180)
stmts(#20258,2,#20001,8,"Point.p ... inal'];")
hasLocation(#20258,#20032)
stmtContainers(#20258,#20001)
#20259=*
exprs(#20259,15,#20258,0,"Point.p ... final']")
#20260=@"loc,{#10000},15,1,15,24"
locations_default(#20260,#10000,15,1,15,24)
hasLocation(#20259,#20260)
enclosingStmt(#20259,#20258)
exprContainers(#20259,#20001)
#20261=*
exprs(#20261,14,#20259,0,"Point.prototype")
#20262=@"loc,{#10000},15,1,15,15"
locations_default(#20262,#10000,15,1,15,15)
hasLocation(#20261,#20262)
enclosingStmt(#20261,#20258)
exprContainers(#20261,#20001)
#20263=*
exprs(#20263,0,#20260,1,"prototype")
hasLocation(#20263,#20160)
enclosingStmt(#20263,#20257)
exprs(#20263,79,#20261,0,"Point")
hasLocation(#20263,#20156)
enclosingStmt(#20263,#20258)
exprContainers(#20263,#20001)
literals("prototype","prototype",#20263)
literals("Point","Point",#20263)
bind(#20263,#20181)
#20264=*
exprs(#20264,4,#20258,1,"'final'")
hasLocation(#20264,#20164)
enclosingStmt(#20264,#20257)
exprs(#20264,0,#20261,1,"prototype")
hasLocation(#20264,#20160)
enclosingStmt(#20264,#20258)
exprContainers(#20264,#20001)
literals("final","'final'",#20264)
literals("prototype","prototype",#20264)
#20265=*
stmts(#20265,2,#20001,9,"'use strict';")
hasLocation(#20265,#20036)
stmtContainers(#20265,#20001)
exprs(#20265,4,#20259,1,"'final'")
hasLocation(#20265,#20164)
enclosingStmt(#20265,#20258)
exprContainers(#20265,#20001)
literals("final","'final'",#20265)
#20266=*
exprs(#20266,4,#20265,0,"'use strict'")
hasLocation(#20266,#20170)
enclosingStmt(#20266,#20265)
exprContainers(#20266,#20001)
literals("use strict","'use strict'",#20266)
stmts(#20266,2,#20001,9,"'use strict';")
hasLocation(#20266,#20036)
stmtContainers(#20266,#20001)
#20267=*
entry_cfg_node(#20267,#20001)
#20268=@"loc,{#10000},1,1,1,0"
locations_default(#20268,#10000,1,1,1,0)
hasLocation(#20267,#20268)
#20269=*
exit_cfg_node(#20269,#20001)
hasLocation(#20269,#20174)
successor(#20265,#20266)
successor(#20266,#20269)
successor(#20257,#20262)
successor(#20264,#20258)
successor(#20263,#20260)
successor(#20262,#20263)
successor(#20260,#20264)
successor(#20258,#20265)
successor(#20254,#20256)
successor(#20256,#20255)
successor(#20255,#20257)
successor(#20251,#20253)
successor(#20253,#20252)
successor(#20252,#20254)
successor(#20238,#20243)
successor(#20245,#20239)
exprs(#20267,4,#20266,0,"'use strict'")
hasLocation(#20267,#20170)
enclosingStmt(#20267,#20266)
exprContainers(#20267,#20001)
literals("use strict","'use strict'",#20267)
#20268=*
entry_cfg_node(#20268,#20001)
#20269=@"loc,{#10000},1,1,1,0"
locations_default(#20269,#10000,1,1,1,0)
hasLocation(#20268,#20269)
#20270=*
entry_cfg_node(#20270,#20245)
#20271=@"loc,{#10000},8,13,8,12"
locations_default(#20271,#10000,8,13,8,12)
hasLocation(#20270,#20271)
#20272=*
exit_cfg_node(#20272,#20245)
#20273=@"loc,{#10000},8,26,8,25"
locations_default(#20273,#10000,8,26,8,25)
hasLocation(#20272,#20273)
successor(#20249,#20272)
successor(#20270,#20249)
successor(#20244,#20241)
successor(#20243,#20244)
successor(#20241,#20245)
successor(#20239,#20251)
successor(#20233,#20236)
successor(#20237,#20234)
successor(#20236,#20237)
successor(#20234,#20238)
successor(#20225,#20230)
successor(#20232,#20226)
successor(#20231,#20228)
successor(#20230,#20231)
successor(#20228,#20232)
successor(#20226,#20233)
successor(#20213,#20220)
successor(#20223,#20214)
successor(#20222,#20216)
successor(#20221,#20218)
successor(#20220,#20221)
successor(#20218,#20222)
successor(#20216,#20223)
successor(#20214,#20225)
successor(#20193,#20200)
successor(#20203,#20194)
#20274=*
entry_cfg_node(#20274,#20203)
#20275=@"loc,{#10000},3,24,3,23"
locations_default(#20275,#10000,3,24,3,23)
hasLocation(#20274,#20275)
#20276=*
exit_cfg_node(#20276,#20203)
#20277=@"loc,{#10000},3,43,3,42"
locations_default(#20277,#10000,3,43,3,42)
hasLocation(#20276,#20277)
successor(#20211,#20276)
successor(#20209,#20211)
successor(#20207,#20209)
successor(#20274,#20207)
successor(#20202,#20196)
successor(#20201,#20198)
successor(#20200,#20201)
successor(#20198,#20202)
successor(#20196,#20203)
successor(#20194,#20213)
successor(#20183,#20193)
#20278=*
entry_cfg_node(#20278,#20183)
hasLocation(#20278,#20268)
exit_cfg_node(#20270,#20001)
hasLocation(#20270,#20174)
successor(#20266,#20267)
successor(#20267,#20270)
successor(#20258,#20263)
successor(#20265,#20259)
successor(#20264,#20261)
successor(#20263,#20264)
successor(#20261,#20265)
successor(#20259,#20266)
successor(#20255,#20257)
successor(#20257,#20256)
successor(#20256,#20258)
successor(#20252,#20254)
successor(#20254,#20253)
successor(#20253,#20255)
successor(#20239,#20244)
successor(#20246,#20240)
#20271=*
entry_cfg_node(#20271,#20246)
#20272=@"loc,{#10000},8,13,8,12"
locations_default(#20272,#10000,8,13,8,12)
hasLocation(#20271,#20272)
#20273=*
exit_cfg_node(#20273,#20246)
#20274=@"loc,{#10000},8,26,8,25"
locations_default(#20274,#10000,8,26,8,25)
hasLocation(#20273,#20274)
successor(#20250,#20273)
successor(#20271,#20250)
successor(#20245,#20242)
successor(#20244,#20245)
successor(#20242,#20246)
successor(#20240,#20252)
successor(#20234,#20237)
successor(#20238,#20235)
successor(#20237,#20238)
successor(#20235,#20239)
successor(#20226,#20231)
successor(#20233,#20227)
successor(#20232,#20229)
successor(#20231,#20232)
successor(#20229,#20233)
successor(#20227,#20234)
successor(#20214,#20221)
successor(#20224,#20215)
successor(#20223,#20217)
successor(#20222,#20219)
successor(#20221,#20222)
successor(#20219,#20223)
successor(#20217,#20224)
successor(#20215,#20226)
successor(#20194,#20201)
successor(#20204,#20195)
#20275=*
entry_cfg_node(#20275,#20204)
#20276=@"loc,{#10000},3,24,3,23"
locations_default(#20276,#10000,3,24,3,23)
hasLocation(#20275,#20276)
#20277=*
exit_cfg_node(#20277,#20204)
#20278=@"loc,{#10000},3,43,3,42"
locations_default(#20278,#10000,3,43,3,42)
hasLocation(#20277,#20278)
successor(#20212,#20277)
successor(#20210,#20212)
successor(#20208,#20210)
successor(#20275,#20208)
successor(#20203,#20197)
successor(#20202,#20199)
successor(#20201,#20202)
successor(#20199,#20203)
successor(#20197,#20204)
successor(#20195,#20214)
successor(#20184,#20194)
#20279=*
exit_cfg_node(#20279,#20183)
#20280=@"loc,{#10000},1,24,1,23"
locations_default(#20280,#10000,1,24,1,23)
hasLocation(#20279,#20280)
successor(#20191,#20279)
successor(#20189,#20191)
successor(#20187,#20189)
successor(#20278,#20187)
successor(#20184,#20183)
successor(#20267,#20184)
entry_cfg_node(#20279,#20184)
hasLocation(#20279,#20269)
#20280=*
exit_cfg_node(#20280,#20184)
#20281=@"loc,{#10000},1,24,1,23"
locations_default(#20281,#10000,1,24,1,23)
hasLocation(#20280,#20281)
successor(#20192,#20280)
successor(#20190,#20192)
successor(#20188,#20190)
successor(#20279,#20188)
successor(#20185,#20184)
successor(#20268,#20185)
isExterns(#20001)
numlines(#10000,17,10,1)
filetype(#10000,"javascript")

View File

@@ -3,7 +3,6 @@
*/
import Customizations
import semmle.javascript.Aliases
import semmle.javascript.AMD
import semmle.javascript.AST
@@ -49,6 +48,7 @@ import semmle.javascript.StringConcatenation
import semmle.javascript.StringOps
import semmle.javascript.Templates
import semmle.javascript.Tokens
import semmle.javascript.TypeAnnotations
import semmle.javascript.TypeScript
import semmle.javascript.Util
import semmle.javascript.Variables

View File

@@ -551,7 +551,11 @@ class SetterMethodSignature extends SetterMethodDeclaration, AccessorMethodSigna
*/
class FieldDeclaration extends MemberDeclaration, @field {
/** Gets the type annotation of this field, if any, such as `T` in `{ x: T }`. */
TypeExpr getTypeAnnotation() { result = getChildTypeExpr(2) }
TypeAnnotation getTypeAnnotation() {
result = getChildTypeExpr(2)
or
result = getDocumentation().getATagByTitle("type").getType()
}
/** Holds if this is a TypeScript field annotated with the `readonly` keyword. */
predicate isReadonly() { hasReadonlyKeyword(this) }
@@ -591,7 +595,7 @@ class ParameterField extends FieldDeclaration, @parameter_field {
override Expr getNameExpr() { result = getParameter() }
override TypeExpr getTypeAnnotation() { result = getParameter().getTypeAnnotation() }
override TypeAnnotation getTypeAnnotation() { result = getParameter().getTypeAnnotation() }
}
/**

View File

@@ -38,7 +38,11 @@ class Function extends @function, Parameterized, TypeParameterized, StmtContaine
*
* `this` parameter types are specific to TypeScript.
*/
TypeExpr getThisTypeAnnotation() { result = getChildTypeExpr(-4) }
TypeAnnotation getThisTypeAnnotation() {
result = getChildTypeExpr(-4)
or
result = getDocumentation().getATagByTitle("this").getType()
}
/** Gets the identifier specifying the name of this function, if any. */
VarDecl getId() { result = getChildExpr(-1) }
@@ -76,7 +80,13 @@ class Function extends @function, Parameterized, TypeParameterized, StmtContaine
int getNumBodyStmt() { result = count(getABodyStmt()) }
/** Gets the return type annotation on this function, if any. */
TypeExpr getReturnTypeAnnotation() { typeexprs(result, _, this, -3, _) }
TypeAnnotation getReturnTypeAnnotation() {
typeexprs(result, _, this, -3, _)
or
exists(string title | title = "return" or title = "returns" |
result = getDocumentation().getATagByTitle(title).getType()
)
}
/** Holds if this function is a generator function. */
predicate isGenerator() {
@@ -163,24 +173,24 @@ class Function extends @function, Parameterized, TypeParameterized, StmtContaine
result = getAReturnStmt().getExpr()
}
/**
/**
* Gets a return from a function which has undefined value (that is, implicit
* returns and returns without expressions).
*
* Functions can have undefined returns in a few different ways:
*
*
* 1. An explicit return statement with no expression (the statement `return;`)
*
*
* 2. An implicit return resulting from an expression executing as the last thing
* in the function. For example, the test in a final `if` statement:
*
*
* ```
* function foo() {
* ...
* if (test) { return 1; }
* }
* ```
*
*
* Some things look like they might return undefined but actually don't because
* the containing functioning doesn't return at all. For instance, `throw`
* statements prevent the containing function from returning, so they don't count
@@ -189,13 +199,12 @@ class Function extends @function, Parameterized, TypeParameterized, StmtContaine
* exclude yields entirely. Likewise, we exclude generator functions from
* consideration, as well as asynchronous functions, since calls to both produce
* something distinct from what's explicitly returned by the function.
*
*
* Despite the fact that yield expressions are invalid outside of generators, we
* include them anyway just to ensure that we're not relying on a perfect analysis
* of a function to be a generator, and instead are looking also explicitly at the
* return sites.
*/
ConcreteControlFlowNode getAnUndefinedReturn() {
not this.getBody() instanceof Expr and
not this.isGenerator() and
@@ -206,7 +215,7 @@ class Function extends @function, Parameterized, TypeParameterized, StmtContaine
result.getContainer() = this and
result.isAFinalNode()
}
/**
* Gets the function whose `this` binding a `this` expression in this function refers to,
* which is the nearest enclosing non-arrow function.

View File

@@ -17,6 +17,12 @@ class JSDoc extends @jsdoc, Locatable {
/** Gets a JSDoc tag within this JSDoc comment. */
JSDocTag getATag() { result.getParent() = this }
/** Gets a JSDoc tag within this JSDoc comment with the given title. */
JSDocTag getATagByTitle(string title) {
result = getATag() and
result.getTitle() = title
}
override string toString() { result = getComment().toString() }
}
@@ -33,17 +39,16 @@ abstract class Documentable extends ASTNode {
* A syntactic element that a JSDoc type expression may be nested in, that is,
* either a JSDoc tag or another JSDoc type expression.
*/
class JSDocTypeExprParent extends @jsdoc_type_expr_parent {
/** Gets a textual representation of this element. */
string toString() { none() }
class JSDocTypeExprParent extends @jsdoc_type_expr_parent, Locatable {
override Location getLocation() { hasLocation(this, result) }
JSDoc getJSDocComment() { none() }
}
/**
* A JSDoc tag such as `@param Object options An object literal with options.`
*/
class JSDocTag extends @jsdoc_tag, JSDocTypeExprParent, Locatable {
override Location getLocation() { hasLocation(this, result) }
class JSDocTag extends @jsdoc_tag, JSDocTypeExprParent {
/** Gets the tag title; for instance, the title of a `@param` tag is `"param"`. */
string getTitle() { jsdoc_tags(this, result, _, _, _) }
@@ -77,6 +82,10 @@ class JSDocTag extends @jsdoc_tag, JSDocTypeExprParent, Locatable {
/** Gets the toplevel in which this tag appears. */
TopLevel getTopLevel() { result = getParent().getComment().getTopLevel() }
override JSDoc getJSDocComment() {
result.getATag() = this
}
}
/**
@@ -96,7 +105,7 @@ class JSDocParamTag extends JSDocTag {
/**
* A JSDoc type expression.
*/
class JSDocTypeExpr extends @jsdoc_type_expr, JSDocTypeExprParent {
class JSDocTypeExpr extends @jsdoc_type_expr, JSDocTypeExprParent, TypeAnnotation {
/**
* Gets the syntactic element in which this type expression is nested, which may either
* be another type expression or a JSDoc tag.
@@ -117,27 +126,88 @@ class JSDocTypeExpr extends @jsdoc_type_expr, JSDocTypeExprParent {
JSDocTypeExpr getChild(int i) { jsdoc_type_exprs(result, _, this, i, _) }
override string toString() { jsdoc_type_exprs(this, _, _, _, result) }
override JSDoc getJSDocComment() {
result = getParent().getJSDocComment()
}
override Stmt getEnclosingStmt() {
result.getDocumentation() = getJSDocComment()
}
override StmtContainer getContainer() { result = getEnclosingStmt().getContainer() }
override Function getEnclosingFunction() { result = getContainer() }
override TopLevel getTopLevel() { result = getEnclosingStmt().getTopLevel() }
}
/** An `any` type expression `*`. */
class JSDocAnyTypeExpr extends @jsdoc_any_type_expr, JSDocTypeExpr { }
class JSDocAnyTypeExpr extends @jsdoc_any_type_expr, JSDocTypeExpr {
override predicate isAny() { any() }
}
/** A null type expression. */
class JSDocNullTypeExpr extends @jsdoc_null_type_expr, JSDocTypeExpr { }
class JSDocNullTypeExpr extends @jsdoc_null_type_expr, JSDocTypeExpr {
override predicate isNull() { any() }
}
/** A type expression representing the type of `undefined`. */
class JSDocUndefinedTypeExpr extends @jsdoc_undefined_type_expr, JSDocTypeExpr { }
class JSDocUndefinedTypeExpr extends @jsdoc_undefined_type_expr, JSDocTypeExpr {
override predicate isUndefined() { any() }
}
/** A type expression representing an unknown type `?`. */
class JSDocUnknownTypeExpr extends @jsdoc_unknown_type_expr, JSDocTypeExpr { }
class JSDocUnknownTypeExpr extends @jsdoc_unknown_type_expr, JSDocTypeExpr {
override predicate isUnknownKeyword() { any() }
}
/** A type expression representing the void type. */
class JSDocVoidTypeExpr extends @jsdoc_void_type_expr, JSDocTypeExpr { }
class JSDocVoidTypeExpr extends @jsdoc_void_type_expr, JSDocTypeExpr {
override predicate isVoid() { any() }
}
/** A type expression referring to a named type. */
class JSDocNamedTypeExpr extends @jsdoc_named_type_expr, JSDocTypeExpr {
/** Gets the name of the type the expression refers to. */
string getName() { result = toString() }
override predicate isString() { getName() = "string" }
override predicate isStringy() {
exists(string name | name = getName() |
name = "string" or
name = "String"
)
}
override predicate isNumber() { getName() = "number" }
override predicate isNumbery() {
exists(string name | name = getName() |
name = "number" or
name = "Number" or
name = "double" or
name = "Double" or
name = "int" or
name = "integer" or
name = "Integer"
)
}
override predicate isBoolean() { getName() = "boolean" }
override predicate isBooleany() {
getName() = "boolean" or
getName() = "Boolean" or
getName() = "bool"
}
override predicate isRawFunction() { getName() = "Function" }
override predicate hasQualifiedName(string globalName) {
globalName = getName()
}
}
/**
@@ -160,6 +230,10 @@ class JSDocAppliedTypeExpr extends @jsdoc_applied_type_expr, JSDocTypeExpr {
* For example, in `Array<string>`, `string` is the only argument type.
*/
JSDocTypeExpr getAnArgument() { result = getArgument(_) }
override predicate hasQualifiedName(string globalName) {
getHead().hasQualifiedName(globalName)
}
}
/**
@@ -171,6 +245,8 @@ class JSDocNullableTypeExpr extends @jsdoc_nullable_type_expr, JSDocTypeExpr {
/** Holds if the `?` operator of this type expression is written in prefix notation. */
predicate isPrefix() { jsdoc_prefix_qualifier(this) }
override JSDocTypeExpr getAnUnderlyingType() { result = getTypeExpr().getAnUnderlyingType() }
}
/**
@@ -182,6 +258,8 @@ class JSDocNonNullableTypeExpr extends @jsdoc_non_nullable_type_expr, JSDocTypeE
/** Holds if the `!` operator of this type expression is written in prefix notation. */
predicate isPrefix() { jsdoc_prefix_qualifier(this) }
override JSDocTypeExpr getAnUnderlyingType() { result = getTypeExpr().getAnUnderlyingType() }
}
/**
@@ -220,6 +298,8 @@ class JSDocArrayTypeExpr extends @jsdoc_array_type_expr, JSDocTypeExpr {
class JSDocUnionTypeExpr extends @jsdoc_union_type_expr, JSDocTypeExpr {
/** Gets one of the type alternatives of this union type. */
JSDocTypeExpr getAnAlternative() { result = getChild(_) }
override JSDocTypeExpr getAnUnderlyingType() { result = getAnAlternative().getAnUnderlyingType() }
}
/**
@@ -248,6 +328,8 @@ class JSDocFunctionTypeExpr extends @jsdoc_function_type_expr, JSDocTypeExpr {
class JSDocOptionalParameterTypeExpr extends @jsdoc_optional_type_expr, JSDocTypeExpr {
/** Gets the underlying type of this optional type. */
JSDocTypeExpr getUnderlyingType() { result = getChild(0) }
override JSDocTypeExpr getAnUnderlyingType() { result = getUnderlyingType().getAnUnderlyingType() }
}
/**

View File

@@ -0,0 +1,108 @@
/**
* Provides classes for reasoning about type annotations independently of dialect.
*/
import javascript
/**
* A type annotation, either in the form of a TypeScript type or a JSDoc comment.
*/
class TypeAnnotation extends @type_annotation, Locatable {
/** Holds if this is the `any` type. */
predicate isAny() { none() }
/** Holds if this is the `string` type. Does not hold for the (rarely used) `String` type. */
predicate isString() { none() }
/** Holds if this is the `string` or `String` type. */
predicate isStringy() { none() }
/** Holds if this is the `number` type. Does not hold for the (rarely used) `Number` type. */
predicate isNumber() { none() }
/** Holds if this is the `number` or `Number`s type. */
predicate isNumbery() { none() }
/** Holds if this is the `boolean` type. Does not hold for the (rarely used) `Boolean` type. */
predicate isBoolean() { none() }
/** Holds if this is the `boolean` or `Boolean` type. */
predicate isBooleany() { none() }
/** Holds if this is the `undefined` type. */
predicate isUndefined() { none() }
/** Holds if this is the `null` type. */
predicate isNull() { none() }
/** Holds if this is the `void` type. */
predicate isVoid() { none() }
/** Holds if this is the `never` type, or an equivalent type representing the empty set of values. */
predicate isNever() { none() }
/** Holds if this is the `this` type. */
predicate isThis() { none() }
/** Holds if this is the `symbol` type. */
predicate isSymbol() { none() }
/** Holds if this is the `unique symbol` type. */
predicate isUniqueSymbol() { none() }
/** Holds if this is the `Function` type. */
predicate isRawFunction() { none() }
/** Holds if this is the `object` type. */
predicate isObjectKeyword() { none() }
/** Holds if this is the `unknown` type. */
predicate isUnknownKeyword() { none() }
/** Holds if this is the `bigint` type. */
predicate isBigInt() { none() }
/** Holds if this is the `const` keyword, occurring in a type assertion such as `x as const`. */
predicate isConstKeyword() { none() }
/**
* Repeatedly unfolds unions, intersections, parentheses, and nullability/readonly modifiers and gets any of the underlying types,
* or this type itself if it cannot be unfolded.
*
* Note that this only unfolds the syntax of the type annotation. Type aliases are not followed to their definition.
*/
TypeAnnotation getAnUnderlyingType() { result = this }
/**
* Holds if this is a reference to the type with qualified name `globalName` relative to the global scope.
*/
predicate hasQualifiedName(string globalName) { none() }
/**
* Holds if this is a reference to the type exported from `moduleName` under the name `exportedName`.
*/
predicate hasQualifiedName(string moduleName, string exportedName) { none() }
/** Gets the statement in which this type appears. */
Stmt getEnclosingStmt() { none() }
/** Gets the function in which this type appears, if any. */
Function getEnclosingFunction() { none() }
/**
* Gets the statement container (function or toplevel) in which this type appears.
*/
StmtContainer getContainer() { none() }
/**
* Gets the top-level containing this type annotation.
*/
TopLevel getTopLevel() { none() }
/**
* Gets the static type denoted by this type annotation, if one is provided by the extractor.
*
* Note that this has no result for JSDoc type annotations.
*/
Type getType() { none() }
}

View File

@@ -528,69 +528,9 @@ class LocalNamespaceName extends @local_namespace_name, LexicalName {
* This class includes only explicit type annotations -
* types inferred by the TypeScript compiler are not type expressions.
*/
class TypeExpr extends ExprOrType, @typeexpr {
class TypeExpr extends ExprOrType, @typeexpr, TypeAnnotation {
override string toString() { typeexprs(this, _, _, _, result) }
/** Holds if this is the `any` type. */
predicate isAny() { none() }
/** Holds if this is the `string` type. Does not hold for the (rarely used) `String` type. */
predicate isString() { none() }
/** Holds if this is the `string` or `String` type. */
predicate isStringy() { none() }
/** Holds if this is the `number` type. Does not hold for the (rarely used) `Number` type. */
predicate isNumber() { none() }
/** Holds if this is the `number` or `Number`s type. */
predicate isNumbery() { none() }
/** Holds if this is the `boolean` type. Does not hold for the (rarely used) `Boolean` type. */
predicate isBoolean() { none() }
/** Holds if this is the `boolean` or `Boolean` type. */
predicate isBooleany() { none() }
/** Holds if this is the `undefined` type. */
predicate isUndefined() { none() }
/** Holds if this is the `null` type. */
predicate isNull() { none() }
/** Holds if this is the `void` type. */
predicate isVoid() { none() }
/** Holds if this is the `never` type. */
predicate isNever() { none() }
/** Holds if this is the `this` type. */
predicate isThis() { none() }
/** Holds if this is the `symbol` type. */
predicate isSymbol() { none() }
/** Holds if this is the `unique symbol` type. */
predicate isUniqueSymbol() { none() }
/** Holds if this is the `Function` type. */
predicate isRawFunction() { none() }
/** Holds if this is the `object` type. */
predicate isObjectKeyword() { none() }
/** Holds if this is the `unknown` type. */
predicate isUnknownKeyword() { none() }
/** Holds if this is the `bigint` type. */
predicate isBigInt() { none() }
/** Holds if this is the `const` keyword, occurring in a type assertion such as `x as const`. */
predicate isConstKeyword() { none() }
/** Gets this type expression, with any surrounding parentheses removed. */
override TypeExpr stripParens() { result = this }
override predicate isAmbient() { any() }
/**
@@ -599,7 +539,15 @@ class TypeExpr extends ExprOrType, @typeexpr {
* Has no result if this occurs in a TypeScript file that was extracted
* without type information.
*/
Type getType() { ast_node_type(this, result) }
override Type getType() { ast_node_type(this, result) }
override Stmt getEnclosingStmt() { result = ExprOrType.super.getEnclosingStmt() }
override Function getEnclosingFunction() { result = ExprOrType.super.getEnclosingFunction() }
override StmtContainer getContainer() { result = ExprOrType.super.getContainer() }
override TopLevel getTopLevel() { result = ExprOrType.super.getTopLevel() }
}
/**
@@ -716,6 +664,14 @@ class TypeAccess extends @typeaccess, TypeExpr, TypeRef {
* Gets the canonical name of the type being accessed.
*/
TypeName getTypeName() { ast_node_symbol(this, result) }
override predicate hasQualifiedName(string globalName) {
getTypeName().hasQualifiedName(globalName)
}
override predicate hasQualifiedName(string moduleName, string exportedName) {
getTypeName().hasQualifiedName(moduleName, exportedName)
}
}
/** An identifier that is used as part of a type, such as `Date`. */
@@ -776,6 +732,14 @@ class GenericTypeExpr extends @generictypeexpr, TypeExpr {
/** Gets the number of type arguments. This is always at least one. */
int getNumTypeArgument() { result = count(getATypeArgument()) }
override predicate hasQualifiedName(string globalName) {
getTypeAccess().hasQualifiedName(globalName)
}
override predicate hasQualifiedName(string moduleName, string exportedName) {
getTypeAccess().hasQualifiedName(moduleName, exportedName)
}
}
/**
@@ -846,6 +810,8 @@ class UnionTypeExpr extends @uniontypeexpr, TypeExpr {
/** Gets the number of types in the union. This is always at least two. */
int getNumElementType() { result = count(getAnElementType()) }
override TypeExpr getAnUnderlyingType() { result = getAnElementType().getAnUnderlyingType() }
}
/**
@@ -873,6 +839,8 @@ class IntersectionTypeExpr extends @intersectiontypeexpr, TypeExpr {
/** Gets the number of operands to the intersection type. This is always at least two. */
int getNumElementType() { result = count(getAnElementType()) }
override TypeExpr getAnUnderlyingType() { result = getAnElementType().getAnUnderlyingType() }
}
/**
@@ -883,6 +851,8 @@ class ParenthesizedTypeExpr extends @parenthesizedtypeexpr, TypeExpr {
TypeExpr getElementType() { result = getChildTypeExpr(0) }
override TypeExpr stripParens() { result = getElementType().stripParens() }
override TypeExpr getAnUnderlyingType() { result = getElementType().getAnUnderlyingType() }
}
/**
@@ -962,6 +932,8 @@ class IsTypeExpr extends @istypeexpr, TypeExpr {
class OptionalTypeExpr extends @optionaltypeexpr, TypeExpr {
/** Gets the type `T` in `T?` */
TypeExpr getElementType() { result = getChildTypeExpr(0) }
override TypeExpr getAnUnderlyingType() { result = getElementType().getAnUnderlyingType() }
}
/**
@@ -981,6 +953,8 @@ class RestTypeExpr extends @resttypeexpr, TypeExpr {
class ReadonlyTypeExpr extends @readonlytypeexpr, TypeExpr {
/** Gets the type `T` in `readonly T`. */
TypeExpr getElementType() { result = getChildTypeExpr(0) }
override TypeExpr getAnUnderlyingType() { result = getElementType().getAnUnderlyingType() }
}
/**

View File

@@ -326,7 +326,7 @@ class BindingPattern extends @pattern, Expr {
predicate isLValue() { any() }
/**
* Returns the TypeScript type annotation for this variable or pattern, if any.
* Returns the type annotation for this variable or pattern, if any.
*
* Only the outermost part of a binding pattern can have a type annotation.
* For instance, in the declaration,
@@ -336,7 +336,7 @@ class BindingPattern extends @pattern, Expr {
* the variable `x` has no type annotation, whereas the pattern `{x}` has the type
* annotation `Point`.
*/
TypeExpr getTypeAnnotation() {
TypeAnnotation getTypeAnnotation() {
exists(VariableDeclarator decl | decl.getBindingPattern() = this |
result = decl.getTypeAnnotation()
)
@@ -500,8 +500,12 @@ class VariableDeclarator extends Expr, @vardeclarator {
/** Gets the expression specifying the initial value of the declared variable(s), if any. */
Expr getInit() { result = this.getChildExpr(1) }
/** Gets the TypeScript type annotation for the declared variable or binding pattern. */
TypeExpr getTypeAnnotation() { result = this.getChildTypeExpr(2) }
/** Gets the type annotation for the declared variable or binding pattern. */
TypeAnnotation getTypeAnnotation() {
result = this.getChildTypeExpr(2)
or
result = getDeclStmt().getDocumentation().getATagByTitle("type").getType()
}
/** Holds if this is a TypeScript variable marked as definitely assigned with the `!` operator. */
predicate hasDefiniteAssignmentAssertion() { hasDefiniteAssignmentAssertion(this) }
@@ -569,8 +573,10 @@ class Parameter extends BindingPattern {
}
/** Gets the type annotation for this parameter, if any. */
override TypeExpr getTypeAnnotation() {
override TypeAnnotation getTypeAnnotation() {
exists(Function f, int n | this = f.getParameter(n) | result = f.getChildTypeExpr(-(4 * n + 6)))
or
result = getJSDocTag().getType()
}
/** Holds if this parameter is a rest parameter. */
@@ -619,12 +625,17 @@ class SimpleParameter extends Parameter, VarDecl {
)
}
override JSDocTag getJSDocTag() {
override JSDocParamTag getJSDocTag() {
exists(Function fun |
this = fun.getAParameter() and
result = fun.getDocumentation().getATag() and
result.getTitle() = "param" and
result.getName() = getName()
result = fun.getDocumentation().getATag()
) and
// Avoid joining on name
exists(string tagName, string paramName |
tagName = result.getName() and
paramName = this.getName() and
tagName <= paramName and
paramName <= tagName
)
}
}

View File

@@ -232,6 +232,7 @@ isDelegating (int yield: @yieldexpr ref);
@exprortype = @expr | @typeexpr;
@exprparent = @exprorstmt | @property | @functiontypeexpr;
@arraylike = @arrayexpr | @arraypattern;
@type_annotation = @typeexpr | @jsdoc_type_expr;
case @expr.kind of
0 = @label

View File

@@ -1,19 +1,19 @@
test_JSDocUnionTypeExpr
| (string\|number) | number |
| (string\|number) | string |
| (string\|number\|null) | null |
| (string\|number\|null) | number |
| (string\|number\|null) | string |
| (string\|undefined) | string |
| (string\|undefined) | undefined |
| tst.js:1:3:1:16 | (string\|number) | tst.js:1:9:1:9 | string |
| tst.js:1:3:1:16 | (string\|number) | tst.js:1:16:1:16 | number |
| tst.js:1:8:1:17 | (string\|undefined) | tst.js:1:8:1:8 | string |
| tst.js:1:8:1:17 | (string\|undefined) | tst.js:1:18:1:17 | undefined |
| tst.js:1:8:1:19 | (string\|number\|null) | tst.js:1:8:1:8 | string |
| tst.js:1:8:1:19 | (string\|number\|null) | tst.js:1:15:1:15 | number |
| tst.js:1:8:1:19 | (string\|number\|null) | tst.js:1:20:1:19 | null |
test_JSDocArrayTypeExpr
| [number] | 0 | number |
| tst.js:1:29:1:30 | [number] | 0 | tst.js:1:29:1:29 | number |
test_Parameter_getDocumentation
| tst.js:149:28:149:28 | a | tst.js:149:14:149:26 | /** number */ |
| tst.js:149:45:149:45 | b | tst.js:149:31:149:43 | /** number */ |
test_JSDocRestParameterTypeExpr
| ...[number] | [number] |
| ...number | number |
| tst.js:1:5:1:10 | ...number | tst.js:1:11:1:10 | number |
| tst.js:1:23:1:30 | ...[number] | tst.js:1:29:1:30 | [number] |
test_AssignExpr_getDocumentation
| tst.js:12:1:12:29 | mynames ... 'stout' | tst.js:7:1:11:3 | /**\\n * ... ng}\\n */ |
| tst.js:14:15:14:39 | MyClass ... 'stout' | tst.js:14:1:14:13 | /** @const */ |
@@ -47,8 +47,8 @@ test_AssignExpr_getDocumentation
| tst.js:336:1:336:24 | FooImpl ... n() { } | tst.js:331:1:335:3 | /**\\n * ... r>}\\n */ |
| tst.js:343:1:343:36 | identit ... rn a; } | tst.js:338:1:342:3 | /**\\n * ... e T\\n */ |
test_JSDocRecordTypeExpr
| {myNum: number, myObject} | myNum | number |
| {myNum: number, myObject} | myObject | (none) |
| tst.js:1:3:1:26 | {myNum: number, myObject} | myNum | number |
| tst.js:1:3:1:26 | {myNum: number, myObject} | myObject | (none) |
test_JSDoc
| tst.js:5:1:5:13 | /** @const */ | | tst.js:5:1:5:13 | /** @const */ |
| tst.js:7:1:11:3 | /**\\n * ... ng}\\n */ | My namespace's favorite kind of beer. | tst.js:7:1:11:3 | /**\\n * ... ng}\\n */ |
@@ -234,19 +234,19 @@ test_ObjectExpr_getDocumentation
| tst.js:117:43:119:9 | {\\n ... } | tst.js:117:9:117:40 | /** @le ... ype} */ |
| tst.js:192:27:192:36 | { x: 321 } | tst.js:192:12:192:25 | /** @struct */ |
test_JSDocFunctionTypeExpr
| function (?string=, number=) | (none) | (none) | 0 | ?string= | no |
| function (?string=, number=) | (none) | (none) | 1 | number= | no |
| function (new: goog.ui.Menu, string) | (none) | goog.ui.Menu | 0 | string | yes |
| function (string, ...[number]): number | number | (none) | 0 | string | no |
| function (string, ...[number]): number | number | (none) | 1 | ...[number] | no |
| function (string, boolean) | (none) | (none) | 0 | string | no |
| function (string, boolean) | (none) | (none) | 1 | boolean | no |
| function (this: goog.ui.Menu, string) | (none) | goog.ui.Menu | 0 | string | no |
| function (x: !number, y: !number): number | number | (none) | 0 | !number | no |
| function (x: !number, y: !number): number | number | (none) | 1 | !number | no |
| tst.js:1:10:1:26 | function (string, boolean) | (none) | (none) | 0 | tst.js:1:17:1:17 | string | no |
| tst.js:1:10:1:26 | function (string, boolean) | (none) | (none) | 1 | tst.js:1:26:1:26 | boolean | no |
| tst.js:1:10:1:28 | function (?string=, number=) | (none) | (none) | 0 | tst.js:1:12:1:19 | ?string= | no |
| tst.js:1:10:1:28 | function (?string=, number=) | (none) | (none) | 1 | tst.js:1:27:1:28 | number= | no |
| tst.js:1:10:1:35 | function (new: goog.ui.Menu, string) | (none) | goog.ui.Menu | 0 | tst.js:1:35:1:35 | string | yes |
| tst.js:1:10:1:36 | function (this: goog.ui.Menu, string) | (none) | goog.ui.Menu | 0 | tst.js:1:36:1:36 | string | no |
| tst.js:1:10:1:38 | function (string, ...[number]): number | number | (none) | 0 | tst.js:1:17:1:17 | string | no |
| tst.js:1:10:1:38 | function (string, ...[number]): number | number | (none) | 1 | tst.js:1:23:1:30 | ...[number] | no |
| tst.js:1:10:1:38 | function (x: !number, y: !number): number | number | (none) | 0 | tst.js:1:14:1:20 | !number | no |
| tst.js:1:10:1:38 | function (x: !number, y: !number): number | number | (none) | 1 | tst.js:1:25:1:31 | !number | no |
test_JSDocNullableTypeExpr
| ?string | string | prefix |
| number? | number | postfix |
| tst.js:1:8:1:8 | number? | tst.js:1:8:1:8 | number | postfix |
| tst.js:1:12:1:18 | ?string | tst.js:1:18:1:18 | string | prefix |
test_next_token
| tst.js:1:1:1:117 | // Test ... mpiler, | tst.js:5:15:5:17 | var |
| tst.js:2:1:2:118 | // whic ... se 2.0; | tst.js:5:15:5:17 | var |
@@ -340,127 +340,127 @@ test_next_token
| tst.js:375:3:377:5 | /**\\n ... p\\n */ | tst.js:378:3:378:13 | constructor |
| tst.js:380:3:382:5 | /**\\n ... p\\n */ | tst.js:383:3:383:13 | classMethod |
test_JSDocTypeExpr
| !Foo.<string> | @type | 0 |
| !Foo.<string> | @type | 0 |
| !Object | @type | 0 |
| !number | function (x: !number, y: !number): number | 0 |
| !number | function (x: !number, y: !number): number | 1 |
| (string\|number) | @typedef | 0 |
| (string\|number\|null) | @param | 0 |
| (string\|undefined) | @type | 0 |
| * | @param | 0 |
| ...[number] | function (string, ...[number]): number | 1 |
| ...number | @param | 0 |
| ? | @param | 0 |
| ?string | ?string= | 0 |
| ?string= | function (?string=, number=) | 0 |
| A | A.<U> | -1 |
| A | A.<string> | -1 |
| A.<U> | @extends | 0 |
| A.<string> | @extends | 0 |
| Array | Array.<Function> | -1 |
| Array | Array.<number> | -1 |
| Array.<Function> | @type | 0 |
| Array.<number> | @param | 0 |
| DOMException | @throws | 0 |
| Element | @param | 0 |
| Element | @return | 0 |
| Foo | Foo.<X> | -1 |
| Foo | Foo.<Y> | -1 |
| Foo | Foo.<Y> | -1 |
| Foo | Foo.<number> | -1 |
| Foo | Foo.<string> | -1 |
| Foo | Foo.<string> | -1 |
| Foo | Foo.<string> | -1 |
| Foo.<X> | @type | 0 |
| Foo.<Y> | @param | 0 |
| Foo.<Y> | @type | 0 |
| Foo.<number> | @implements | 0 |
| Foo.<string> | !Foo.<string> | 0 |
| Foo.<string> | !Foo.<string> | 0 |
| Foo.<string> | @implements | 0 |
| Function | Array.<Function> | 0 |
| MyMap | MyMap.<string, number> | -1 |
| MyMap.<string, number> | @type | 0 |
| Object | !Object | 0 |
| Object | @return | 0 |
| Shape | @extends | 0 |
| Shape | @implements | 0 |
| T | @param | 0 |
| T | @param | 0 |
| T | @param | 0 |
| T | @param | 0 |
| T | @return | 0 |
| T | @return | 0 |
| T | @return | 0 |
| T1 | @param | 0 |
| T2 | @param | 0 |
| T3 | @param | 0 |
| T4 | @param | 0 |
| U | A.<U> | 0 |
| X | @extends | 0 |
| X | Foo.<X> | 0 |
| Y | Foo.<Y> | 0 |
| Y | Foo.<Y> | 0 |
| [number] | ...[number] | 0 |
| boolean | @define | 0 |
| boolean | @define | 0 |
| boolean | @return | 0 |
| boolean | function (string, boolean) | 1 |
| function (): number | @param | 0 |
| function (?string=, number=) | @param | 0 |
| function (new: goog.ui.Menu, string) | @param | 0 |
| function (string, ...[number]): number | @param | 0 |
| function (string, boolean) | @param | 0 |
| function (this: goog.ui.Menu, string) | @param | 0 |
| function (x: !number, y: !number): number | @param | 0 |
| goog.NumberLike | @param | 0 |
| goog.ds.BasicNodeList | @extends | 0 |
| goog.ui.Menu | function (new: goog.ui.Menu, string) | -2 |
| goog.ui.Menu | function (this: goog.ui.Menu, string) | -2 |
| null | (string\|number\|null) | 2 |
| number | !number | 0 |
| number | !number | 0 |
| number | (string\|number) | 1 |
| number | (string\|number\|null) | 1 |
| number | ...number | 0 |
| number | @enum | 0 |
| number | @param | 0 |
| number | @type | 0 |
| number | @type | 0 |
| number | Array.<number> | 0 |
| number | Foo.<number> | 0 |
| number | MyMap.<string, number> | 1 |
| number | [number] | 0 |
| number | function (): number | -1 |
| number | function (string, ...[number]): number | -1 |
| number | function (x: !number, y: !number): number | -1 |
| number | number= | 0 |
| number | number= | 0 |
| number | number? | 0 |
| number | {myNum: number, myObject} | 0 |
| number= | @param | 0 |
| number= | function (?string=, number=) | 1 |
| number? | @type | 0 |
| string | (string\|number) | 0 |
| string | (string\|number\|null) | 0 |
| string | (string\|undefined) | 0 |
| string | ?string | 0 |
| string | @return | 0 |
| string | @type | 0 |
| string | @type | 0 |
| string | @type | 0 |
| string | A.<string> | 0 |
| string | Foo.<string> | 0 |
| string | Foo.<string> | 0 |
| string | Foo.<string> | 0 |
| string | MyMap.<string, number> | 0 |
| string | function (new: goog.ui.Menu, string) | 0 |
| string | function (string, ...[number]): number | 0 |
| string | function (string, boolean) | 0 |
| string | function (this: goog.ui.Menu, string) | 0 |
| undefined | (string\|undefined) | 1 |
| {myNum: number, myObject} | @type | 0 |
| tst.js:1:3:1:2 | * | tst.js:241:4:241:9 | @param | 0 |
| tst.js:1:3:1:2 | ? | tst.js:242:4:242:9 | @param | 0 |
| tst.js:1:3:1:2 | T | tst.js:252:5:252:11 | @return | 0 |
| tst.js:1:3:1:2 | T | tst.js:255:5:255:10 | @param | 0 |
| tst.js:1:3:1:2 | T | tst.js:262:4:262:9 | @param | 0 |
| tst.js:1:3:1:2 | T | tst.js:306:5:306:10 | @param | 0 |
| tst.js:1:3:1:2 | T | tst.js:328:5:328:11 | @return | 0 |
| tst.js:1:3:1:2 | T | tst.js:339:4:339:9 | @param | 0 |
| tst.js:1:3:1:2 | T | tst.js:340:4:340:10 | @return | 0 |
| tst.js:1:3:1:2 | X | tst.js:283:4:283:11 | @extends | 0 |
| tst.js:1:3:1:4 | A | tst.js:1:3:1:6 | A.<U> | -1 |
| tst.js:1:3:1:4 | A | tst.js:1:3:1:11 | A.<string> | -1 |
| tst.js:1:3:1:6 | A.<U> | tst.js:318:4:318:11 | @extends | 0 |
| tst.js:1:3:1:8 | !Object | tst.js:229:5:229:9 | @type | 0 |
| tst.js:1:3:1:11 | A.<string> | tst.js:311:4:311:11 | @extends | 0 |
| tst.js:1:3:1:14 | !Foo.<string> | tst.js:258:5:258:9 | @type | 0 |
| tst.js:1:3:1:14 | !Foo.<string> | tst.js:259:15:259:19 | @type | 0 |
| tst.js:1:3:1:16 | (string\|number) | tst.js:216:5:216:12 | @typedef | 0 |
| tst.js:1:3:1:26 | {myNum: number, myObject} | tst.js:223:5:223:9 | @type | 0 |
| tst.js:1:4:1:3 | T1 | tst.js:364:6:364:11 | @param | 0 |
| tst.js:1:4:1:3 | T2 | tst.js:369:6:369:11 | @param | 0 |
| tst.js:1:4:1:3 | T3 | tst.js:376:6:376:11 | @param | 0 |
| tst.js:1:4:1:3 | T4 | tst.js:381:6:381:11 | @param | 0 |
| tst.js:1:5:1:6 | Foo | tst.js:1:5:1:8 | Foo.<X> | -1 |
| tst.js:1:5:1:6 | Foo | tst.js:1:5:1:8 | Foo.<Y> | -1 |
| tst.js:1:5:1:6 | Foo | tst.js:1:5:1:8 | Foo.<Y> | -1 |
| tst.js:1:5:1:6 | Foo | tst.js:1:5:1:13 | Foo.<number> | -1 |
| tst.js:1:5:1:6 | Foo | tst.js:1:5:1:13 | Foo.<string> | -1 |
| tst.js:1:5:1:8 | Foo.<X> | tst.js:288:5:288:9 | @type | 0 |
| tst.js:1:5:1:8 | Foo.<Y> | tst.js:289:5:289:9 | @type | 0 |
| tst.js:1:5:1:8 | Foo.<Y> | tst.js:294:5:294:10 | @param | 0 |
| tst.js:1:5:1:10 | ...number | tst.js:238:4:238:9 | @param | 0 |
| tst.js:1:5:1:13 | Foo.<number> | tst.js:334:4:334:14 | @implements | 0 |
| tst.js:1:5:1:13 | Foo.<string> | tst.js:333:4:333:14 | @implements | 0 |
| tst.js:1:6:1:6 | U | tst.js:1:3:1:6 | A.<U> | 0 |
| tst.js:1:6:1:7 | Foo | tst.js:1:6:1:14 | Foo.<string> | -1 |
| tst.js:1:6:1:7 | Foo | tst.js:1:6:1:14 | Foo.<string> | -1 |
| tst.js:1:6:1:14 | Foo.<string> | tst.js:1:3:1:14 | !Foo.<string> | 0 |
| tst.js:1:6:1:14 | Foo.<string> | tst.js:1:3:1:14 | !Foo.<string> | 0 |
| tst.js:1:7:1:6 | Shape | tst.js:95:4:95:14 | @implements | 0 |
| tst.js:1:7:1:6 | Shape | tst.js:110:4:110:11 | @extends | 0 |
| tst.js:1:7:1:8 | Array | tst.js:1:7:1:15 | Array.<number> | -1 |
| tst.js:1:7:1:8 | MyMap | tst.js:1:7:1:23 | MyMap.<string, number> | -1 |
| tst.js:1:7:1:15 | Array.<number> | tst.js:357:4:357:9 | @param | 0 |
| tst.js:1:7:1:23 | MyMap.<string, number> | tst.js:275:5:275:9 | @type | 0 |
| tst.js:1:8:1:7 | Object | tst.js:134:4:134:10 | @return | 0 |
| tst.js:1:8:1:7 | number | tst.js:53:4:53:8 | @enum | 0 |
| tst.js:1:8:1:7 | number | tst.js:142:4:142:9 | @param | 0 |
| tst.js:1:8:1:7 | number | tst.js:346:5:346:9 | @type | 0 |
| tst.js:1:8:1:7 | number | tst.js:347:5:347:9 | @type | 0 |
| tst.js:1:8:1:7 | string | tst.js:10:4:10:8 | @type | 0 |
| tst.js:1:8:1:7 | string | tst.js:171:4:171:10 | @return | 0 |
| tst.js:1:8:1:7 | string | tst.js:212:4:212:8 | @type | 0 |
| tst.js:1:8:1:7 | string | tst.js:345:5:345:9 | @type | 0 |
| tst.js:1:8:1:8 | X | tst.js:1:5:1:8 | Foo.<X> | 0 |
| tst.js:1:8:1:8 | Y | tst.js:1:5:1:8 | Foo.<Y> | 0 |
| tst.js:1:8:1:8 | Y | tst.js:1:5:1:8 | Foo.<Y> | 0 |
| tst.js:1:8:1:8 | number | tst.js:1:8:1:8 | number= | 0 |
| tst.js:1:8:1:8 | number | tst.js:1:8:1:8 | number? | 0 |
| tst.js:1:8:1:8 | number= | tst.js:239:4:239:9 | @param | 0 |
| tst.js:1:8:1:8 | number? | tst.js:226:5:226:9 | @type | 0 |
| tst.js:1:8:1:8 | string | tst.js:1:8:1:17 | (string\|undefined) | 0 |
| tst.js:1:8:1:8 | string | tst.js:1:8:1:19 | (string\|number\|null) | 0 |
| tst.js:1:8:1:17 | (string\|undefined) | tst.js:349:5:349:9 | @type | 0 |
| tst.js:1:8:1:19 | (string\|number\|null) | tst.js:143:4:143:9 | @param | 0 |
| tst.js:1:9:1:8 | Element | tst.js:163:4:163:9 | @param | 0 |
| tst.js:1:9:1:8 | Element | tst.js:199:12:199:18 | @return | 0 |
| tst.js:1:9:1:8 | Object | tst.js:1:3:1:8 | !Object | 0 |
| tst.js:1:9:1:8 | boolean | tst.js:23:5:23:11 | @define | 0 |
| tst.js:1:9:1:8 | boolean | tst.js:26:5:26:11 | @define | 0 |
| tst.js:1:9:1:8 | boolean | tst.js:31:4:31:10 | @return | 0 |
| tst.js:1:9:1:9 | string | tst.js:1:3:1:16 | (string\|number) | 0 |
| tst.js:1:10:1:10 | Function | tst.js:1:10:1:11 | Array.<Function> | 0 |
| tst.js:1:10:1:11 | Array | tst.js:1:10:1:11 | Array.<Function> | -1 |
| tst.js:1:10:1:11 | Array.<Function> | tst.js:155:4:155:8 | @type | 0 |
| tst.js:1:10:1:19 | function (): number | tst.js:234:4:234:9 | @param | 0 |
| tst.js:1:10:1:26 | function (string, boolean) | tst.js:233:4:233:9 | @param | 0 |
| tst.js:1:10:1:28 | function (?string=, number=) | tst.js:240:4:240:9 | @param | 0 |
| tst.js:1:10:1:35 | function (new: goog.ui.Menu, string) | tst.js:236:4:236:9 | @param | 0 |
| tst.js:1:10:1:36 | function (this: goog.ui.Menu, string) | tst.js:235:4:235:9 | @param | 0 |
| tst.js:1:10:1:38 | function (string, ...[number]): number | tst.js:237:4:237:9 | @param | 0 |
| tst.js:1:10:1:38 | function (x: !number, y: !number): number | tst.js:358:4:358:9 | @param | 0 |
| tst.js:1:11:1:10 | number | tst.js:1:5:1:10 | ...number | 0 |
| tst.js:1:11:1:11 | string | tst.js:1:3:1:11 | A.<string> | 0 |
| tst.js:1:12:1:18 | ?string | tst.js:1:12:1:19 | ?string= | 0 |
| tst.js:1:12:1:19 | ?string= | tst.js:1:10:1:28 | function (?string=, number=) | 0 |
| tst.js:1:13:1:13 | number | tst.js:1:5:1:13 | Foo.<number> | 0 |
| tst.js:1:13:1:13 | string | tst.js:1:5:1:13 | Foo.<string> | 0 |
| tst.js:1:14:1:13 | DOMException | tst.js:206:4:206:10 | @throws | 0 |
| tst.js:1:14:1:14 | string | tst.js:1:6:1:14 | Foo.<string> | 0 |
| tst.js:1:14:1:14 | string | tst.js:1:6:1:14 | Foo.<string> | 0 |
| tst.js:1:14:1:20 | !number | tst.js:1:10:1:38 | function (x: !number, y: !number): number | 0 |
| tst.js:1:15:1:15 | number | tst.js:1:7:1:15 | Array.<number> | 0 |
| tst.js:1:15:1:15 | number | tst.js:1:8:1:19 | (string\|number\|null) | 1 |
| tst.js:1:15:1:15 | string | tst.js:1:7:1:23 | MyMap.<string, number> | 0 |
| tst.js:1:16:1:16 | number | tst.js:1:3:1:16 | (string\|number) | 1 |
| tst.js:1:16:1:16 | number | tst.js:1:3:1:26 | {myNum: number, myObject} | 0 |
| tst.js:1:17:1:16 | goog.NumberLike | tst.js:219:5:219:10 | @param | 0 |
| tst.js:1:17:1:17 | string | tst.js:1:10:1:26 | function (string, boolean) | 0 |
| tst.js:1:17:1:17 | string | tst.js:1:10:1:38 | function (string, ...[number]): number | 0 |
| tst.js:1:18:1:17 | undefined | tst.js:1:8:1:17 | (string\|undefined) | 1 |
| tst.js:1:18:1:18 | string | tst.js:1:12:1:18 | ?string | 0 |
| tst.js:1:20:1:19 | null | tst.js:1:8:1:19 | (string\|number\|null) | 2 |
| tst.js:1:20:1:19 | number | tst.js:1:10:1:19 | function (): number | -1 |
| tst.js:1:20:1:20 | number | tst.js:1:14:1:20 | !number | 0 |
| tst.js:1:23:1:22 | goog.ds.BasicNodeList | tst.js:68:4:68:11 | @extends | 0 |
| tst.js:1:23:1:23 | number | tst.js:1:7:1:23 | MyMap.<string, number> | 1 |
| tst.js:1:23:1:30 | ...[number] | tst.js:1:10:1:38 | function (string, ...[number]): number | 1 |
| tst.js:1:25:1:31 | !number | tst.js:1:10:1:38 | function (x: !number, y: !number): number | 1 |
| tst.js:1:26:1:26 | boolean | tst.js:1:10:1:26 | function (string, boolean) | 1 |
| tst.js:1:27:1:27 | goog.ui.Menu | tst.js:1:10:1:35 | function (new: goog.ui.Menu, string) | -2 |
| tst.js:1:27:1:27 | number | tst.js:1:27:1:28 | number= | 0 |
| tst.js:1:27:1:28 | number= | tst.js:1:10:1:28 | function (?string=, number=) | 1 |
| tst.js:1:28:1:28 | goog.ui.Menu | tst.js:1:10:1:36 | function (this: goog.ui.Menu, string) | -2 |
| tst.js:1:29:1:29 | number | tst.js:1:29:1:30 | [number] | 0 |
| tst.js:1:29:1:30 | [number] | tst.js:1:23:1:30 | ...[number] | 0 |
| tst.js:1:31:1:31 | number | tst.js:1:25:1:31 | !number | 0 |
| tst.js:1:35:1:35 | string | tst.js:1:10:1:35 | function (new: goog.ui.Menu, string) | 0 |
| tst.js:1:36:1:36 | string | tst.js:1:10:1:36 | function (this: goog.ui.Menu, string) | 0 |
| tst.js:1:39:1:38 | number | tst.js:1:10:1:38 | function (string, ...[number]): number | -1 |
| tst.js:1:39:1:38 | number | tst.js:1:10:1:38 | function (x: !number, y: !number): number | -1 |
test_Function_getDocumentation
| tst.js:20:1:21:1 | functio ... t() {\\n} | tst.js:16:1:19:3 | /**\\n * ... tor\\n */ |
| tst.js:36:34:37:1 | function(node) {\\n} | tst.js:29:1:35:3 | /**\\n * ... ().\\n */ |
@@ -506,25 +506,25 @@ test_Function_getDocumentation
| tst.js:378:14:378:19 | (p) {} | tst.js:375:3:377:5 | /**\\n ... p\\n */ |
| tst.js:383:14:383:19 | (p) {} | tst.js:380:3:382:5 | /**\\n ... p\\n */ |
test_JSDocOptionalParameterTypeExpr
| ?string= | ?string |
| number= | number |
| number= | number |
| tst.js:1:8:1:8 | number= | tst.js:1:8:1:8 | number |
| tst.js:1:12:1:19 | ?string= | tst.js:1:12:1:18 | ?string |
| tst.js:1:27:1:28 | number= | tst.js:1:27:1:27 | number |
test_getParameterTag
| tst.js:146:37:146:44 | groupNum | groupNum | tst.js:142:4:142:9 | @param | groupNum | number |
| tst.js:146:47:146:50 | term | term | tst.js:143:4:143:9 | @param | term | (string\|number\|null) |
| tst.js:166:59:166:65 | element | element | tst.js:163:4:163:9 | @param | element | Element |
| tst.js:220:28:220:28 | x | x | tst.js:219:5:219:10 | @param | x | goog.NumberLike |
| tst.js:256:30:256:30 | t | t | tst.js:255:5:255:10 | @param | t | T |
| tst.js:266:16:266:16 | t | t | tst.js:262:4:262:9 | @param | t | T |
| tst.js:295:22:295:25 | fooY | fooY | tst.js:294:5:294:10 | @param | fooY | Foo.<Y> |
| tst.js:307:31:307:31 | t | t | tst.js:306:5:306:10 | @param | t | T |
| tst.js:343:21:343:21 | a | a | tst.js:339:4:339:9 | @param | a | T |
| tst.js:360:15:360:19 | array | array | tst.js:357:4:357:9 | @param | array | Array.<number> |
| tst.js:360:22:360:23 | fn | fn | tst.js:358:4:358:9 | @param | fn | function (x: !number, y: !number): number |
| tst.js:366:27:366:27 | p | p | tst.js:364:6:364:11 | @param | p | T1 |
| tst.js:371:15:371:15 | p | p | tst.js:369:6:369:11 | @param | p | T2 |
| tst.js:378:15:378:15 | p | p | tst.js:376:6:376:11 | @param | p | T3 |
| tst.js:383:15:383:15 | p | p | tst.js:381:6:381:11 | @param | p | T4 |
| tst.js:146:37:146:44 | groupNum | groupNum | tst.js:142:4:142:9 | @param | groupNum | tst.js:1:8:1:7 | number |
| tst.js:146:47:146:50 | term | term | tst.js:143:4:143:9 | @param | term | tst.js:1:8:1:19 | (string\|number\|null) |
| tst.js:166:59:166:65 | element | element | tst.js:163:4:163:9 | @param | element | tst.js:1:9:1:8 | Element |
| tst.js:220:28:220:28 | x | x | tst.js:219:5:219:10 | @param | x | tst.js:1:17:1:16 | goog.NumberLike |
| tst.js:256:30:256:30 | t | t | tst.js:255:5:255:10 | @param | t | tst.js:1:3:1:2 | T |
| tst.js:266:16:266:16 | t | t | tst.js:262:4:262:9 | @param | t | tst.js:1:3:1:2 | T |
| tst.js:295:22:295:25 | fooY | fooY | tst.js:294:5:294:10 | @param | fooY | tst.js:1:5:1:8 | Foo.<Y> |
| tst.js:307:31:307:31 | t | t | tst.js:306:5:306:10 | @param | t | tst.js:1:3:1:2 | T |
| tst.js:343:21:343:21 | a | a | tst.js:339:4:339:9 | @param | a | tst.js:1:3:1:2 | T |
| tst.js:360:15:360:19 | array | array | tst.js:357:4:357:9 | @param | array | tst.js:1:7:1:15 | Array.<number> |
| tst.js:360:22:360:23 | fn | fn | tst.js:358:4:358:9 | @param | fn | tst.js:1:10:1:38 | function (x: !number, y: !number): number |
| tst.js:366:27:366:27 | p | p | tst.js:364:6:364:11 | @param | p | tst.js:1:4:1:3 | T1 |
| tst.js:371:15:371:15 | p | p | tst.js:369:6:369:11 | @param | p | tst.js:1:4:1:3 | T2 |
| tst.js:378:15:378:15 | p | p | tst.js:376:6:376:11 | @param | p | tst.js:1:4:1:3 | T3 |
| tst.js:383:15:383:15 | p | p | tst.js:381:6:381:11 | @param | p | tst.js:1:4:1:3 | T4 |
test_VarDeclStmt_getDocumentation
| tst.js:5:15:5:36 | var MY_ ... stout'; | tst.js:5:1:5:13 | /** @const */ |
| tst.js:24:1:24:24 | var ENA ... = true; | tst.js:23:1:23:24 | /** @de ... ean} */ |
@@ -544,25 +544,25 @@ test_VarDeclStmt_getDocumentation
| tst.js:347:23:347:60 | var sum ... y("2"); | tst.js:347:1:347:21 | /** @ty ... ber} */ |
| tst.js:349:33:349:52 | var string_or_undef; | tst.js:349:1:349:31 | /** @ty ... ned} */ |
test_JSDocAppliedTypeExpr
| A.<U> | A | 0 | U |
| A.<string> | A | 0 | string |
| Array.<Function> | Array | 0 | Function |
| Array.<number> | Array | 0 | number |
| Foo.<X> | Foo | 0 | X |
| Foo.<Y> | Foo | 0 | Y |
| Foo.<Y> | Foo | 0 | Y |
| Foo.<number> | Foo | 0 | number |
| Foo.<string> | Foo | 0 | string |
| Foo.<string> | Foo | 0 | string |
| Foo.<string> | Foo | 0 | string |
| MyMap.<string, number> | MyMap | 0 | string |
| MyMap.<string, number> | MyMap | 1 | number |
| tst.js:1:3:1:6 | A.<U> | tst.js:1:3:1:4 | A | 0 | tst.js:1:6:1:6 | U |
| tst.js:1:3:1:11 | A.<string> | tst.js:1:3:1:4 | A | 0 | tst.js:1:11:1:11 | string |
| tst.js:1:5:1:8 | Foo.<X> | tst.js:1:5:1:6 | Foo | 0 | tst.js:1:8:1:8 | X |
| tst.js:1:5:1:8 | Foo.<Y> | tst.js:1:5:1:6 | Foo | 0 | tst.js:1:8:1:8 | Y |
| tst.js:1:5:1:8 | Foo.<Y> | tst.js:1:5:1:6 | Foo | 0 | tst.js:1:8:1:8 | Y |
| tst.js:1:5:1:13 | Foo.<number> | tst.js:1:5:1:6 | Foo | 0 | tst.js:1:13:1:13 | number |
| tst.js:1:5:1:13 | Foo.<string> | tst.js:1:5:1:6 | Foo | 0 | tst.js:1:13:1:13 | string |
| tst.js:1:6:1:14 | Foo.<string> | tst.js:1:6:1:7 | Foo | 0 | tst.js:1:14:1:14 | string |
| tst.js:1:6:1:14 | Foo.<string> | tst.js:1:6:1:7 | Foo | 0 | tst.js:1:14:1:14 | string |
| tst.js:1:7:1:15 | Array.<number> | tst.js:1:7:1:8 | Array | 0 | tst.js:1:15:1:15 | number |
| tst.js:1:7:1:23 | MyMap.<string, number> | tst.js:1:7:1:8 | MyMap | 0 | tst.js:1:15:1:15 | string |
| tst.js:1:7:1:23 | MyMap.<string, number> | tst.js:1:7:1:8 | MyMap | 1 | tst.js:1:23:1:23 | number |
| tst.js:1:10:1:11 | Array.<Function> | tst.js:1:10:1:11 | Array | 0 | tst.js:1:10:1:10 | Function |
test_JSDocNonNullableTypeExpr
| !Foo.<string> | Foo.<string> | prefix |
| !Foo.<string> | Foo.<string> | prefix |
| !Object | Object | prefix |
| !number | number | prefix |
| !number | number | prefix |
| tst.js:1:3:1:8 | !Object | tst.js:1:9:1:8 | Object | prefix |
| tst.js:1:3:1:14 | !Foo.<string> | tst.js:1:6:1:14 | Foo.<string> | prefix |
| tst.js:1:3:1:14 | !Foo.<string> | tst.js:1:6:1:14 | Foo.<string> | prefix |
| tst.js:1:14:1:20 | !number | tst.js:1:20:1:20 | number | prefix |
| tst.js:1:25:1:31 | !number | tst.js:1:31:1:31 | number | prefix |
test_ParExpr_getDocumentation
| tst.js:117:42:119:10 | ({\\n ... }) | tst.js:117:9:117:40 | /** @le ... ype} */ |
| tst.js:259:40:259:50 | (new Foo()) | tst.js:259:11:259:38 | /** @ty ... ng>} */ |

View File

@@ -0,0 +1,21 @@
test_isString
| tst.js:1:8:1:7 | string |
test_isNumber
| tst.js:1:8:1:8 | number |
test_QualifiedName
| VarType | tst.js:1:9:1:8 | VarType |
| boolean | tst.js:1:9:1:8 | boolean |
| foo.bar.baz | tst.js:1:13:1:12 | foo.bar.baz |
| number | tst.js:1:8:1:8 | number |
| string | tst.js:1:8:1:7 | string |
test_ParameterType
| tst.js:7:12:7:12 | x | tst.js:1:8:1:7 | string |
| tst.js:7:15:7:15 | y | tst.js:1:8:1:8 | number? |
| tst.js:7:18:7:18 | z | tst.js:1:13:1:12 | foo.bar.baz |
test_VarType
| tst.js:7:12:7:12 | x | tst.js:1:8:1:7 | string |
| tst.js:7:15:7:15 | y | tst.js:1:8:1:8 | number? |
| tst.js:7:18:7:18 | z | tst.js:1:13:1:12 | foo.bar.baz |
| tst.js:11:7:11:7 | w | tst.js:1:9:1:8 | VarType |
test_ReturnType
| tst.js:7:1:12:1 | functio ... null;\\n} | tst.js:1:9:1:8 | boolean |

View File

@@ -0,0 +1,25 @@
import javascript
query TypeAnnotation test_isString() {
result.isString()
}
query TypeAnnotation test_isNumber() {
result.isNumber()
}
query TypeAnnotation test_QualifiedName(string name) {
result.hasQualifiedName(name)
}
query TypeAnnotation test_ParameterType(Parameter p) {
result = p.getTypeAnnotation()
}
query TypeAnnotation test_VarType(VarDecl decl) {
result = decl.getTypeAnnotation()
}
query TypeAnnotation test_ReturnType(Function f) {
result = f.getReturnTypeAnnotation()
}

View File

@@ -0,0 +1,12 @@
/**
* @param {string} x
* @param {number?} y
* @param {foo.bar.baz} z
* @returns {boolean}
*/
function f(x, y, z) {
/**
* @type {VarType}
*/
var w = null;
}

View File

@@ -0,0 +1 @@
| tst.ts:5:8:5:19 | ResolvedType | resolved | ResolvedType |

View File

@@ -0,0 +1,5 @@
import javascript
from TypeAnnotation type, string mod, string name
where type.hasQualifiedName(mod, name)
select type, mod, name

View File

@@ -0,0 +1,3 @@
export interface ResolvedType {
x: number;
}

View File

@@ -0,0 +1 @@
{ "include": ["."] }

View File

@@ -0,0 +1,5 @@
import { UnresolvedType } from "unresolved";
import { ResolvedType } from "resolved";
let x: UnresolvedType;
let y: ResolvedType;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
description: support location information for JSDoc types
compatibility: backwards