Search in sources :

Example 1 with IProblemBinding

use of org.eclipse.cdt.core.dom.ast.IProblemBinding in project Cpp4CIA by thanhminhmr.

the class AstBuilder method createUnknownNode.

@Nonnull
private CppNode createUnknownNode(@Nonnull CppNode parentNode, @Nonnull IBinding binding, @Nonnull String name, boolean createUseDependency) {
    if (binding instanceof IProblemBinding)
        return createIntegralNode(name);
    final IBinding topBinding = binding instanceof ICPPSpecialization ? Objects.requireNonNullElse(((ICPPSpecialization) binding).getSpecializedBinding(), binding) : binding;
    final CppNode existNode = bindingNodeMap.get(topBinding);
    if (existNode != null) {
        if (createUseDependency)
            parentNode.addDependencyTo(existNode, DependencyType.USE);
        return existNode;
    }
    final IntegralNode newNode = new IntegralNode(name);
    parentNode.addChild(newNode);
    if (createUseDependency)
        parentNode.addDependencyTo(newNode, DependencyType.USE);
    bindingNodeMap.put(topBinding, newNode);
    unknownNodes.add(newNode);
    return newNode;
}
Also used : IProblemBinding(org.eclipse.cdt.core.dom.ast.IProblemBinding) IBinding(org.eclipse.cdt.core.dom.ast.IBinding) CppNode(mrmathami.cia.cpp.ast.CppNode) ICPPSpecialization(org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization) IntegralNode(mrmathami.cia.cpp.ast.IntegralNode) Nonnull(mrmathami.annotations.Nonnull)

Aggregations

Nonnull (mrmathami.annotations.Nonnull)1 CppNode (mrmathami.cia.cpp.ast.CppNode)1 IntegralNode (mrmathami.cia.cpp.ast.IntegralNode)1 IBinding (org.eclipse.cdt.core.dom.ast.IBinding)1 IProblemBinding (org.eclipse.cdt.core.dom.ast.IProblemBinding)1 ICPPSpecialization (org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization)1