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


Java IASTFunctionDeclarator类代码示例

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


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

示例1: getFunctionBinding

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

示例2: ensureBehavioural

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

示例3: ensureBehaviouralFromName

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

示例4: visit

import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; //导入依赖的package包/类
@Override
	public int visit(IASTDeclarator node) {
		/* ********************************************************************************************
		 * BE CAREFULL: The order of the tests is important because choices are not mutually exclusive
		 * ex: ICPPASTFunctionDeclarator is a sub-interface of IASTFunctionDeclarator
		 * ******************************************************************************************** */
		if (node instanceof ICPPASTFunctionDeclarator) {
			return this.visit((ICPPASTFunctionDeclarator)node);
		}
		else if (node instanceof IASTStandardFunctionDeclarator) {
			return this.visit((IASTStandardFunctionDeclarator)node);
		}
		else if (node instanceof ICASTKnRFunctionDeclarator) {
			return this.visit((ICASTKnRFunctionDeclarator)node);
		}
		else if (node instanceof IASTFunctionDeclarator) {
			return this.visit((IASTFunctionDeclarator)node);
		}
		else if (node instanceof IASTFieldDeclarator) {  // actually seems to never occur ???
			return this.visit((IASTFieldDeclarator)node);
		}
/* removed to deal with C attributes: IASTDeclarators
  		else if (node instanceof ICPPASTDeclarator) {
			return this.visit((ICPPASTDeclarator)node);
		}
	replaced by the following:
*/	
  		else {
			return this.visitInternal(node);
		}
	}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:32,代码来源:AbstractDispatcherVisitor.java

示例5: processFunctionDeclarator

import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; //导入依赖的package包/类
protected void processFunctionDeclarator(IASTFunctionDeclarator node) {
	BehaviouralEntity fmx;
	super.visit(node);  // gets the behavioural
	fmx = (BehaviouralEntity) returnedEntity;

	if ( (fmx != null) && (! resolver.isConstructor(fmx)) && (! resolver.isDestructor(fmx)) ) {
		fmx.setDeclaredType(referredType);
	}
}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:10,代码来源:DeclaredTypeRefVisitor.java

示例6: visit

import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; //导入依赖的package包/类
@Override
protected int visit(IASTFunctionDeclarator node) {
	if (! inCastExpression) {
		super.visit(node);
		return PROCESS_SKIP;
	}
	else {
		// this is something like a cast to a fonction pointer type
		// do not deal with the FunctionDeclarator, but handle its possible parameter type
		return PROCESS_CONTINUE;
	}
	
}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:14,代码来源:ReferenceRefVisitor.java

示例7: visit

import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; //导入依赖的package包/类
@Override
protected int visit(IASTFunctionDeclarator node) {
	if (! inCastExpression) {
		super.visit(node);
	}
	// else this is something like a cast to a function pointer type: do not handle it
	
	return PROCESS_SKIP;
}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:10,代码来源:InvocationAccessRefVisitor.java

示例8: visit

import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; //导入依赖的package包/类
@Override
protected int visit(IASTFunctionDeclarator node) {
	// get node name and bnd
	super.visit(node);
	if (nodeBnd instanceof IVariable) {
		// declaration of a function pointer such as var in "int (*var)(int param1, char param2)"
		returnedEntity = null;
	}
	else {
		returnedEntity = resolver.ensureBehavioural(node, nodeBnd, nodeName);
	}

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

示例9: signatureFromAST

import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; //导入依赖的package包/类
static public String signatureFromAST(IASTFunctionDeclarator node) {
	String behavName;
	// for behavioral, we put the full signature in the key to have better chance of recovering it
	SignatureBuilderVisitor sigVisitor = new SignatureBuilderVisitor();
	node.accept(sigVisitor);
	behavName = sigVisitor.getSignature();
	return behavName;
}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:9,代码来源:SignatureBuilderVisitor.java

示例10: visit

import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; //导入依赖的package包/类
@Override
protected int visit(ICPPASTFunctionDeclarator node) {
	// compute nodeName and binding
	super.visit( (IASTFunctionDeclarator)node);

	returnedEntity = (BehaviouralEntity) dico.getEntityByKey(nodeBnd);
	// try harder
	if (returnedEntity == null) {
		returnedEntity = resolver.ensureBehaviouralFromName(node, nodeBnd, nodeName);
	}

	// Not visiting children, because assuming there is no template inside a method
	return PROCESS_SKIP;
}
 
开发者ID:Synectique,项目名称:VerveineC-Cpp,代码行数:15,代码来源:TemplateParameterDefVisitor.java

示例11: visit

import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; //导入依赖的package包/类
@Override
protected int visit(IASTFunctionDeclarator node) {
	// get node name and bnd in case we have a function pointer such as var in "int (*var)(int param1, char param2)"
	super.visit( node);
	if (nodeBnd instanceof IVariable) {
		nodeName = node.getNestedDeclarator().getName();
		ensureVariableKind(nodeBnd, nodeName);
	}

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

示例12: visitFunctionDeclarator

import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; //导入依赖的package包/类
protected BehaviouralEntity visitFunctionDeclarator(IASTFunctionDeclarator node, IASTNode[] params) {
	BehaviouralEntity fmx;
	Type classCtxt = null;

	if (declarationIsFriend(node)) {
		// friend function are outside the scope of the class
		// so remove the class from the context stack
		classCtxt = (Type) getContext().pop();
	}

	fmx = resolver.ensureBehavioural(node, nodeBnd, nodeName);
	dico.setVisibility(fmx, currentVisibility);

	// parent node is a SimpleDeclaration or a FunctionDefinition
	IASTFileLocation defLoc = node.getParent().getFileLocation();
	dico.addSourceAnchorMulti(fmx, filename, defLoc);

	if (resolver.isDestructorBinding(nodeBnd)) {
		((Method)fmx).setKind(CDictionary.DESTRUCTOR_KIND_MARKER);
	}
	if (resolver.isConstructorBinding(nodeBnd)) {
		((Method)fmx).setKind(Dictionary.CONSTRUCTOR_KIND_MARKER);
	}
	fmx.setIsStub(false);  // used to say TRUE if could not find a binding. Not too sure ... 

	visitParameters(params, fmx);

	if (declarationIsFriend(node)) {
		// friend function are outside the scope of the class
		// push back the class in the context stack
		getContext().push(classCtxt);
	}

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

示例13: declarationIsFriend

import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; //导入依赖的package包/类
protected boolean declarationIsFriend(IASTFunctionDeclarator node) {
	IASTNode parentDecl = node.getParent();
	if (parentDecl instanceof IASTSimpleDeclaration) {
		IASTDeclSpecifier spec = ((IASTSimpleDeclaration)parentDecl).getDeclSpecifier();
		if (spec instanceof ICPPASTDeclSpecifier) {
			return ((ICPPASTDeclSpecifier) spec).isFriend();
		}
	}

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

示例14: visit

import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; //导入依赖的package包/类
@Override
public int visit(IASTDeclarator declarator) {
	if (declarator instanceof IASTArrayDeclarator)
		visit((IASTArrayDeclarator) declarator);
	// else if (declarator instanceof IASTFieldDeclarator)
	// visit((IASTFieldDeclarator) declarator);
	else if (declarator instanceof IASTFunctionDeclarator)
		visit((IASTFunctionDeclarator) declarator);
	else if (declarator instanceof ICPPASTDeclarator)
		visit((ICPPASTDeclarator) declarator);
	else {
		// TODO: add attributes
		List<IConstructor> pointerOperators = new ArrayList<IConstructor>();
		Stream.of(declarator.getPointerOperators()).forEach(it -> {
			it.accept(this);
			pointerOperators.add(stack.pop());
		});
		IConstructor nestedDeclarator = null;
		if (declarator.getNestedDeclarator() != null) {
			declarator.getNestedDeclarator().accept(this);
			nestedDeclarator = stack.pop();
		}
		declarator.getName().accept(this);
		IConstructor name = stack.pop();
		IConstructor initializer = null;
		if (declarator.getInitializer() == null) {

		} else {
			declarator.getInitializer().accept(this);
			initializer = stack.pop();
		}

		throw new RuntimeException("NYI");
	}
	return PROCESS_ABORT;
}
 
开发者ID:cwi-swat,项目名称:clair,代码行数:37,代码来源:Parser.java

示例15: testExample

import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; //导入依赖的package包/类
public void testExample() {
    IASTTranslationUnit translationUnit = parseCPP(getCommentAbove());
    IASTFunctionDefinition functionDefinition = (IASTFunctionDefinition) translationUnit.getDeclarations()[1];
    // f(int y)
    assertTrue(functionDefinition.getDeclarator() instanceof IASTFunctionDeclarator);
}
 
开发者ID:magicsky,项目名称:sya,代码行数:7,代码来源:IASTFunctionDeclaratorExample.java


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