gpt4 book ai didi

org.eclipse.xtext.xbase.XAbstractFeatureCall.isTypeLiteral()方法的使用及代码示例

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

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

XAbstractFeatureCall.isTypeLiteral介绍

暂无

代码示例

代码示例来源: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 boolean isTypeLiteral(XExpression expression) {
  return expression instanceof XAbstractFeatureCall && ((XAbstractFeatureCall) expression).isTypeLiteral();
}

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

protected boolean _isValidAnnotationValue(final XAbstractFeatureCall expression) {
 boolean _isTypeLiteral = expression.isTypeLiteral();
 if (_isTypeLiteral) {
  return true;
 }
 return super.isConstant(expression);
}

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

@Override
  public boolean isTypeLiteral() {
    XAbstractFeatureCall featureCall = getFeatureCall();
    return featureCall.isTypeLiteral();
  }
}

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

@Override
public boolean isTypeLiteral() {
  return getFeatureCall().isTypeLiteral();
}

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

protected void highlightFeatureCall(XAbstractFeatureCall featureCall, IHighlightedPositionAcceptor acceptor, String id) {
//        highlightDeprecation(acceptor, featureCall, null, featureCall.getFeature());
    if (featureCall.isTypeLiteral()) {
      ICompositeNode node = NodeModelUtils.findActualNodeFor(featureCall);
      highlightNode(acceptor, node, id);
    } else {
      highlightFeature(acceptor, featureCall, XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, id);
    }
  }

代码示例来源: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: 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

@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 void _toJavaExpression(XAbstractFeatureCall call, ITreeAppendable b) {
  if (call.isTypeLiteral()) {
    b.append((JvmType) call.getFeature()).append(".class");
  } else if (isPrimitiveVoid(call)) {
    throw new IllegalArgumentException("feature yields 'void'");
  } else {
    final String referenceName = getReferenceName(call, b);
    if (referenceName != null) {
      if (call instanceof XFeatureCall || call instanceof XMemberFeatureCall) {
        b.trace(call, XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, 0).append(referenceName);
      } else {
        b.trace(call, false).append(referenceName);
      }
    } else {
      featureCalltoJavaExpression(call, b, true);
    }
  }
}

代码示例来源: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: 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: org.eclipse.xtext/org.eclipse.xtext.xbase

return true;
if (featureCall.isPackageFragment() || featureCall.isTypeLiteral()) {
  return false;

代码示例来源:origin: org.eclipse.xtend/org.eclipse.xtend.core

boolean _matched_1 = false;
if (receiver instanceof XAbstractFeatureCall) {
 boolean _isTypeLiteral = ((XAbstractFeatureCall)receiver).isTypeLiteral();
 if (_isTypeLiteral) {
  _matched_1=true;
boolean _isTypeLiteral = ((XAbstractFeatureCall)expression).isTypeLiteral();
if (_isTypeLiteral) {
 _matched=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: io.sarl.lang/io.sarl.lang

return false;
if (expression.isTypeLiteral() || expression.isPackageFragment()) {
  return false;

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

protected void checkNoJavaStyleTypeCasting(INode node) {
  BidiTreeIterator<INode> iterator = node.getAsTreeIterable().reverse().iterator();
  ILeafNode child = getFirstLeafNode(iterator);
  if (child != null && child.getGrammarElement() == grammarAccess.getXParenthesizedExpressionAccess().getRightParenthesisKeyword_2()) {
    INode expressionNode = getNode(iterator, grammarAccess.getXParenthesizedExpressionAccess().getXExpressionParserRuleCall_1());
    EObject semanticObject = NodeModelUtils.findActualSemanticObjectFor(expressionNode);
    if (semanticObject instanceof XFeatureCall || semanticObject instanceof XMemberFeatureCall) {
      XAbstractFeatureCall featureCall = (XAbstractFeatureCall) semanticObject;
      if (featureCall.isTypeLiteral()) {
        ICompositeNode parenthesizedNode = child.getParent();
        ITextRegion parenthesizedRegion = parenthesizedNode.getTextRegion();
        addIssue("Use 'as' keyword for type casting.", featureCall, parenthesizedRegion.getOffset(), parenthesizedRegion.getLength(), JAVA_STYLE_TYPE_CAST);
      }
    }
  }
}

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

if (featureCall.isTypeLiteral() || featureCall.isPackageFragment()) {
  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: org.eclipse.xtext/org.eclipse.xtext.xbase

protected void _toJavaStatement(final XAbstractFeatureCall expr, ITreeAppendable b, final boolean isReferenced) {
  if (expr.isTypeLiteral()) {
    generateComment(new Later() {
      @Override

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