當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。