Java Code Examples for org.eclipse.xtext.xbase.XMemberFeatureCall#isTypeLiteral()

The following examples show how to use org.eclipse.xtext.xbase.XMemberFeatureCall#isTypeLiteral() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImportsCollector.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
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);
  }
}
 
Example 2
Source File: XbaseInterpreter.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
protected Object _doEvaluate(final XMemberFeatureCall featureCall, final IEvaluationContext context, final CancelIndicator indicator) {
	if (featureCall.isTypeLiteral()) {
		JvmType type = (JvmType) featureCall.getFeature();
		Object result = translateJvmTypeToResult(type, 0);
		return result;
	} else {
		XExpression receiver = getActualReceiver(featureCall); //, featureCall.getFeature(), featureCall.getImplicitReceiver());
		Object receiverObj = receiver==null?null:internalEvaluate(receiver, context, indicator);
		if (featureCall.isNullSafe() && receiverObj==null) {
			return getDefaultObjectValue(typeResolver.resolveTypes(featureCall).getActualType(featureCall));
		}
		return invokeFeature(featureCall.getFeature(), featureCall, receiverObj, context, indicator);
	}
}
 
Example 3
Source File: TypeUsageCollector.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
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;
}