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


Java LocalVariableIndex.perform方法代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.corext.dom.LocalVariableIndex.perform方法的典型用法代码示例。如果您正苦于以下问题:Java LocalVariableIndex.perform方法的具体用法?Java LocalVariableIndex.perform怎么用?Java LocalVariableIndex.perform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.internal.corext.dom.LocalVariableIndex的用法示例。


在下文中一共展示了LocalVariableIndex.perform方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import org.eclipse.jdt.internal.corext.dom.LocalVariableIndex; //导入方法依赖的package包/类
public void initialize() {
	Block body= fDeclaration.getBody();
	// first collect the static imports. This is necessary to not mark
	// static imported fields and methods as implicit visible.
	fTypesToImport= new ArrayList<SimpleName>();
	fStaticsToImport= new ArrayList<SimpleName>();
	ImportReferencesCollector.collect(body, fTypeRoot.getJavaProject(), null, fTypesToImport, fStaticsToImport);

	// Now collect implicit references and name references
	body.accept(new UpdateCollector());

	int numberOfLocals= LocalVariableIndex.perform(fDeclaration);
	FlowContext context= new FlowContext(0, numberOfLocals + 1);
	context.setConsiderAccessMode(true);
	context.setComputeMode(FlowContext.MERGE);
	InOutFlowAnalyzer flowAnalyzer= new InOutFlowAnalyzer(context);
	FlowInfo info= flowAnalyzer.perform(getStatements());

	for (Iterator<SingleVariableDeclaration> iter= fDeclaration.parameters().iterator(); iter.hasNext();) {
		SingleVariableDeclaration element= iter.next();
		IVariableBinding binding= element.resolveBinding();
		ParameterData data= (ParameterData)element.getProperty(ParameterData.PROPERTY);
		data.setAccessMode(info.getAccessMode(context, binding));
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:SourceAnalyzer.java

示例2: initialize

import org.eclipse.jdt.internal.corext.dom.LocalVariableIndex; //导入方法依赖的package包/类
public void initialize() {
  Block body = fDeclaration.getBody();
  // first collect the static imports. This is necessary to not mark
  // static imported fields and methods as implicit visible.
  fTypesToImport = new ArrayList<SimpleName>();
  fStaticsToImport = new ArrayList<SimpleName>();
  ImportReferencesCollector.collect(
      body, fTypeRoot.getJavaProject(), null, fTypesToImport, fStaticsToImport);

  // Now collect implicit references and name references
  body.accept(new UpdateCollector());

  int numberOfLocals = LocalVariableIndex.perform(fDeclaration);
  FlowContext context = new FlowContext(0, numberOfLocals + 1);
  context.setConsiderAccessMode(true);
  context.setComputeMode(FlowContext.MERGE);
  InOutFlowAnalyzer flowAnalyzer = new InOutFlowAnalyzer(context);
  FlowInfo info = flowAnalyzer.perform(getStatements());

  for (Iterator<SingleVariableDeclaration> iter = fDeclaration.parameters().iterator();
      iter.hasNext(); ) {
    SingleVariableDeclaration element = iter.next();
    IVariableBinding binding = element.resolveBinding();
    ParameterData data = (ParameterData) element.getProperty(ParameterData.PROPERTY);
    data.setAccessMode(info.getAccessMode(context, binding));
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:28,代码来源:SourceAnalyzer.java

示例3: initialize

import org.eclipse.jdt.internal.corext.dom.LocalVariableIndex; //导入方法依赖的package包/类
public void initialize(BodyDeclaration declaration) {
  fBodyDeclaration = declaration;
  fRootScope =
      CodeScopeBuilder.perform(declaration, fSourceProvider.getDeclaration().resolveBinding());
  fNumberOfLocals = 0;
  switch (declaration.getNodeType()) {
    case ASTNode.METHOD_DECLARATION:
    case ASTNode.INITIALIZER:
      fNumberOfLocals = LocalVariableIndex.perform(declaration);
      break;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:13,代码来源:CallInliner.java

示例4: initialize

import org.eclipse.jdt.internal.corext.dom.LocalVariableIndex; //导入方法依赖的package包/类
public void initialize(BodyDeclaration declaration) {
	fBodyDeclaration= declaration;
	fRootScope= CodeScopeBuilder.perform(declaration, fSourceProvider.getDeclaration().resolveBinding());
	fNumberOfLocals= 0;
	switch (declaration.getNodeType()) {
		case ASTNode.METHOD_DECLARATION:
		case ASTNode.INITIALIZER:
			fNumberOfLocals= LocalVariableIndex.perform(declaration);
			break;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:CallInliner.java

示例5: markReferences

import org.eclipse.jdt.internal.corext.dom.LocalVariableIndex; //导入方法依赖的package包/类
private void markReferences() {
	fCaughtExceptions= new ArrayList<ITypeBinding>();
	boolean isVoid= true;
	Type returnType= fMethodDeclaration.getReturnType2();
	if (returnType != null) {
		ITypeBinding returnTypeBinding= returnType.resolveBinding();
		isVoid= returnTypeBinding != null && Bindings.isVoidType(returnTypeBinding);
	}
	fMethodDeclaration.accept(this);
	Block block= fMethodDeclaration.getBody();
	if (block != null) {
		List<Statement> statements= block.statements();
		if (statements.size() > 0) {
			Statement last= statements.get(statements.size() - 1);
			int maxVariableId= LocalVariableIndex.perform(fMethodDeclaration);
			FlowContext flowContext= new FlowContext(0, maxVariableId + 1);
			flowContext.setConsiderAccessMode(false);
			flowContext.setComputeMode(FlowContext.ARGUMENTS);
			InOutFlowAnalyzer flowAnalyzer= new InOutFlowAnalyzer(flowContext);
			FlowInfo info= flowAnalyzer.perform(new ASTNode[] {last});
			if (!info.isNoReturn() && !isVoid) {
				if (!info.isPartialReturn())
					return;
			}
		}
		int offset= fMethodDeclaration.getStartPosition() + fMethodDeclaration.getLength() - 1; // closing bracket
		fResult.add(new OccurrenceLocation(offset, 1, 0, fExitDescription));
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:30,代码来源:MethodExitsFinder.java

示例6: checkInitialConditions

import org.eclipse.jdt.internal.corext.dom.LocalVariableIndex; //导入方法依赖的package包/类
public RefactoringStatus checkInitialConditions(ImportRewrite rewriter) {
	RefactoringStatus result= getStatus();
	checkExpression(result);
	if (result.hasFatalError())
		return result;

	fReturnKind= UNDEFINED;
	fMaxVariableId= LocalVariableIndex.perform(fEnclosingBodyDeclaration);
	if (analyzeSelection(result).hasFatalError())
		return result;

	int returns= fReturnKind == NO ? 0 : 1;
	if (fReturnValue != null) {
		fReturnKind= ACCESS_TO_LOCAL;
		returns++;
	}
	if (isExpressionSelected()) {
		fReturnKind= EXPRESSION;
		returns++;
	}

	if (returns > 1) {
		result.addFatalError(RefactoringCoreMessages.ExtractMethodAnalyzer_ambiguous_return_value, JavaStatusContext.create(fCUnit, getSelection()));
		fReturnKind= MULTIPLE;
		return result;
	}
	initReturnType(rewriter);
	return result;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:30,代码来源:ExtractMethodAnalyzer.java

示例7: checkInitialConditions

import org.eclipse.jdt.internal.corext.dom.LocalVariableIndex; //导入方法依赖的package包/类
public RefactoringStatus checkInitialConditions(ImportRewrite rewriter) {
  RefactoringStatus result = getStatus();
  checkExpression(result);
  if (result.hasFatalError()) return result;

  List<ASTNode> validDestinations = new ArrayList<ASTNode>();
  ASTNode destination = ASTResolving.findParentType(fEnclosingBodyDeclaration.getParent());
  while (destination != null) {
    if (isValidDestination(destination)) {
      validDestinations.add(destination);
    }
    destination = ASTResolving.findParentType(destination.getParent());
  }
  if (validDestinations.size() == 0) {
    result.addFatalError(RefactoringCoreMessages.ExtractMethodAnalyzer_no_valid_destination_type);
    return result;
  }

  fReturnKind = UNDEFINED;
  fMaxVariableId = LocalVariableIndex.perform(fEnclosingBodyDeclaration);
  if (analyzeSelection(result).hasFatalError()) return result;

  int returns = fReturnKind == NO ? 0 : 1;
  if (fReturnValue != null) {
    fReturnKind = ACCESS_TO_LOCAL;
    returns++;
  }
  if (isExpressionSelected()) {
    fReturnKind = EXPRESSION;
    returns++;
  }

  if (returns > 1) {
    result.addFatalError(
        RefactoringCoreMessages.ExtractMethodAnalyzer_ambiguous_return_value,
        JavaStatusContext.create(fCUnit, getSelection()));
    fReturnKind = MULTIPLE;
    return result;
  }
  initReturnType(rewriter);
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:43,代码来源:ExtractMethodAnalyzer.java

示例8: checkInitialConditions

import org.eclipse.jdt.internal.corext.dom.LocalVariableIndex; //导入方法依赖的package包/类
public RefactoringStatus checkInitialConditions(ImportRewrite rewriter) {
	RefactoringStatus result= getStatus();
	checkExpression(result);
	if (result.hasFatalError())
		return result;

	List<ASTNode> validDestinations= new ArrayList<ASTNode>();
	ASTNode destination= ASTResolving.findParentType(fEnclosingBodyDeclaration.getParent());
	while (destination != null) {
		if (isValidDestination(destination)) {
			validDestinations.add(destination);
		}
		destination= ASTResolving.findParentType(destination.getParent());
	}
	if (validDestinations.size() == 0) {
		result.addFatalError(RefactoringCoreMessages.ExtractMethodAnalyzer_no_valid_destination_type);
		return result;
	}

	fReturnKind= UNDEFINED;
	fMaxVariableId= LocalVariableIndex.perform(fEnclosingBodyDeclaration);
	if (analyzeSelection(result).hasFatalError())
		return result;

	int returns= fReturnKind == NO ? 0 : 1;
	if (fReturnValue != null) {
		fReturnKind= ACCESS_TO_LOCAL;
		returns++;
	}
	if (isExpressionSelected()) {
		fReturnKind= EXPRESSION;
		returns++;
	}

	if (returns > 1) {
		result.addFatalError(RefactoringCoreMessages.ExtractMethodAnalyzer_ambiguous_return_value, JavaStatusContext.create(fCUnit, getSelection()));
		fReturnKind= MULTIPLE;
		return result;
	}
	initReturnType(rewriter);
	return result;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:43,代码来源:ExtractMethodAnalyzer.java


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