Skip to content

Commit

Permalink
Refactored several methods
Browse files Browse the repository at this point in the history
  • Loading branch information
rodinaarssen committed Apr 22, 2020
1 parent 7b25db5 commit 730b96d
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/lang/cpp/internal/Parser.java
Expand Up @@ -502,23 +502,17 @@ public ISet getMethodOverrides(IASTTranslationUnit tu) {
}

public ISet getMacroDefinitionsFromTranslationUnit(IASTTranslationUnit tu) {
ISetWriter macros = vf.setWriter();
Stream.of(tu.getMacroDefinitions()).forEach(it -> {
ISourceLocation decl;
return Stream.of(tu.getMacroExpansions()).map(it -> {
try {
decl = br.resolveBinding(it.getName().resolveBinding());
return vf.tuple(getSourceLocation(it), br.resolveBinding(it.getMacroReference().resolveBinding()));
} catch (URISyntaxException e) {
decl = vf.sourceLocation(URIUtil.rootScheme("null"));
return vf.tuple(getSourceLocation(it), vf.sourceLocation(URIUtil.rootScheme("unknown")));
}
macros.insert(vf.tuple(decl, getSourceLocation(it)));
});
return macros.done();
}).collect(vf.setWriter());
}

public IList getCommentsFromTranslationUnit(IASTTranslationUnit tu) {
IListWriter comments = vf.listWriter();
Stream.of(tu.getComments()).forEach(it -> comments.append(getSourceLocation(it)));
return comments.done();
return Stream.of(tu.getComments()).map(this::getSourceLocation).collect(vf.listWriter());
}

public IList parseForComments(ISourceLocation file, IList includePath, IMap additionalMacros,
Expand Down

0 comments on commit 730b96d

Please sign in to comment.