• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java IASTName类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.cdt.core.dom.ast.IASTName的典型用法代码示例。如果您正苦于以下问题:Java IASTName类的具体用法?Java IASTName怎么用?Java IASTName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IASTName类属于org.eclipse.cdt.core.dom.ast包,在下文中一共展示了IASTName类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: behaviouralParentFromBindingOrContext

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的package包/类
/**
 * Assumes binding is not a StubBinding
 */
protected ContainerEntity behaviouralParentFromBindingOrContext(IBinding bnd, IASTName name) {
	ContainerEntity parent;

	if (isMethodBinding(bnd)) {
		parent = (ContainerEntity) dico.getEntityByKey( ((ICPPMethod)bnd).getClassOwner() );
		if (parent == null) {
			// happened once in a badly coded case
			if (QualifiedName.isFullyQualified(name)) {
				parent = (ContainerEntity) resolveOrCreate( QualifiedName.parentNameFromEntityFullname(name.toString()), /*mayBeNull*/false, /*mustBeClass*/true );
			}
			else {
				parent = (ContainerEntity) context.top();
			}
		}
	}
	else {
		if (QualifiedName.isFullyQualified(name)) {
			parent = (ContainerEntity) resolveOrCreate( QualifiedName.parentNameFromEntityFullname(name.toString()), /*mayBeNull*/false, /*mustBeClass*/false );
		}
		else {
			parent = (ContainerEntity) context.top();
		}
	}
	return parent;
}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:29,代码来源:NameResolver.java


示例2: visit

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的package包/类
/**
 * Other entry point for this visitor
 */
@Override
protected int visit(ICPPASTConstructorChainInitializer node) {
	IASTName memberName = node.getMemberInitializerId();
	nodeBnd = resolver.getBinding(memberName);
	returnedEntity = dico.getEntityByKey(nodeBnd);
	if (returnedEntity == null) {
		Type parent = null;
		// top of context stack should be the constructor method that is ChainInitialized
		if (resolver.getContext().topMethod() != null) {
			parent = resolver.getContext().topMethod().getParentType();
		}
		// just in case, we look if the class of the constructor is not in the context stack ...
		else if (resolver.getContext().topType() != null) {
			parent = resolver.getContext().topType();
		}
		if (parent != null) {
			returnedEntity = resolver.findInParent(memberName.toString(), parent, /*recursive*/true);
		}
	}
	node.getInitializer().accept(this);

	return PROCESS_SKIP;
}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:27,代码来源:InvocationAccessRefVisitor.java


示例3: visit

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的package包/类
@Override
public int visit(ICPPASTBaseSpecifier node) {
	Class subClass = (Class) getContext().top();
	Type supClass = null;

	// why isn't it an IASTName like everywhere else?
	ICPPASTNameSpecifier baseName = node.getNameSpecifier(); 
	
	nodeBnd = baseName.resolveBinding();
	if ( (nodeBnd == null) || (nodeBnd instanceof IProblemBinding) ) {
		nodeBnd = resolver.mkStubKey((IASTName)baseName, Class.class);
	}
	supClass = (Type) dico.getEntityByKey(nodeBnd);

	if (supClass == null) {
		supClass = (Type) resolver.resolveOrCreate( baseName.toString(), /*mayBeNull*/false, /*mustBeClass*/true);
	}

	if (supClass != null) { 
		lastInheritance = dico.ensureFamixInheritance(supClass, subClass, lastInheritance);
	}

	return PROCESS_SKIP;
}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:25,代码来源:InheritanceRefVisitor.java


示例4: processReference

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的package包/类
/**
 * Processes a detected reference given as name by determining its qualified
 * name and adding it to the current type definition
 *
 * @param name Name of referenced type
 */
private void processReference(IASTName name) throws DOMException {
    String fullyQualifiedName = resolveFullyQualifiedTypeName(name);
    if ((fullyQualifiedName == null) || (fullyQualifiedName.length() == 0)) {
        // referred name not registered, so it is probably irrelevant.

        String text = new StringBuilder(name.getFileLocation().getFileName()).append(":").append(
                name.getFileLocation().getStartingLineNumber()).append(" ").append(name).append(" not registered.")
                .toString();

        s_logger.debug(text);

        return;
    }

    addReference(fullyQualifiedName);
}
 
开发者ID:dheraclio,项目名称:dependometer,代码行数:23,代码来源:SourceFileParser.java


示例5: visit

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的package包/类
public int visit(IASTName name) {
	String prtName = name.toString();
	
	if (prtName.length() == 0)
		prtName = name.getRawSignature(); // use pre pre-processor
	if ("IASTCompositeTypeSpecifier.TYPE_NAME - IASTName for IASTCompositeTypeSpecifier".equals(name.getPropertyInParent().getName()))
	{
		structList.add(prtName);
	}
	// value
//	System.out.println("name: "+name.getPropertyInParent().getName());
	setThings(name.getPropertyInParent().getName(),"Visiting name: " + prtName);
//	System.out.println("Visiting name: " + prtName);
//	System.out.println(name.getPropertyInParent().getName());
	return PROCESS_CONTINUE;
}
 
开发者ID:elenno,项目名称:simtest,代码行数:17,代码来源:ASTVISITOR.java


示例6: getBinding

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的package包/类
/**
 * Try to get some binding from a IASTName.
 * There are two possible way to get bindings: through the Index and by resolveBinding.
 * but the second may return different bindings for the same entity in different locations
 * @return a binding or null if none found
 */
public IBinding getBinding(IASTName name) {
	IBinding bnd = null;
	if (name == null) {
		return null;
	}
	try {
		bnd = index.findBinding(name);
	} catch (CoreException e) {
		e.printStackTrace();
	}

	return bnd;
}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:20,代码来源:NameResolver.java


示例7: getFunctionBinding

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的package包/类
public IBinding getFunctionBinding(IASTFunctionDeclarator node, IASTName name) {
	IBinding bnd;
	
	bnd = getBinding(name);   // generic getBinding method

	if (bnd == null) {
		ContainerEntity parent = null;
		String behavName = SignatureBuilderVisitor.signatureFromAST(node);

		// need to find the parent here (although mkStubKey can do it for us)
		// because need to know whether it is a method or a function
		QualifiedName qualName = new QualifiedName(name);
		if (qualName.isFullyQualified()) {
			parent = (ContainerEntity) resolveOrCreate(qualName.nameQualifiers(), /*mayBeNull*/false, /*mustBeClass*/false);
		}
		else {
			parent = context.getTopCppNamespace();
		}

		if (parent instanceof eu.synectique.verveine.core.gen.famix.Class) {
			bnd = mkStubKey( behavName, parent, Method.class);
		}
		else {
			bnd = mkStubKey(behavName, (ContainerEntity) parent, Function.class);
		}
	}
	return bnd;
}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:29,代码来源:NameResolver.java


示例8: ensureBehavioural

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的package包/类
/**
 * Get a behaviouralEntity for the node.
 * Tries to recover from the binding or the name (does some name resolution based on fully qualified names).
 * If all fails, will create an entity.
 */
public BehaviouralEntity ensureBehavioural(IASTFunctionDeclarator node, IBinding nodeBnd, IASTName nodeName) {
	BehaviouralEntity fmx;

	// just in case this is a definition and we already processed the declaration
	fmx = (BehaviouralEntity) dico.getEntityByKey(nodeBnd);
	// try harder
	if (fmx == null) {
		fmx = ensureBehaviouralFromName(node, nodeBnd, nodeName);
	}
	return fmx;
}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:17,代码来源:NameResolver.java


示例9: ensureBehaviouralFromName

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的package包/类
public BehaviouralEntity ensureBehaviouralFromName(IASTFunctionDeclarator node, IBinding bnd, IASTName name) {
	String sig;
	ContainerEntity parent;
	BehaviouralEntity fmx;

	// get behavioural name and parent
	if (bnd instanceof StubBinding) {
		String fullname = ((StubBinding)bnd).getEntityName();
		sig = QualifiedName.signatureFromBehaviouralFullname(fullname);

		parent = behaviouralParentFromNameOrContext(fullname);
	}
	else {
		sig = SignatureBuilderVisitor.signatureFromAST(node);

		parent = behaviouralParentFromBindingOrContext(bnd, name);
	}

	// last try to recover behavioural ...
	fmx = (BehaviouralEntity) findInParent(sig, parent, /*recursive*/false);

	// ... create it if failed
	if (fmx == null) {
		if (isMethodBinding(bnd)) {
			fmx = dico.ensureFamixMethod(bnd, new QualifiedName(name).unqualifiedName(), sig, /*owner*/(Type)parent);
		}
		else {                    //   C function or may be a stub ?
			fmx = dico.ensureFamixFunction(bnd, new QualifiedName(name).unqualifiedName(), SignatureBuilderVisitor.signatureFromAST(node), (ContainerEntity)context.top());
		}
	}

	return fmx;
}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:34,代码来源:NameResolver.java


示例10: visit

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的package包/类
@Override
public int visit(IASTName node) {
	if (node instanceof ICPPASTTemplateId) {
		return visit((ICPPASTTemplateId)node);
	}

	return super.visit(node);
}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:9,代码来源:AbstractDispatcherVisitor.java


示例11: associationToName

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的package包/类
protected Association associationToName(IASTName nodeName, IASTNode nodeParent) {
	NamedEntity fmx = null;
	Association assoc = null;

	nodeBnd = resolver.getBinding(nodeName);

	if (nodeBnd != null) {
		fmx = dico.getEntityByKey(nodeBnd);
	}
	else {
		fmx = resolver.findInParent(nodeName.toString(), getContext().top(), /*recursive*/true);
	}

	if (fmx instanceof StructuralEntity) {
		assoc = accessToVar((StructuralEntity) fmx);
	}
	else if (fmx instanceof BehaviouralEntity) { //&& (! inAmpersandUnaryExpression) ) {
		if (inAmpersandUnaryExpression) {
			return behaviouralPointer((BehaviouralEntity) fmx);
		}
		else {
			assoc = invocationOfBehavioural((BehaviouralEntity) fmx);
		}
	}
	if (assoc != null) {
		dico.addSourceAnchor(assoc, filename, nodeParent.getFileLocation());
	}
	
	return assoc;
}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:31,代码来源:InvocationAccessRefVisitor.java


示例12: referedType

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的package包/类
/**
 * Find a referenced type from its name
 * May have to create it if it is not found
 */
protected Type referedType(IASTName name) {
	Type fmx = null;
	IBinding bnd = resolver.getBinding( name);

	if (bnd == null) {
		bnd = resolver.mkStubKey(name, Type.class);
	}

	NamedEntity tmp = dico.getEntityByKey(bnd);
	fmx = (Type) tmp;

	if (fmx == null) {	// try to find it in the current context despite the fact that we don't have a IBinding
		fmx = (Type) resolver.findInParent(name.toString(), getContext().top(), /*recursive*/true);
	}

	if (fmx == null) {  // still not found, create it
		if (isParameterTypeInstanceName(name.toString())) {
			fmx = referedParameterTypeInstance(bnd, name);
		}
		else {
			QualifiedName qualName = new QualifiedName(name);
			fmx = dico.ensureFamixType(bnd, qualName.unqualifiedName(), /*owner*/(ContainerEntity)resolver.resolveOrCreate(qualName.nameQualifiers().toString(), /*mayBeNull*/false, /*mustBeClass*/false));
		}
	}

	return fmx;
}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:32,代码来源:AbstractRefVisitor.java


示例13: visit

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的package包/类
protected void visit(IASTPreprocessorIfdefStatement node) {
	IASTName macro = node.getMacroReference();
	if (macro != null) {
		PreprocessorIfdef fmx = dico.createFamixPreprocIfdef(macro.toString());
		setIfdefSourceAnchor(fmx, node.getFileLocation());
	}
}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:8,代码来源:PreprocessorStmtDefVisitor.java


示例14: resolveCapture

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的package包/类
private ISourceLocation resolveCapture(ICPPASTCapture node) throws URISyntaxException {
	IASTName name = node.getIdentifier();
	if (name == null) {
		out("Resolving this capture; returning dummy value");
		return FIXME;
	}
	return resolveBinding(name.resolveBinding());
}
 
开发者ID:cwi-swat,项目名称:clair,代码行数:9,代码来源:BindingsResolver.java


示例15: visit

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的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


示例16: setName

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的package包/类
public void setName(IASTName name) {
assertNotFrozen();
this.name = name;
if (name != null) {
	name.setParent(this);
	name.setPropertyInParent(IASTLabelStatement.NAME);
}
  }
 
开发者ID:buntatsu,项目名称:cdt-proc,代码行数:9,代码来源:ProCNullStatement.java


示例17: testExample

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的package包/类
public void testExample() {
    IASTTranslationUnit translationUnit = parseCPP(getCommentAbove());
    ASTNamesVisitor namesVisitor = new ASTNamesVisitor();
    translationUnit.accept(namesVisitor);
    IASTName name = namesVisitor.getNames().get(0);
    // EScoped1
    assertTrue(name.resolveBinding() instanceof ICPPEnumeration);
}
 
开发者ID:magicsky,项目名称:sya,代码行数:9,代码来源:ICPPEnumerationExample.java


示例18: testExample

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的package包/类
public void testExample() {
    IASTTranslationUnit translationUnit = parseCPP(getCommentAbove());
    ASTNamesVisitor namesVisitor = new ASTNamesVisitor();
    translationUnit.accept(namesVisitor);
    // class A : public B, public C {};中的A
    IASTName name = namesVisitor.getNames().get(6);
    ICPPClassType classType = (ICPPClassType) name.resolveBinding();
    // A(void)
    ICPPConstructor constructor = classType.getConstructors()[0];
    assertEquals("A(void)", constructor.toString());
}
 
开发者ID:magicsky,项目名称:sya,代码行数:12,代码来源:ICPPConstructorExample.java


示例19: testExample

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的package包/类
public void testExample() {
    IASTTranslationUnit translationUnit = parseCPP(getCommentAbove());
    ASTNamesVisitor namesVisitor = new ASTNamesVisitor();
    translationUnit.accept(namesVisitor);
    IASTName name = namesVisitor.getNames().get(1);
    ICPPFunction function = (ICPPFunction) name.resolveBinding();
    assertEquals("f", function.getName());
}
 
开发者ID:magicsky,项目名称:sya,代码行数:9,代码来源:ICPPFunctionExample.java


示例20: testExample

import org.eclipse.cdt.core.dom.ast.IASTName; //导入依赖的package包/类
public void testExample() {
    IASTTranslationUnit translationUnit = parseCPP(getCommentAbove());
    ASTNamesVisitor namesVisitor = new ASTNamesVisitor();
    translationUnit.accept(namesVisitor);
    IASTName name = namesVisitor.getNames().get(1);
    ICPPField field = (ICPPField) name.resolveBinding();
    assertEquals("x", field.getName());
}
 
开发者ID:magicsky,项目名称:sya,代码行数:9,代码来源:ICPPFieldExample.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RetryOperationsInterceptor类代码示例发布时间:2022-05-23
下一篇:
Java RequestAbstractType类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap