当前位置: 首页>>代码示例>>Java>>正文


Java IASTImplicitName类代码示例

本文整理汇总了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;
}
 
开发者ID:cwi-swat,项目名称:clair,代码行数:14,代码来源:Parser.java

示例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);
}
 
开发者ID:magicsky,项目名称:sya,代码行数:8,代码来源:IASTImplicitNameExample.java

示例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;
}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:56,代码来源:InvocationAccessRefVisitor.java


注:本文中的org.eclipse.cdt.core.dom.ast.IASTImplicitName类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。