use of abs.frontend.typechecker.ResolvedName in project abstools by abstools.
the class ProposalFactory method addToplevelProposals.
/**
* add proposals for all visible names.
* @param node the node under the cursor
*/
private void addToplevelProposals(ASTNode<?> node) {
ProposalComparator comp = new ProposalComparator();
ArrayList<ICompletionProposal> tempNonqual = new ArrayList<ICompletionProposal>();
ArrayList<ICompletionProposal> tempQual = new ArrayList<ICompletionProposal>();
ModuleDecl moddecl = node.getModuleDecl();
if (moddecl == null) {
return;
}
try {
Map<KindedName, ResolvedName> visibleNames = moddecl.getVisibleNames();
for (Entry<KindedName, ResolvedName> kentry : visibleNames.entrySet()) {
KindedName kname = kentry.getKey();
if (qualifierIsPrefixOf(kname.getName())) {
CompletionProposal proposal = makeVisibleNameProposal(kentry.getValue(), kname);
if (kname.isQualified()) {
tempQual.add(proposal);
} else {
tempNonqual.add(proposal);
}
}
}
Collections.sort(tempNonqual, comp);
proposals.addAll(tempNonqual);
Collections.sort(tempQual, comp);
proposals.addAll(tempQual);
} catch (TypeCheckerException e) {
// ignore all type check exceptions
}
}
use of abs.frontend.typechecker.ResolvedName in project abstools by abstools.
the class ProposalFactory method addClassProposals.
/**
* add the classes in the current module
* @param node the node under the cursor
*/
private void addClassProposals(ASTNode<?> node) {
ProposalComparator comp = new ProposalComparator();
ArrayList<ICompletionProposal> tempNonqual = new ArrayList<ICompletionProposal>();
ArrayList<ICompletionProposal> tempQual = new ArrayList<ICompletionProposal>();
ModuleDecl moddecl = node.getModuleDecl();
// Only crash when debugging:
assert moddecl != null : "Node is not in a Module!";
if (moddecl == null)
return;
Map<KindedName, ResolvedName> visibleNames = moddecl.getVisibleNames();
for (Entry<KindedName, ResolvedName> kentry : visibleNames.entrySet()) {
KindedName kname = kentry.getKey();
if (qualifierIsPrefixOf(kname.getName()) && kname.getKind() == Kind.CLASS) {
CompletionProposal proposal = makeVisibleNameProposal(kentry.getValue(), kname);
if (kname.isQualified()) {
tempQual.add(proposal);
} else {
tempNonqual.add(proposal);
}
}
}
Collections.sort(tempNonqual, comp);
proposals.addAll(0, tempNonqual);
Collections.sort(tempQual, comp);
proposals.addAll(0, tempQual);
}
Aggregations