本文整理汇总了Java中org.eclipse.cdt.core.dom.ast.IASTImplicitName类的典型用法代码示例。如果您正苦于以下问题:Java IASTImplicitName类的具体用法?Java IASTImplicitName怎么用?Java IASTImplicitName使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IASTImplicitName类属于org.eclipse.cdt.core.dom.ast包,在下文中一共展示了IASTImplicitName类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.eclipse.cdt.core.dom.ast.IASTImplicitName; //导入依赖的package包/类
@Override
public int visit(IASTName name) {
if (name instanceof IASTImplicitName)
visit((IASTImplicitName) name);
else if (name instanceof ICPPASTName)
visit((ICPPASTName) name);
else {
err("No sub-interfaced IASTName? " + name.getClass().getName() + ": " + name.getRawSignature());
throw new RuntimeException("NYI");
}
return PROCESS_ABORT;
}
示例2: testExample
import org.eclipse.cdt.core.dom.ast.IASTImplicitName; //导入依赖的package包/类
public void testExample() {
IASTTranslationUnit translationUnit = parseCPP(getCommentAbove());
ASTNamesVisitor namesVisitor = new ASTNamesVisitor();
translationUnit.accept(namesVisitor);
// &y中的&,因为它被重载了
assertTrue(namesVisitor.getNames().get(namesVisitor.getNames().size() - 2) instanceof IASTImplicitName);
}
示例3: visit
import org.eclipse.cdt.core.dom.ast.IASTImplicitName; //导入依赖的package包/类
@Override
protected int visit(ICPPASTConstructorInitializer node) {
IASTImplicitNameOwner parent = (IASTImplicitNameOwner)node.getParent() ;
NamedEntity fmx = null;
Invocation invok = null;
// if this is an implicit call to a constructor
for (IASTImplicitName candidate : parent.getImplicitNames()) {
IBinding constBnd = null;
constBnd = resolver.getBinding( candidate );
if (constBnd != null) {
fmx = dico.getEntityByKey(constBnd);
if (fmx instanceof BehaviouralEntity) {
break; // we found one method matching the implicit constructor. We are happy for now.
}
}
}
// if we could not get it, try to create a meaningful stub
if (fmx == null) {
// get the name of the called constructor (or attribute initialized)
String mthName = null;
if (parent.getImplicitNames().length > 0) {
mthName = parent.getImplicitNames()[0].toString();
}
else if (parent instanceof ICPPASTConstructorChainInitializer) {
// FIXME what if returnedType == null but should be Attribute ... ?
if ( returnedEntity instanceof Attribute ) { // hopefully set in visit(ICPPASTConstructorChainInitializer)
mthName = ((Attribute)returnedEntity).getDeclaredType().getName();
}
else {
// Constructor name is the name of its class (possibly fully qualified) + name of the class (unqualified)
QualifiedName qualName = new QualifiedName( ((ICPPASTConstructorChainInitializer)parent).getMemberInitializerId().toString() );
mthName = qualName.toString() + QualifiedName.CPP_NAME_SEPARATOR + qualName.unqualifiedName();
}
}
// create the constructor
if (mthName != null) {
fmx = makeStubBehavioural(mthName, node.getArguments().length, /*isMethod*/true);
}
}
if (fmx != null) {
invok = invocationOfBehavioural((BehaviouralEntity) fmx);
returnedEntity = invok;
dico.addSourceAnchor(returnedEntity, filename, node.getFileLocation());
}
visitInvocationArguments(node.getArguments(), invok);
return PROCESS_SKIP;
}