-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(typescript_indexer): limit ref/call spans to identifiers (#5695)
In service of #5691
- Loading branch information
Showing
4 changed files
with
77 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* @fileoverview Test to ensure that indexer produces ref/call edges and all data needed for callgraph. | ||
* See https://kythe.io/docs/schema/callgraph.html. | ||
*/ | ||
|
||
// clang-format off | ||
//- FileInitFunc=vname("fileInit:synthetic", _, _, "testdata/refcall_id", "typescript").node/kind function | ||
//- FileInitDef defines FileInitFunc | ||
//- FileInitDef.node/kind anchor | ||
//- FileInitDef.loc/start 0 | ||
//- FileInitDef.loc/end 0 | ||
// clang-format on | ||
|
||
//- @Square defines/binding Square | ||
//- Square.node/kind function | ||
class Square { | ||
//- @getWidth defines/binding GetWidth | ||
getWidth(): number { | ||
return 42; | ||
} | ||
|
||
//- @getArea defines/binding GetArea | ||
getArea() { | ||
//- GetWidthCall=@getWidth ref/call GetWidth | ||
//- GetWidthCall childof GetArea | ||
this.getWidth() ** 2; | ||
} | ||
} | ||
|
||
//- @Square ref/call Square | ||
const square = new Square(); | ||
|
||
//- GetAreaCallOne=@getArea ref/call GetArea | ||
//- GetAreaCallOne childof FileInitFunc | ||
square.getArea(); | ||
|
||
//- @doNothing defines/binding DoNothing | ||
function doNothing() { | ||
//- GetAreaCallTwo=@getArea ref/call GetArea | ||
//- GetAreaCallTwo childof DoNothing | ||
square.getArea(); | ||
} | ||
|
||
//- DoNothingCall=@doNothing ref/call DoNothing | ||
//- DoNothingCall childof FileInitFunc | ||
doNothing(); |