Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDL: Improve performance by simplifying CDS location identification #165

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ abstract class CdlObject extends JsonObject {
exists(Location loc, JsonValue locValue |
loc = this.getLocation() and
locValue = this.getPropValue("$location") and
// The path in the cds.json file is relative to the working directory used when running
// the cds compile command. In our extractor, that's always the root of the repository,
// so we can identify the entry in the `File` table by its relative path.
path =
any(File f |
f.getAbsolutePath()
.matches("%" + locValue.getPropValue("file").getStringValue() + ".json")
).getAbsolutePath().regexpReplaceAll("\\.json$", "") and
any(File f | f.getRelativePath() = locValue.getPropValue("file").getStringValue())
.getAbsolutePath() and
if
not exists(locValue.getPropValue("line")) and
not exists(locValue.getPropValue("col"))
Expand Down
Loading