本文整理了Java中org.eclipse.xtext.xbase.XMemberFeatureCall.getMemberCallTarget()
方法的一些代码示例,展示了XMemberFeatureCall.getMemberCallTarget()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMemberFeatureCall.getMemberCallTarget()
方法的具体详情如下:
包路径:org.eclipse.xtext.xbase.XMemberFeatureCall
类名称:XMemberFeatureCall
方法名:getMemberCallTarget
[英]Returns the value of the 'Member Call Target' containment reference.
If the meaning of the 'Member Call Target' containment reference isn't clear, there really should be more of a description here...
[中]返回“成员调用目标”包含引用的值。
如果“Member Call Target”包含引用的含义不清楚,那么这里真的应该有更多的描述。。。
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
private int countSegments(XMemberFeatureCall call) {
int result = 1;
while(call.getMemberCallTarget() instanceof XMemberFeatureCall) {
call = (XMemberFeatureCall) call.getMemberCallTarget();
result++;
}
return result;
}
代码示例来源:origin: org.eclipse.xtend/org.eclipse.xtend.core
protected String _getFullName(final XMemberFeatureCall call) {
final String prefix = this.getFullName(call.getMemberCallTarget());
String _concreteSyntaxFeatureName = call.getConcreteSyntaxFeatureName();
return ((prefix + ".") + _concreteSyntaxFeatureName);
}
代码示例来源:origin: io.sarl.lang/io.sarl.lang
/** Convert the boolean constant to the object equivalent if possible.
*
* @param expression the expression to convert.
* @return one of the boolean constants {@link Boolean#TRUE} or {@link Boolean#FALSE},
* or {@code null} if the expression is not a constant boolean expression.
*/
@SuppressWarnings("static-method")
public Boolean toBooleanPrimitiveWrapperConstant(XExpression expression) {
if (expression instanceof XBooleanLiteral) {
return ((XBooleanLiteral) expression).isIsTrue() ? Boolean.TRUE : Boolean.FALSE;
}
if (expression instanceof XMemberFeatureCall) {
final XMemberFeatureCall call = (XMemberFeatureCall) expression;
final XExpression receiver = call.getMemberCallTarget();
if (receiver instanceof XFeatureCall) {
final XFeatureCall call2 = (XFeatureCall) receiver;
final String call2Identifier = call2.getConcreteSyntaxFeatureName();
if (Boolean.class.getSimpleName().equals(call2Identifier) || Boolean.class.getName().equals(call2Identifier)) {
final String callIdentifier = call.getConcreteSyntaxFeatureName();
if ("TRUE".equals(callIdentifier)) { //$NON-NLS-1$
return Boolean.TRUE;
} else if ("FALSE".equals(callIdentifier)) { //$NON-NLS-1$
return Boolean.FALSE;
}
}
}
}
return null;
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
protected XAbstractFeatureCall doGetRootTypeLiteral(XMemberFeatureCall featureCall) {
boolean staticNotation = featureCall.isExplicitStatic();
XMemberFeatureCall current = featureCall;
while(current.eContainingFeature() == XbasePackage.Literals.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET) {
XMemberFeatureCall container = (XMemberFeatureCall) current.eContainer();
if (container.isExplicitStatic()) {
if (staticNotation == false) {
return current;
}
current = container;
} else if (staticNotation) {
return (XAbstractFeatureCall) current.getMemberCallTarget();
} else {
current = container;
}
}
if (current != featureCall && staticNotation) {
return (XAbstractFeatureCall) current.getMemberCallTarget();
}
return null;
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
protected boolean isValidStaticState(XExpression receiver) {
boolean validStaticState = true;
if (receiver instanceof XMemberFeatureCall) {
XExpression thisReference = ((XMemberFeatureCall) receiver).getMemberCallTarget();
if (thisReference instanceof XFeatureCall && ((XFeatureCall) thisReference).getFeature() instanceof JvmType) {
validStaticState = getSession().isInstanceContext();
}
}
return validStaticState;
}
代码示例来源:origin: io.sarl.lang/io.sarl.lang
private static void loopReceiver(LinkedList<String> sourceFeature, Object obj) {
if (obj instanceof XMemberFeatureCall) {
final XMemberFeatureCall memberFeatureCall = (XMemberFeatureCall) obj;
sourceFeature.addFirst(memberFeatureCall.getFeature().getSimpleName());
loopReceiver(sourceFeature, memberFeatureCall.getMemberCallTarget());
} else if (obj instanceof XFeatureCall) {
final XFeatureCall featureCall = (XFeatureCall) obj;
sourceFeature.addFirst(featureCall.getFeature().getIdentifier());
}
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
@Override
protected ITextRegion getLocationOfContainmentReference(EObject owner, EReference reference, int indexInList, RegionDescription query) {
if (owner instanceof XMemberFeatureCall && reference == XbasePackage.Literals.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET) {
XMemberFeatureCall casted = (XMemberFeatureCall) owner;
if (casted.isExplicitStatic() || casted.isStaticWithDeclaringType()) {
XExpression target = ((XMemberFeatureCall) owner).getMemberCallTarget();
return getTextRegion(target, query);
}
}
return super.getLocationOfContainmentReference(owner, reference, indexInList, query);
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase.ide
protected void completeXMemberFeatureCall(final EObject model, final Assignment assignment, final ContentAssistContext context, final IIdeContentProposalAcceptor acceptor) {
if ((model instanceof XMemberFeatureCall)) {
AbstractElement _terminal = assignment.getTerminal();
this.createReceiverProposals(((XMemberFeatureCall)model).getMemberCallTarget(),
((CrossReference) _terminal), context, acceptor);
} else {
if ((model instanceof XAssignment)) {
AbstractElement _terminal_1 = assignment.getTerminal();
this.createReceiverProposals(((XAssignment)model).getAssignable(),
((CrossReference) _terminal_1), context, acceptor);
}
}
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
public XExpression getSyntacticReceiver(XExpression expression) {
if (expression instanceof XAbstractFeatureCall) {
if (expression instanceof XFeatureCall) {
return null;
}
if (expression instanceof XMemberFeatureCall) {
return ((XMemberFeatureCall) expression).getMemberCallTarget();
}
if (expression instanceof XAssignment) {
return ((XAssignment) expression).getAssignable();
}
if (expression instanceof XBinaryOperation) {
return ((XBinaryOperation) expression).getLeftOperand();
}
if (expression instanceof XUnaryOperation) {
return ((XUnaryOperation) expression).getOperand();
}
if (expression instanceof XPostfixOperation) {
return ((XPostfixOperation) expression).getOperand();
}
}
return null;
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
protected void applyPackageFragment(XMemberFeatureCall memberFeatureCall, JvmDeclaredType type) {
XExpression target = memberFeatureCall.getMemberCallTarget();
state.getResolvedTypes().acceptType(
target,
new NoExpectation(state, false),
state.getReferenceOwner().newParameterizedTypeReference(type),
false,
ConformanceFlags.CHECKED_SUCCESS);
if (target instanceof XMemberFeatureCall) {
applyPackageFragment((XMemberFeatureCall) target, type);
}
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
@Override
public void applyToComputationState() {
super.applyToComputationState();
XAbstractFeatureCall featureCall = getFeatureCall();
if (featureCall instanceof XMemberFeatureCall) {
XExpression target = ((XMemberFeatureCall) featureCall).getMemberCallTarget();
if (target == null || !(target instanceof XAbstractFeatureCall))
throw new IllegalStateException();
XAbstractFeatureCall targetFeatureCall = (XAbstractFeatureCall) target;
ResolvedTypes resolvedTypes = getState().getResolvedTypes();
LightweightTypeReference targetType = resolvedTypes.getActualType(targetFeatureCall.getFeature());
if (targetType == null) {
throw new IllegalStateException();
}
TypeExpectation expectation = new TypeExpectation(null, getState(), false);
resolvedTypes.acceptType(targetFeatureCall, expectation, targetType.copyInto(resolvedTypes.getReferenceOwner()), false, ConformanceFlags.UNCHECKED);
}
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
protected void _visit(final XMemberFeatureCall semanticObj, final INode originNode, final ImportsAcceptor acceptor) {
if (((semanticObj.getFeature() instanceof JvmType) && semanticObj.isTypeLiteral())) {
JvmIdentifiableElement _feature = semanticObj.getFeature();
this.visit(((JvmType) _feature), originNode, acceptor);
}
boolean _isExplicitStatic = semanticObj.isExplicitStatic();
boolean _not = (!_isExplicitStatic);
if (_not) {
final XExpression target = semanticObj.getMemberCallTarget();
if ((target instanceof XAbstractFeatureCall)) {
boolean _isTypeLiteral = ((XAbstractFeatureCall)target).isTypeLiteral();
if (_isTypeLiteral) {
return;
}
}
this.collectStaticImportsFrom(semanticObj, acceptor);
}
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
@Override
public ITextRegion getSignificantTextRegion(EObject element) {
if (element instanceof XAbstractFeatureCall) {
XAbstractFeatureCall typeLiteral = typeLiteralHelper.getRootTypeLiteral((XAbstractFeatureCall) element);
if (typeLiteral != null) {
if (typeLiteral instanceof XMemberFeatureCall) {
XAbstractFeatureCall target = (XAbstractFeatureCall) ((XMemberFeatureCall) typeLiteral).getMemberCallTarget();
if (target.isTypeLiteral()) {
return super.getSignificantTextRegion(typeLiteral);
}
}
INode node = NodeModelUtils.findActualNodeFor(typeLiteral);
if (node != null) {
return toZeroBasedRegion(node.getTextRegionWithLineInformation());
}
}
}
return super.getSignificantTextRegion(element);
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
protected boolean isPotentialTypeLiteralImpl(XExpression featureCall, /* @Nullable */ IResolvedTypes resolvedTypes, boolean staticNotation) {
if (featureCall instanceof XMemberFeatureCall) {
XMemberFeatureCall casted = (XMemberFeatureCall) featureCall;
if (casted.isExplicitOperationCallOrBuilderSyntax() || casted.isNullSafe()) {
return false;
}
XExpression target = casted.getMemberCallTarget();
if (casted.isExplicitStatic() != staticNotation) {
return false;
}
return isPotentialTypeLiteralImpl(target, resolvedTypes, staticNotation);
}
if (featureCall instanceof XFeatureCall) {
XFeatureCall casted = (XFeatureCall) featureCall;
if (casted.isExplicitOperationCallOrBuilderSyntax()) {
return false;
}
if (resolvedTypes == null)
return true;
LightweightTypeReference knownType = resolvedTypes.getActualType(casted);
if (knownType == null || knownType.isUnknown()) {
return true;
}
}
return false;
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
protected IScope doGetTypeScope(XMemberFeatureCall call, JvmType type) {
if (call.isPackageFragment()) {
if (type instanceof JvmDeclaredType) {
int segmentIndex = countSegments(call);
String packageName = ((JvmDeclaredType) type).getPackageName();
List<String> splitted = Strings.split(packageName, '.');
String segment = splitted.get(segmentIndex);
return new SingletonScope(EObjectDescription.create(segment, type), IScope.NULLSCOPE);
}
return IScope.NULLSCOPE;
} else {
if (type instanceof JvmDeclaredType && ((JvmDeclaredType) type).getDeclaringType() == null) {
return new SingletonScope(EObjectDescription.create(type.getSimpleName(), type), IScope.NULLSCOPE);
} else {
XAbstractFeatureCall target = (XAbstractFeatureCall) call.getMemberCallTarget();
if (target.isPackageFragment()) {
String qualifiedName = type.getQualifiedName();
int dot = qualifiedName.lastIndexOf('.');
String simpleName = qualifiedName.substring(dot + 1);
return new SingletonScope(EObjectDescription.create(simpleName, type), IScope.NULLSCOPE);
} else {
return new SingletonScope(EObjectDescription.create(type.getSimpleName(), type), IScope.NULLSCOPE);
}
}
}
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
XExpression receiver = ((XAbstractFeatureCall) context).getActualReceiver();
if (receiver == null && context instanceof XMemberFeatureCall) {
receiver = ((XMemberFeatureCall) context).getMemberCallTarget();
anchor = IExpressionScope.Anchor.RECEIVER;
} else if (context instanceof XMemberFeatureCall) {
context = ((XMemberFeatureCall) context).getMemberCallTarget();
anchor = IExpressionScope.Anchor.RECEIVER;
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
@Override
protected void internalSetValue(InternalEObject featureCall, EReference structuralFeature, JvmIdentifiableElement newValue) {
super.internalSetValue(featureCall, structuralFeature, newValue);
if (featureCall instanceof XFeatureCall) {
XFeatureCall casted = (XFeatureCall) featureCall;
if (casted != getExpression()) {
casted.setPackageFragment(true);
} else {
casted.setTypeLiteral(true);
}
} else if (featureCall instanceof XMemberFeatureCall) {
XMemberFeatureCall casted = (XMemberFeatureCall) featureCall;
if (casted != getExpression()) {
casted.setPackageFragment(true);
} else {
casted.setTypeLiteral(true);
}
XExpression target = casted.getMemberCallTarget();
IFeatureLinkingCandidate candidate = getLinkingCandidate(target);
if (candidate == null || !candidate.isTypeLiteral()) {
resolveLinkingProxy((InternalEObject) target, newValue, structuralFeature, XbasePackage.XABSTRACT_FEATURE_CALL__FEATURE);
}
}
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
@Check
void checkNullSafeFeatureCallWithPrimitives(XMemberFeatureCall featureCall) {
if (featureCall.isNullSafe()) {
if (getActualType(featureCall.getMemberCallTarget()).isPrimitive()) {
error("Cannot use null-safe feature call on primitive receiver", featureCall,
Literals.XMEMBER_FEATURE_CALL__NULL_SAFE, NULL_SAFE_FEATURE_CALL_ON_PRIMITIVE);
return;
}
LightweightTypeReference type = getActualType(featureCall);
if (type.isPrimitive() && isValueExpectedRecursive(featureCall)) {
addIssue("Null-safe call of primitive-valued feature " + featureCall.getConcreteSyntaxFeatureName()
+ ", default value "+ getDefaultValue(type) +" will be used",
featureCall, NULL_SAFE_FEATURE_CALL_OF_PRIMITIVE_VALUED_FEATURE);
}
}
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase.ide
protected void createReceiverProposals(final XExpression receiver, final CrossReference crossReference, final ContentAssistContext context, final IIdeContentProposalAcceptor acceptor) {
final IResolvedTypes resolvedTypes = this.typeResolver.resolveTypes(receiver);
final LightweightTypeReference receiverType = resolvedTypes.getActualType(receiver);
if (((receiverType == null) || receiverType.isPrimitiveVoid())) {
return;
}
final IExpressionScope expressionScope = resolvedTypes.getExpressionScope(receiver, IExpressionScope.Anchor.RECEIVER);
IScope scope = null;
final EObject currentModel = context.getCurrentModel();
if ((currentModel != receiver)) {
if (((currentModel instanceof XMemberFeatureCall) &&
(((XMemberFeatureCall) currentModel).getMemberCallTarget() == receiver))) {
scope = this.syntaxFilteredScopes.create(expressionScope.getFeatureScope(((XAbstractFeatureCall) currentModel)), crossReference);
} else {
scope = this.syntaxFilteredScopes.create(expressionScope.getFeatureScope(), crossReference);
}
} else {
scope = this.syntaxFilteredScopes.create(expressionScope.getFeatureScope(), crossReference);
}
this.getCrossrefProposalProvider().lookupCrossReference(scope, crossReference, context, acceptor, this.featureDescriptionPredicate);
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase
if (featureCall instanceof XMemberFeatureCall) {
XMemberFeatureCall casted = (XMemberFeatureCall) featureCall;
XExpression syntacticReceiver = casted.getMemberCallTarget();
if (isStaticWithDeclaringType(syntacticReceiver) || isThisOrSuper()) {
casted.setStaticWithDeclaringType(true);
内容来源于网络,如有侵权,请联系作者删除!