}
@Override
public void leaveFile(AstNode astNode) {
File sonarFile = File.fromIOFile(getContext().getFile(), project);
FileLinesContext fileLinesContext = fileLinesContextFactory.createFor(sonarFile);
int fileLength = getContext().peekSourceCode().getInt(EcmaScriptMetric.LINES);
for (int line = 1; line <= fileLength; line++) {
fileLinesContext.setIntValue(CoreMetrics.NCLOC_DATA_KEY, line, linesOfCode.contains(line) ? 1 : 0);
fileLinesContext.setIntValue(CoreMetrics.COMMENT_LINES_DATA_KEY, line, linesOfComments.contains(line) ? 1 : 0);
}
fileLinesContext.save();
linesOfCode.clear();
linesOfComments.clear();
}