本文整理了Java中org.eclipse.jdt.internal.compiler.lookup.BlockScope.namedMethodScope()
方法的一些代码示例,展示了BlockScope.namedMethodScope()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BlockScope.namedMethodScope()
方法的具体详情如下:
包路径:org.eclipse.jdt.internal.compiler.lookup.BlockScope
类名称:BlockScope
方法名:namedMethodScope
暂无
代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion
public TypeBinding resolveType(BlockScope scope) {
this.constant = Constant.NotAConstant;
ReferenceBinding enclosingReceiverType = scope.enclosingReceiverType();
if (!isImplicitThis() &&!checkAccess(scope, enclosingReceiverType)) {
return null;
}
this.resolvedType = enclosingReceiverType;
MethodScope methodScope = scope.namedMethodScope();
if (methodScope != null) {
MethodBinding method = methodScope.referenceMethodBinding();
if (method != null && method.receiver != null && TypeBinding.equalsEquals(method.receiver, this.resolvedType))
this.resolvedType = method.receiver;
}
return this.resolvedType;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/ecj
public TypeBinding resolveType(BlockScope scope) {
this.constant = Constant.NotAConstant;
ReferenceBinding enclosingReceiverType = scope.enclosingReceiverType();
if (!isImplicitThis() &&!checkAccess(scope, enclosingReceiverType)) {
return null;
}
this.resolvedType = enclosingReceiverType;
MethodScope methodScope = scope.namedMethodScope();
if (methodScope != null) {
MethodBinding method = methodScope.referenceMethodBinding();
if (method != null && method.receiver != null && TypeBinding.equalsEquals(method.receiver, this.resolvedType))
this.resolvedType = method.receiver;
}
return this.resolvedType;
}
代码示例来源:origin: com.vaadin/vaadin-client-compiler-deps
public TypeBinding resolveType(BlockScope scope) {
this.constant = Constant.NotAConstant;
ReferenceBinding enclosingReceiverType = scope.enclosingReceiverType();
if (!isImplicitThis() &&!checkAccess(scope, enclosingReceiverType)) {
return null;
}
this.resolvedType = enclosingReceiverType;
MethodScope methodScope = scope.namedMethodScope();
if (methodScope != null) {
MethodBinding method = methodScope.referenceMethodBinding();
if (method != null && method.receiver != null && TypeBinding.equalsEquals(method.receiver, this.resolvedType))
this.resolvedType = method.receiver;
}
return this.resolvedType;
}
代码示例来源:origin: org.eclipse.jdt.core.compiler/ecj
public TypeBinding resolveType(BlockScope scope) {
this.constant = Constant.NotAConstant;
ReferenceBinding enclosingReceiverType = scope.enclosingReceiverType();
if (!isImplicitThis() &&!checkAccess(scope, enclosingReceiverType)) {
return null;
}
this.resolvedType = enclosingReceiverType;
MethodScope methodScope = scope.namedMethodScope();
if (methodScope != null) {
MethodBinding method = methodScope.referenceMethodBinding();
if (method != null && method.receiver != null && TypeBinding.equalsEquals(method.receiver, this.resolvedType))
this.resolvedType = method.receiver;
}
return this.resolvedType;
}
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
public TypeBinding resolveType(BlockScope scope) {
this.constant = Constant.NotAConstant;
ReferenceBinding enclosingReceiverType = scope.enclosingReceiverType();
if (!isImplicitThis() &&!checkAccess(scope, enclosingReceiverType)) {
return null;
}
this.resolvedType = enclosingReceiverType;
MethodScope methodScope = scope.namedMethodScope();
if (methodScope != null) {
MethodBinding method = methodScope.referenceMethodBinding();
if (method != null && method.receiver != null && TypeBinding.equalsEquals(method.receiver, this.resolvedType))
this.resolvedType = method.receiver;
}
return this.resolvedType;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
public TypeBinding resolveType(BlockScope scope) {
this.constant = Constant.NotAConstant;
ReferenceBinding enclosingReceiverType = scope.enclosingReceiverType();
if (!isImplicitThis() &&!checkAccess(scope, enclosingReceiverType)) {
return null;
}
this.resolvedType = enclosingReceiverType;
MethodScope methodScope = scope.namedMethodScope();
if (methodScope != null) {
MethodBinding method = methodScope.referenceMethodBinding();
if (method != null && method.receiver != null && TypeBinding.equalsEquals(method.receiver, this.resolvedType))
this.resolvedType = method.receiver;
}
return this.resolvedType;
}
代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core
public TypeBinding resolveType(BlockScope scope) {
this.constant = Constant.NotAConstant;
ReferenceBinding enclosingReceiverType = scope.enclosingReceiverType();
if (!isImplicitThis() &&!checkAccess(scope, enclosingReceiverType)) {
return null;
}
this.resolvedType = enclosingReceiverType;
MethodScope methodScope = scope.namedMethodScope();
if (methodScope != null) {
MethodBinding method = methodScope.referenceMethodBinding();
if (method != null && method.receiver != null && TypeBinding.equalsEquals(method.receiver, this.resolvedType))
this.resolvedType = method.receiver;
}
return this.resolvedType;
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
@Override
public TypeBinding resolveType(BlockScope scope) {
this.constant = Constant.NotAConstant;
ReferenceBinding enclosingReceiverType = scope.enclosingReceiverType();
if (!isImplicitThis() &&!checkAccess(scope, enclosingReceiverType)) {
return null;
}
this.resolvedType = enclosingReceiverType;
MethodScope methodScope = scope.namedMethodScope();
if (methodScope != null) {
MethodBinding method = methodScope.referenceMethodBinding();
if (method != null && method.receiver != null && TypeBinding.equalsEquals(method.receiver, this.resolvedType))
this.resolvedType = method.receiver;
}
return this.resolvedType;
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
private JavaElement getJavaElement(LocalVariableBinding binding) {
LocalDeclaration local = binding.declaration;
JavaElement parent = null;
ReferenceContext referenceContext = binding.declaringScope.isLambdaSubscope() ? binding.declaringScope.namedMethodScope().referenceContext() : binding.declaringScope.referenceContext();
if (referenceContext instanceof AbstractMethodDeclaration) {
AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) referenceContext;
parent = this.getJavaElementOfCompilationUnit(methodDeclaration, methodDeclaration.binding);
} else if (referenceContext instanceof TypeDeclaration){
// Local variable is declared inside an initializer
TypeDeclaration typeDeclaration = (TypeDeclaration) referenceContext;
JavaElement type = this.getJavaElementOfCompilationUnit(typeDeclaration, typeDeclaration.binding);
parent = Util.getUnresolvedJavaElement(local.sourceStart, local.sourceEnd, type);
}
if (parent == null) return null;
return new LocalVariable(
parent,
new String(local.name),
local.declarationSourceStart,
local.declarationSourceEnd,
local.sourceStart,
local.sourceEnd,
local.type == null ? Signature.createTypeSignature(binding.type.signableName(), true) : Util.typeSignature(local.type),
binding.declaration.annotations,
local.modifiers,
local.getKind() == AbstractVariableDeclaration.PARAMETER);
}
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
private JavaElement getJavaElement(LocalVariableBinding binding) {
LocalDeclaration local = binding.declaration;
JavaElement parent = null;
ReferenceContext referenceContext = binding.declaringScope.isLambdaSubscope() ? binding.declaringScope.namedMethodScope().referenceContext() : binding.declaringScope.referenceContext();
if (referenceContext instanceof AbstractMethodDeclaration) {
AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) referenceContext;
parent = this.getJavaElementOfCompilationUnit(methodDeclaration, methodDeclaration.binding);
} else if (referenceContext instanceof TypeDeclaration){
// Local variable is declared inside an initializer
TypeDeclaration typeDeclaration = (TypeDeclaration) referenceContext;
JavaElement type = this.getJavaElementOfCompilationUnit(typeDeclaration, typeDeclaration.binding);
parent = Util.getUnresolvedJavaElement(local.sourceStart, local.sourceEnd, type);
}
if (parent == null) return null;
return new LocalVariable(
parent,
new String(local.name),
local.declarationSourceStart,
local.declarationSourceEnd,
local.sourceStart,
local.sourceEnd,
local.type == null ? Signature.createTypeSignature(binding.type.signableName(), true) : Util.typeSignature(local.type),
binding.declaration.annotations,
local.modifiers,
local.getKind() == AbstractVariableDeclaration.PARAMETER);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
private JavaElement getJavaElement(LocalVariableBinding binding) {
LocalDeclaration local = binding.declaration;
JavaElement parent = null;
ReferenceContext referenceContext = binding.declaringScope.isLambdaSubscope() ? binding.declaringScope.namedMethodScope().referenceContext() : binding.declaringScope.referenceContext();
if (referenceContext instanceof AbstractMethodDeclaration) {
AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) referenceContext;
parent = this.getJavaElementOfCompilationUnit(methodDeclaration, methodDeclaration.binding);
} else if (referenceContext instanceof TypeDeclaration){
// Local variable is declared inside an initializer
TypeDeclaration typeDeclaration = (TypeDeclaration) referenceContext;
JavaElement type = this.getJavaElementOfCompilationUnit(typeDeclaration, typeDeclaration.binding);
parent = Util.getUnresolvedJavaElement(local.sourceStart, local.sourceEnd, type);
}
if (parent == null) return null;
return new LocalVariable(
parent,
new String(local.name),
local.declarationSourceStart,
local.declarationSourceEnd,
local.sourceStart,
local.sourceEnd,
local.type == null ? Signature.createTypeSignature(binding.type.signableName(), true) : Util.typeSignature(local.type),
binding.declaration.annotations,
local.modifiers,
local.getKind() == AbstractVariableDeclaration.PARAMETER);
}
代码示例来源:origin: org.eclipse.jdt.core.compiler/ecj
/**
* Returns true if the context requires to check initialization of final blank fields.
* in other words, it is inside an initializer, a constructor or a clinit
*/
public final boolean needBlankFinalFieldInitializationCheck(FieldBinding binding) {
boolean isStatic = binding.isStatic();
ReferenceBinding fieldDeclaringClass = binding.declaringClass;
// loop in enclosing context, until reaching the field declaring context
MethodScope methodScope = namedMethodScope();
while (methodScope != null) {
if (methodScope.isStatic != isStatic)
return false;
if (!methodScope.isInsideInitializer() // inside initializer
&& !((AbstractMethodDeclaration) methodScope.referenceContext).isInitializationMethod()) { // inside constructor or clinit
return false; // found some non-initializer context
}
ReferenceBinding enclosingType = methodScope.enclosingReceiverType();
if (TypeBinding.equalsEquals(enclosingType, fieldDeclaringClass)) {
return true; // found the field context, no need to check any further
}
if (!enclosingType.erasure().isAnonymousType()) {
return false; // only check inside anonymous type
}
methodScope = methodScope.enclosingMethodScope().namedMethodScope();
}
return false;
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
/**
* Returns true if the context requires to check initialization of final blank fields.
* in other words, it is inside an initializer, a constructor or a clinit
*/
public final boolean needBlankFinalFieldInitializationCheck(FieldBinding binding) {
boolean isStatic = binding.isStatic();
ReferenceBinding fieldDeclaringClass = binding.declaringClass;
// loop in enclosing context, until reaching the field declaring context
MethodScope methodScope = namedMethodScope();
while (methodScope != null) {
if (methodScope.isStatic != isStatic)
return false;
if (!methodScope.isInsideInitializer() // inside initializer
&& !((AbstractMethodDeclaration) methodScope.referenceContext).isInitializationMethod()) { // inside constructor or clinit
return false; // found some non-initializer context
}
ReferenceBinding enclosingType = methodScope.enclosingReceiverType();
if (TypeBinding.equalsEquals(enclosingType, fieldDeclaringClass)) {
return true; // found the field context, no need to check any further
}
if (!enclosingType.erasure().isAnonymousType()) {
return false; // only check inside anonymous type
}
methodScope = methodScope.enclosingMethodScope().namedMethodScope();
}
return false;
}
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
/**
* Returns true if the context requires to check initialization of final blank fields.
* in other words, it is inside an initializer, a constructor or a clinit
*/
public final boolean needBlankFinalFieldInitializationCheck(FieldBinding binding) {
boolean isStatic = binding.isStatic();
ReferenceBinding fieldDeclaringClass = binding.declaringClass;
// loop in enclosing context, until reaching the field declaring context
MethodScope methodScope = namedMethodScope();
while (methodScope != null) {
if (methodScope.isStatic != isStatic)
return false;
if (!methodScope.isInsideInitializer() // inside initializer
&& !((AbstractMethodDeclaration) methodScope.referenceContext).isInitializationMethod()) { // inside constructor or clinit
return false; // found some non-initializer context
}
ReferenceBinding enclosingType = methodScope.enclosingReceiverType();
if (TypeBinding.equalsEquals(enclosingType, fieldDeclaringClass)) {
return true; // found the field context, no need to check any further
}
if (!enclosingType.erasure().isAnonymousType()) {
return false; // only check inside anonymous type
}
methodScope = methodScope.enclosingMethodScope().namedMethodScope();
}
return false;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
/**
* Returns true if the context requires to check initialization of final blank fields.
* in other words, it is inside an initializer, a constructor or a clinit
*/
public final boolean needBlankFinalFieldInitializationCheck(FieldBinding binding) {
boolean isStatic = binding.isStatic();
ReferenceBinding fieldDeclaringClass = binding.declaringClass;
// loop in enclosing context, until reaching the field declaring context
MethodScope methodScope = namedMethodScope();
while (methodScope != null) {
if (methodScope.isStatic != isStatic)
return false;
if (!methodScope.isInsideInitializer() // inside initializer
&& !((AbstractMethodDeclaration) methodScope.referenceContext).isInitializationMethod()) { // inside constructor or clinit
return false; // found some non-initializer context
}
ReferenceBinding enclosingType = methodScope.enclosingReceiverType();
if (TypeBinding.equalsEquals(enclosingType, fieldDeclaringClass)) {
return true; // found the field context, no need to check any further
}
if (!enclosingType.erasure().isAnonymousType()) {
return false; // only check inside anonymous type
}
methodScope = methodScope.enclosingMethodScope().namedMethodScope();
}
return false;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/ecj
/**
* Returns true if the context requires to check initialization of final blank fields.
* in other words, it is inside an initializer, a constructor or a clinit
*/
public final boolean needBlankFinalFieldInitializationCheck(FieldBinding binding) {
boolean isStatic = binding.isStatic();
ReferenceBinding fieldDeclaringClass = binding.declaringClass;
// loop in enclosing context, until reaching the field declaring context
MethodScope methodScope = namedMethodScope();
while (methodScope != null) {
if (methodScope.isStatic != isStatic)
return false;
if (!methodScope.isInsideInitializer() // inside initializer
&& !((AbstractMethodDeclaration) methodScope.referenceContext).isInitializationMethod()) { // inside constructor or clinit
return false; // found some non-initializer context
}
ReferenceBinding enclosingType = methodScope.enclosingReceiverType();
if (TypeBinding.equalsEquals(enclosingType, fieldDeclaringClass)) {
return true; // found the field context, no need to check any further
}
if (!enclosingType.erasure().isAnonymousType()) {
return false; // only check inside anonymous type
}
methodScope = methodScope.enclosingMethodScope().namedMethodScope();
}
return false;
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
MethodScope methodScope = scope.namedMethodScope();
if (methodScope != null) {
MethodBinding method = methodScope.referenceMethodBinding();
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
MethodScope methodScope = scope.namedMethodScope();
if (methodScope != null) {
MethodBinding method = methodScope.referenceMethodBinding();
代码示例来源:origin: org.eclipse.jdt.core.compiler/ecj
MethodScope methodScope = scope.namedMethodScope();
if (methodScope != null) {
MethodBinding method = methodScope.referenceMethodBinding();
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
MethodScope methodScope = scope.namedMethodScope();
if (methodScope != null) {
MethodBinding method = methodScope.referenceMethodBinding();
内容来源于网络,如有侵权,请联系作者删除!