gpt4 book ai didi

org.eclipse.xtext.xbase.XAbstractFeatureCall类的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 14:22:40 29 4
gpt4 key购买 nike

本文整理了Java中org.eclipse.xtext.xbase.XAbstractFeatureCall类的一些代码示例,展示了XAbstractFeatureCall类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XAbstractFeatureCall类的具体详情如下:
包路径:org.eclipse.xtext.xbase.XAbstractFeatureCall
类名称:XAbstractFeatureCall

XAbstractFeatureCall介绍

[英]A representation of the model object 'XAbstract Feature Call'.
[中]模型对象“XAbstract功能调用”的表示形式。

代码示例

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

return true;
if (featureCall.isPackageFragment() || featureCall.isTypeLiteral()) {
  return false;
final JvmIdentifiableElement feature = featureCall.getFeature();
if (feature == null || feature.eIsProxy())
  return true; // linking problems ... could be anything
  } else {
    if(inspectContents) {
      for (XExpression param : featureCall.getActualArguments()) {
        if (hasSideEffects(param))
          return true;

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

protected Object evaluateGetAndAssign(XAbstractFeatureCall featureCall, IEvaluationContext context, CancelIndicator indicator) {
  XAbstractFeatureCall operand = (XAbstractFeatureCall) featureCall.getActualArguments().get(0);
  
  Object originalValue = internalEvaluate(operand, context, indicator);
  Object value = applyGetAndAssignOperator(originalValue, featureCall.getConcreteSyntaxFeatureName());
  
  assignValueTo(operand.getFeature(), featureCall, value, context, indicator);
  return originalValue;
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase.ide

protected boolean isExtensionWithImplicitFirstArgument(XAbstractFeatureCall featureCall) {
  XExpression implicitReceiver = featureCall.getImplicitReceiver();
  return implicitReceiver instanceof XAbstractFeatureCall
      && isExtension(((XAbstractFeatureCall) implicitReceiver).getFeature());
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

private boolean isOuterTypeLiteral(XAbstractFeatureCall featureCall) {
  if (featureCall.eContainingFeature() == XbasePackage.Literals.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET) {
    XMemberFeatureCall container = (XMemberFeatureCall) featureCall.eContainer();
    if (container.isTypeLiteral()) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

public boolean isDefiniteTypeLiteral(XAbstractFeatureCall featureCall) {
  if (featureCall.isExplicitOperationCallOrBuilderSyntax())
    return false;
  if (!featureCall.getTypeArguments().isEmpty())
    return false;
  if (featureCall.eContainingFeature() == XbasePackage.Literals.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET) {
    XMemberFeatureCall container = (XMemberFeatureCall) featureCall.eContainer();
    if (container.isExplicitStatic()) {
      return true;
    }
    return isDefiniteTypeLiteral(container);
  }
  return false;
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

@Override
public JvmIdentifiableElement getFeature() {
  return implicit.getFeature();
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang

@SuppressWarnings({"checkstyle:npathcomplexity", "checkstyle:cyclomaticcomplexity", "checkstyle:returncount"})
private boolean internalHasOperationSideEffects(XAbstractFeatureCall expression, ISideEffectContext context,
    boolean sideEffectForExternalElements) {
  if (expression.eIsProxy()) {
    return false;
  if (expression.isTypeLiteral() || expression.isPackageFragment()) {
    return false;
  JvmIdentifiableElement feature = expression.getFeature();
  if (feature == null) {
      for (final XExpression ex : expression.getActualArguments()) {
        final Boolean bool = hasSideEffects(ex, context);
        if (bool != null && bool.booleanValue()) {
    return !isLocalExpression(expression.getActualReceiver(), context, true);
  } else if (sideEffectForExternalElements && isExternalFeature(feature)) {
    return true;

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

public XAbstractFeatureCall getRootTypeLiteral(XAbstractFeatureCall featureCall) {
  if (featureCall.isTypeLiteral()) {
    return featureCall;
  }
  if (featureCall.isPackageFragment()) {
    return getRootTypeLiteral((XAbstractFeatureCall) featureCall.eContainer());
  }
  if (featureCall.getFeature() == null || featureCall.getFeature().eIsProxy()) {
    // syntactic check
    if (featureCall instanceof XFeatureCall || featureCall instanceof XMemberFeatureCall) {
      if (!isPotentialTypeLiteral(featureCall, null)) {
        return null;
      }
      if (featureCall instanceof XMemberFeatureCall) {
        return doGetRootTypeLiteral((XMemberFeatureCall) featureCall);
      }
      if (featureCall instanceof XFeatureCall) {
        if (featureCall.eContainingFeature() == XbasePackage.Literals.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET) {
          return doGetRootTypeLiteral((XMemberFeatureCall) featureCall.eContainer());
        }
      }
    }
  }
  return null;
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

private boolean isPotentialJavaOperation(XAbstractFeatureCall featureCall) {
  if (featureCall.isOperation()) {
    return true;
  }
  if (featureCall.eClass() == XbasePackage.Literals.XMEMBER_FEATURE_CALL && featureCall.isStatic() && featureCall.isExtension() && featureCall.getActualArguments().size() == 2) {
    JvmIdentifiableElement feature = featureCall.getFeature();
    if (feature.eClass() == TypesPackage.Literals.JVM_OPERATION) {
      JvmDeclaredType declarator = ((JvmOperation) feature).getDeclaringType();
      if (IntegerExtensions.class.getName().equals(declarator.getIdentifier()) || LongExtensions.class.getName().equals(declarator.getIdentifier())) {
        String simpleName = feature.getSimpleName();
        if (simpleName.startsWith("bitwise") || simpleName.startsWith("shift")) {
          return true;
        }
      }
    }
  }
  return false;
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

protected IFeatureLinkingCandidate createResolvedLink(XAbstractFeatureCall featureCall, JvmIdentifiableElement resolvedTo) {
  ExpressionAwareStackedResolvedTypes resolvedTypes = this.resolvedTypes.pushTypes(featureCall);
  ExpressionTypeComputationState state = createExpressionComputationState(featureCall, resolvedTypes);
  
  FeatureLinkHelper helper = new FeatureLinkHelper();
  XExpression syntacticReceiver = helper.getSyntacticReceiver(featureCall);
  if (syntacticReceiver != null) {
    AbstractTypeComputationState child = state.withNonVoidExpectation();
    child.computeTypes(syntacticReceiver);
  }
  XExpression implicitReceiver = featureCall.getImplicitReceiver();
  if (implicitReceiver != null) {
    AbstractTypeComputationState child = state.withNonVoidExpectation();
    child.computeTypes(implicitReceiver);
  }
  XExpression implicitFirstArgument = featureCall.getImplicitFirstArgument();
  if (implicitFirstArgument != null) {
    AbstractTypeComputationState child = state.withNonVoidExpectation();
    child.computeTypes(implicitFirstArgument);
  }
  if (featureCall.isTypeLiteral() || featureCall.isPackageFragment()) {
    return new ResolvedTypeLiteral(featureCall, resolvedTo, getSingleExpectation(state), state);
  }
  return new ResolvedFeature(featureCall, resolvedTo, helper, getSingleExpectation(state), state);
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang

if (call.isStatic()) {
  if (call instanceof XMemberFeatureCall) {
    final XMemberFeatureCall memberFeatureCall = (XMemberFeatureCall) call;
    if (memberFeatureCall.isStaticWithDeclaringType()) {
      final XAbstractFeatureCall target = (XAbstractFeatureCall) memberFeatureCall.getMemberCallTarget();
      final JvmType declaringType = (JvmType) target.getFeature();
      output.add(declaringType);
      return true;
  output.add(((JvmFeature) call.getFeature()).getDeclaringType());
  return true;
final XExpression receiver = call.getActualReceiver();
if (receiver == null) {
  return false;
final XExpression implicit = call.getImplicitReceiver();
if (receiver == implicit) {
  output.add(thisKeyword.apply());
    if (((XAbstractFeatureCall) receiver).getFeature() instanceof JvmType) {
      final String referenceName = referenceNameDefinition.apply(receiver);
      if (referenceName != null && referenceName.length() == 0) {

代码示例来源:origin: io.sarl.lang/io.sarl.lang

private static boolean isLocalExpression(XAbstractFeatureCall expression, ISideEffectContext context, boolean dereference) {
  if (expression.isTypeLiteral() || expression.isPackageFragment()) {
    return false;
  }
  final JvmIdentifiableElement feature = expression.getFeature();
  if (feature != null && (feature.eIsProxy() || isExternalFeature(feature))) {
    return false;
  }
  if (feature instanceof XVariableDeclaration) {
    if (dereference) {
      final XVariableDeclaration variable = (XVariableDeclaration) feature;
      for (final XExpression value : context.getVariableValues(variable.getIdentifier())) {
        if (!isLocalExpression(value, context, dereference)) {
          return false;
        }
      }
    }
  }
  return true;
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang

/** Get the string representation of an operator.
 *
 * @param call the call to the operator feature.
 * @return the string representation of the operator or {@code null} if not a valid operator.
 */
protected String getOperatorSymbol(XAbstractFeatureCall call) {
  if (call != null) {
    final Resource res = call.eResource();
    if (res instanceof StorageAwareResource) {
      final boolean isLoadedFromStorage = ((StorageAwareResource) res).isLoadedFromStorage();
      if (isLoadedFromStorage) {
        final QualifiedName operator = getOperatorMapping().getOperator(
            QualifiedName.create(call.getFeature().getSimpleName()));
        return Objects.toString(operator);
      }
    }
    return call.getConcreteSyntaxFeatureName();
  }
  return null;
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang

/**  Generate a feature call.
 *
 * @param expr the call expression.
 */
public void generate(XAbstractFeatureCall expr) {
  if (expr.isTypeLiteral()) {
    final JvmType type = (JvmType) expr.getFeature();
    this.codeReceiver.append(type);
  //} else if (getExpressionHelper().isShortCircuitOperation(expr)) {
  //	generateShortCircuitInvocation(expr);
  } else {
    if (expr instanceof XMemberFeatureCall && ((XMemberFeatureCall) expr).isNullSafe()) {
      featureCalltoJavaExpression(expr, () -> expr);
    } else {
      featureCalltoJavaExpression(expr, null);
    }
  }
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

XExpression leftOperand = ((XBinaryOperation)featureCall).getLeftOperand();
  Object result = internalEvaluate(leftOperand, context, indicator);
  String operatorName = featureCall.getConcreteSyntaxFeatureName();
  if (equal(expressionHelper.getElvisOperator() ,operatorName)) {
    if(result != null)
      return true;
  JvmOperation operation = (JvmOperation) featureCall.getFeature();
  XExpression receiver = getActualReceiver(featureCall);
  List<XExpression> operationArguments = getActualArguments(featureCall);
Object result = invokeFeature(featureCall.getFeature(), featureCall, receiverObj, context, indicator);
if (featureCall instanceof XBinaryOperation) {
  XBinaryOperation binaryOperation = (XBinaryOperation) featureCall;
  if (binaryOperation.isReassignFirstArgument()) {
    XAbstractFeatureCall leftOperand = (XAbstractFeatureCall) binaryOperation.getLeftOperand();
    assignValueTo(leftOperand.getFeature(), featureCall, result, context, indicator);

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

private boolean isTypeLiteral(XExpression memberCallTarget) {
  if (memberCallTarget instanceof XAbstractFeatureCall) {
    return ((XAbstractFeatureCall) memberCallTarget).isTypeLiteral();
  }
  return false;
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

protected LightweightTypeReference getReceiverType(XAbstractFeatureCall featureCall, IResolvedTypes resolvedTypes, ITypeReferenceOwner owner) {
    XExpression receiver = featureCall.getActualReceiver();
    if (receiver == null) {
      // static feature call
      JvmOperation operation = (JvmOperation) featureCall.getFeature();
      JvmDeclaredType declaringType = operation.getDeclaringType();
      return owner.newParameterizedTypeReference(declaringType);
    }
    return resolvedTypes.getActualType(receiver);
  }
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

protected IScope getTypeScope(XAbstractFeatureCall call, JvmType type) {
  if (call.isTypeLiteral() || call.isPackageFragment()) {
    return doGetTypeScope(call, type);
  }
  return getThisOrSuperScope(call, type);
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

@Override
  public boolean createReferenceDescriptions(EObject from, URI exportedContainerURI, IAcceptor<IReferenceDescription> acceptor) {
    if (from instanceof XAbstractFeatureCall && ((XAbstractFeatureCall) from).isPackageFragment())
      return false;
    return super.createReferenceDescriptions(from, exportedContainerURI, acceptor);
  }
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase.ide

@Override
protected boolean highlightElement(EObject object, IHighlightedPositionAcceptor acceptor, CancelIndicator cancelIndicator) {
  if (object instanceof XAbstractFeatureCall) {
    if (((XAbstractFeatureCall) object).isPackageFragment()) {
      return true;
    }
    if (SPECIAL_FEATURE_NAMES.contains(((XAbstractFeatureCall) object).getConcreteSyntaxFeatureName())) {
      return false;
    }
    operationCanceledManager.checkCanceled(cancelIndicator);
    computeFeatureCallHighlighting((XAbstractFeatureCall) object, acceptor);
  } else if (object instanceof JvmTypeParameter) {
    highlightTypeParameter((JvmTypeParameter) object, acceptor);
  } else if (object instanceof JvmFormalParameter) {
    highlightFormalParameter((JvmFormalParameter) object, acceptor);
  } else if (object instanceof XVariableDeclaration) {
    highlightVariableDeclaration((XVariableDeclaration) object, acceptor);
  } else if (object instanceof XNumberLiteral) {
    highlightNumberLiterals((XNumberLiteral) object, acceptor);
  } else if (object instanceof XConstructorCall) {
    highlightConstructorCall((XConstructorCall) object, acceptor);
  } else if (object instanceof XAnnotation) {
    // Handle XAnnotation in a special way because we want the @ highlighted too
    highlightAnnotation((XAnnotation) object, acceptor);
  } else {
    computeReferencedJvmTypeHighlighting(acceptor, object, cancelIndicator);
  }
  return false;
}

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com