Java 类org.eclipse.xtext.xbase.XTypeLiteral 实例源码

项目:xtext-extras    文件:XbaseTypeComputer.java   
protected void _computeTypes(XTypeLiteral object, ITypeComputationState state) {
    JvmType type = object.getType();
    if (type == null) {
        return;
    }
    checkTypeParameterNotAllowedAsLiteral(object, type, state);
    ITypeReferenceOwner owner = state.getReferenceOwner();
    LightweightTypeReference clazz = owner.newParameterizedTypeReference(type);
    for (int i = 0; i < object.getArrayDimensions().size(); i++) {
        clazz = owner.newArrayTypeReference(clazz);
    }
    if (object.getArrayDimensions().isEmpty()) {
        if (clazz.isPrimitiveVoid()) {
            clazz = state.getReferenceOwner().newReferenceTo(Void.class);
        } else {
            clazz = clazz.getWrapperTypeIfPrimitive();
        }
    }
    LightweightTypeReference result = owner.newReferenceTo(Class.class);
    if (result instanceof ParameterizedTypeReference) {
        ParameterizedTypeReference parameterizedTypeReference = (ParameterizedTypeReference) result;
        parameterizedTypeReference.addTypeArgument(clazz);
    }
    state.acceptActualType(result);
}
项目:xtext-extras    文件:LiteralsCompiler.java   
@Override
protected void internalToConvertedExpression(XExpression obj, ITreeAppendable appendable) {
    if (obj instanceof XStringLiteral) {
        _toJavaExpression((XStringLiteral) obj, appendable);
    } else if (obj instanceof XNumberLiteral) {
        _toJavaExpression((XNumberLiteral) obj, appendable);
    } else if (obj instanceof XNullLiteral) {
        _toJavaExpression((XNullLiteral) obj, appendable);
    } else if (obj instanceof XBooleanLiteral) {
        _toJavaExpression((XBooleanLiteral) obj, appendable);
    } else if (obj instanceof XTypeLiteral) {
        _toJavaExpression((XTypeLiteral) obj, appendable);
    } else {
        super.internalToConvertedExpression(obj, appendable);
    }
}
项目:xtext-extras    文件:LiteralsCompiler.java   
@Override
protected void doInternalToJavaStatement(XExpression obj, ITreeAppendable appendable, boolean isReferenced) {
    if (obj instanceof XStringLiteral) {
        _toJavaStatement((XStringLiteral) obj, appendable, isReferenced);
    } else if (obj instanceof XNumberLiteral) {
        _toJavaStatement((XNumberLiteral) obj, appendable, isReferenced);
    } else if (obj instanceof XNullLiteral) {
        _toJavaStatement((XNullLiteral) obj, appendable, isReferenced);
    } else if (obj instanceof XBooleanLiteral) {
        _toJavaStatement((XBooleanLiteral) obj, appendable, isReferenced);
    } else if (obj instanceof XTypeLiteral) {
        _toJavaStatement((XTypeLiteral) obj, appendable, isReferenced);
    } else {
        super.doInternalToJavaStatement(obj, appendable, isReferenced);
    }
}
项目:xtext-extras    文件:ConstantExpressionValidator.java   
public boolean isConstant(final XExpression expression) {
  if (expression instanceof XAbstractFeatureCall) {
    return _isConstant((XAbstractFeatureCall)expression);
  } else if (expression instanceof XBooleanLiteral) {
    return _isConstant((XBooleanLiteral)expression);
  } else if (expression instanceof XCastedExpression) {
    return _isConstant((XCastedExpression)expression);
  } else if (expression instanceof XNumberLiteral) {
    return _isConstant((XNumberLiteral)expression);
  } else if (expression instanceof XStringLiteral) {
    return _isConstant((XStringLiteral)expression);
  } else if (expression instanceof XTypeLiteral) {
    return _isConstant((XTypeLiteral)expression);
  } else if (expression != null) {
    return _isConstant(expression);
  } else {
    throw new IllegalArgumentException("Unhandled parameter types: " +
      Arrays.<Object>asList(expression).toString());
  }
}
项目:xtext-extras    文件:AbstractConstantExpressionsInterpreter.java   
public Object internalEvaluate(final XExpression it, final Context ctx) {
  if (it instanceof XBinaryOperation) {
    return _internalEvaluate((XBinaryOperation)it, ctx);
  } else if (it instanceof XUnaryOperation) {
    return _internalEvaluate((XUnaryOperation)it, ctx);
  } else if (it instanceof XBooleanLiteral) {
    return _internalEvaluate((XBooleanLiteral)it, ctx);
  } else if (it instanceof XCastedExpression) {
    return _internalEvaluate((XCastedExpression)it, ctx);
  } else if (it instanceof XStringLiteral) {
    return _internalEvaluate((XStringLiteral)it, ctx);
  } else if (it instanceof XTypeLiteral) {
    return _internalEvaluate((XTypeLiteral)it, ctx);
  } else if (it instanceof XAnnotation) {
    return _internalEvaluate((XAnnotation)it, ctx);
  } else if (it != null) {
    return _internalEvaluate(it, ctx);
  } else if (it == null) {
    return _internalEvaluate((Void)null, ctx);
  } else {
    throw new IllegalArgumentException("Unhandled parameter types: " +
      Arrays.<Object>asList(it, ctx).toString());
  }
}
项目:xtext-extras    文件:ResolvedFeaturesTest.java   
public ResolvedFeatures toResolvedOperations(final Class<?> type) {
  try {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("typeof(");
    String _canonicalName = type.getCanonicalName();
    _builder.append(_canonicalName);
    _builder.append(")");
    XExpression _expression = this.expression(_builder);
    final XTypeLiteral typeLiteral = ((XTypeLiteral) _expression);
    JvmType _type = typeLiteral.getType();
    final ResolvedFeatures result = this.overrideHelper.getResolvedFeatures(((JvmDeclaredType) _type));
    return result;
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
项目:xtext-extras    文件:XbaseValidator.java   
@Check
public void checkDeprecated(XTypeLiteral expression) {
    if (!isIgnored(DEPRECATED_MEMBER_REFERENCE)) {
        JvmType jvmType = expression.getType();
        checkDeprecated(
                jvmType,
                expression,
                XbasePackage.Literals.XTYPE_LITERAL__TYPE);
    }
}
项目:xtext-extras    文件:XExpressionHelper.java   
/**
 * @return whether the expression itself (not its children) possibly causes a side-effect
 */
public boolean hasSideEffects(XExpression expr) {
    if (expr instanceof XClosure
        || expr instanceof XStringLiteral
        || expr instanceof XTypeLiteral
        || expr instanceof XBooleanLiteral
        || expr instanceof XNumberLiteral
        || expr instanceof XNullLiteral
        || expr instanceof XAnnotation
        )
        return false;
    if(expr instanceof XCollectionLiteral) {
        for(XExpression element: ((XCollectionLiteral)expr).getElements()) {
            if(hasSideEffects(element))
                return true;
        }
        return false;
    }
    if (expr instanceof XAbstractFeatureCall) {
        XAbstractFeatureCall featureCall = (XAbstractFeatureCall) expr;
        return hasSideEffects(featureCall, true);
    }
    if (expr instanceof XConstructorCall) {
        XConstructorCall constrCall = (XConstructorCall) expr;
        return findPureAnnotation(constrCall.getConstructor()) == null;
    }
    return true;
}
项目:xtext-extras    文件:LiteralsCompiler.java   
@Override
protected boolean isVariableDeclarationRequired(XExpression expr, ITreeAppendable b, boolean recursive) {
    if (expr instanceof XBooleanLiteral
        || expr instanceof XStringLiteral
        || expr instanceof XNumberLiteral
        || expr instanceof XTypeLiteral
        || expr instanceof XClosure
        || expr instanceof XNullLiteral)
        return false;
    return super.isVariableDeclarationRequired(expr,b, recursive);
}
项目:xtext-extras    文件:XbaseInterpreter.java   
/**
 * @param context unused in this context but required for dispatching
 * @param indicator unused in this context but required for dispatching
 */
protected Object _doEvaluate(XTypeLiteral literal, IEvaluationContext context, CancelIndicator indicator) {
    if (literal.getType() == null || literal.getType().eIsProxy()) {
        List<INode> nodesForFeature = NodeModelUtils.findNodesForFeature(literal,
                XbasePackage.Literals.XTYPE_LITERAL__TYPE);
        // TODO cleanup
        if (nodesForFeature.isEmpty())
            throw new EvaluationException(new ClassNotFoundException());
        throw new EvaluationException(new ClassNotFoundException(nodesForFeature.get(0).getText()));
    }
    JvmType type = literal.getType();
    Object result = translateJvmTypeToResult(type, literal.getArrayDimensions().size());
    return result;
}
项目:xtext-extras    文件:ConstantConditionsInterpreter.java   
public EvaluationResult internalEvaluate(final XExpression it, final EvaluationContext context) {
  if (it instanceof XBinaryOperation) {
    return _internalEvaluate((XBinaryOperation)it, context);
  } else if (it instanceof XUnaryOperation) {
    return _internalEvaluate((XUnaryOperation)it, context);
  } else if (it instanceof XAbstractFeatureCall) {
    return _internalEvaluate((XAbstractFeatureCall)it, context);
  } else if (it instanceof XBooleanLiteral) {
    return _internalEvaluate((XBooleanLiteral)it, context);
  } else if (it instanceof XCastedExpression) {
    return _internalEvaluate((XCastedExpression)it, context);
  } else if (it instanceof XNullLiteral) {
    return _internalEvaluate((XNullLiteral)it, context);
  } else if (it instanceof XNumberLiteral) {
    return _internalEvaluate((XNumberLiteral)it, context);
  } else if (it instanceof XStringLiteral) {
    return _internalEvaluate((XStringLiteral)it, context);
  } else if (it instanceof XTypeLiteral) {
    return _internalEvaluate((XTypeLiteral)it, context);
  } else if (it != null) {
    return _internalEvaluate(it, context);
  } else if (it == null) {
    return _internalEvaluate((Void)null, context);
  } else {
    throw new IllegalArgumentException("Unhandled parameter types: " +
      Arrays.<Object>asList(it, context).toString());
  }
}
项目:xtext-extras    文件:SwitchConstantExpressionsInterpreter.java   
public Object internalEvaluate(final XExpression it, final Context ctx) {
  if (it instanceof XBinaryOperation) {
    return _internalEvaluate((XBinaryOperation)it, ctx);
  } else if (it instanceof XUnaryOperation) {
    return _internalEvaluate((XUnaryOperation)it, ctx);
  } else if (it instanceof XAbstractFeatureCall) {
    return _internalEvaluate((XAbstractFeatureCall)it, ctx);
  } else if (it instanceof XBooleanLiteral) {
    return _internalEvaluate((XBooleanLiteral)it, ctx);
  } else if (it instanceof XCastedExpression) {
    return _internalEvaluate((XCastedExpression)it, ctx);
  } else if (it instanceof XNumberLiteral) {
    return _internalEvaluate((XNumberLiteral)it, ctx);
  } else if (it instanceof XStringLiteral) {
    return _internalEvaluate((XStringLiteral)it, ctx);
  } else if (it instanceof XTypeLiteral) {
    return _internalEvaluate((XTypeLiteral)it, ctx);
  } else if (it instanceof XAnnotation) {
    return _internalEvaluate((XAnnotation)it, ctx);
  } else if (it != null) {
    return _internalEvaluate(it, ctx);
  } else if (it == null) {
    return _internalEvaluate((Void)null, ctx);
  } else {
    throw new IllegalArgumentException("Unhandled parameter types: " +
      Arrays.<Object>asList(it, ctx).toString());
  }
}
项目:xtext-extras    文件:ImportsCollector.java   
public void visit(final EObject jvmType, final INode originNode, final ImportsAcceptor acceptor) {
  if (jvmType instanceof JvmGenericType) {
    _visit((JvmGenericType)jvmType, originNode, acceptor);
    return;
  } else if (jvmType instanceof JvmDeclaredType) {
    _visit((JvmDeclaredType)jvmType, originNode, acceptor);
    return;
  } else if (jvmType instanceof XFeatureCall) {
    _visit((XFeatureCall)jvmType, originNode, acceptor);
    return;
  } else if (jvmType instanceof XMemberFeatureCall) {
    _visit((XMemberFeatureCall)jvmType, originNode, acceptor);
    return;
  } else if (jvmType instanceof XAbstractFeatureCall) {
    _visit((XAbstractFeatureCall)jvmType, originNode, acceptor);
    return;
  } else if (jvmType instanceof XConstructorCall) {
    _visit((XConstructorCall)jvmType, originNode, acceptor);
    return;
  } else if (jvmType instanceof XTypeLiteral) {
    _visit((XTypeLiteral)jvmType, originNode, acceptor);
    return;
  } else if (jvmType instanceof XAnnotation) {
    _visit((XAnnotation)jvmType, originNode, acceptor);
    return;
  } else if (jvmType instanceof JvmTypeReference) {
    _visit((JvmTypeReference)jvmType, originNode, acceptor);
    return;
  } else if (jvmType != null) {
    _visit(jvmType, originNode, acceptor);
    return;
  } else if (jvmType == null) {
    _visit((Void)null, originNode, acceptor);
    return;
  } else {
    throw new IllegalArgumentException("Unhandled parameter types: " +
      Arrays.<Object>asList(jvmType, originNode, acceptor).toString());
  }
}
项目:xtext-extras    文件:UIStringsTest.java   
@Test
public void testReferenceToString_0() throws Exception {
    XExpression expr = expression("typeof(foo.String)", true);
    assertTrue(expr instanceof XTypeLiteral);
    XTypeLiteral operator = (XTypeLiteral) expr;
    JvmType type = operator.getType();
    JvmTypeReference reference = this.typeReferences.createTypeRef(type);
    assertEquals("String", this.uiStrings.referenceToString(reference, "the-default-value"));
}
项目:xtext-extras    文件:UIStringsTest.java   
@Test
public void testReferenceToString_1() throws Exception {
    XExpression expr = expression("typeof(String)", true);
    assertTrue(expr instanceof XTypeLiteral);
    XTypeLiteral operator = (XTypeLiteral) expr;
    JvmType type = operator.getType();
    JvmTypeReference reference = this.typeReferences.createTypeRef(type);
    assertEquals("String", this.uiStrings.referenceToString(reference, "the-default-value"));
}
项目:xtext-extras    文件:ErrorTreeAppendableTest.java   
@Test
public void testAppendUnresolvedType() {
  try {
    XExpression _expression = this.expression("typeof(  \tUnresolved\n)");
    final XTypeLiteral e = ((XTypeLiteral) _expression);
    final ErrorTreeAppendable app = this.createErrorTreeAppendable(e);
    app.append(e.getType());
    Assert.assertEquals("Unresolved", app.getContent());
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
项目:xtext-extras    文件:AbstractXbaseSemanticSequencer.java   
@Deprecated
protected void sequence_XTypeLiteral(EObject context, XTypeLiteral semanticObject) {
    sequence_XTypeLiteral(createContext(context, semanticObject), semanticObject);
}
项目:xtext-extras    文件:XbaseValidator.java   
@Check
public void checkTypeLiteral(XTypeLiteral typeLiteral) {
    if (!typeLiteral.getArrayDimensions().isEmpty() && typeLiteral.getType().getIdentifier().equals("void")) {
        error("'void"+Joiner.on("").join(typeLiteral.getArrayDimensions()) +"' is not a valid type", null, INVALID_TYPE);
    }
}
项目:xtext-extras    文件:XbaseTypeComputer.java   
@Override
public void computeTypes(XExpression expression, ITypeComputationState state) {
    if (expression instanceof XAssignment) {
        _computeTypes((XAssignment)expression, state);
    } else if (expression instanceof XAbstractFeatureCall) {
        _computeTypes((XAbstractFeatureCall)expression, state);
    } else if (expression instanceof XDoWhileExpression) {
        _computeTypes((XDoWhileExpression)expression, state);
    } else if (expression instanceof XWhileExpression) {
        _computeTypes((XWhileExpression)expression, state);
    } else if (expression instanceof XBlockExpression) {
        _computeTypes((XBlockExpression)expression, state);
    } else if (expression instanceof XBooleanLiteral) {
        _computeTypes((XBooleanLiteral)expression, state);
    } else if (expression instanceof XCastedExpression) {
        _computeTypes((XCastedExpression)expression, state);
    } else if (expression instanceof XClosure) {
        _computeTypes((XClosure)expression, state);
    } else if (expression instanceof XConstructorCall) {
        _computeTypes((XConstructorCall)expression, state);
    } else if (expression instanceof XForLoopExpression) {
        _computeTypes((XForLoopExpression)expression, state);
    } else if (expression instanceof XBasicForLoopExpression) {
        _computeTypes((XBasicForLoopExpression)expression, state);
    } else if (expression instanceof XIfExpression) {
        _computeTypes((XIfExpression)expression, state);
    } else if (expression instanceof XInstanceOfExpression) {
        _computeTypes((XInstanceOfExpression)expression, state);
    } else if (expression instanceof XNumberLiteral) {
        _computeTypes((XNumberLiteral)expression, state);
    } else if (expression instanceof XNullLiteral) {
        _computeTypes((XNullLiteral)expression, state);
    } else if (expression instanceof XReturnExpression) {
        _computeTypes((XReturnExpression)expression, state);
    } else if (expression instanceof XStringLiteral) {
        _computeTypes((XStringLiteral)expression, state);
    } else if (expression instanceof XSwitchExpression) {
        _computeTypes((XSwitchExpression)expression, state);
    } else if (expression instanceof XThrowExpression) {
        _computeTypes((XThrowExpression)expression, state);
    } else if (expression instanceof XTryCatchFinallyExpression) {
        _computeTypes((XTryCatchFinallyExpression)expression, state);
    } else if (expression instanceof XTypeLiteral) {
        _computeTypes((XTypeLiteral)expression, state);
    } else if (expression instanceof XVariableDeclaration) {
        _computeTypes((XVariableDeclaration)expression, state);
    } else if (expression instanceof XListLiteral) {
        _computeTypes((XListLiteral)expression, state);
    } else if (expression instanceof XSetLiteral) {
        _computeTypes((XSetLiteral)expression, state);
    } else if (expression instanceof XSynchronizedExpression) {
        _computeTypes((XSynchronizedExpression)expression, state);
    } else {
        throw new UnsupportedOperationException("Missing type computation for expression type: " + expression.eClass().getName() + " / " + state);
    }
}
项目:xtext-extras    文件:LiteralsCompiler.java   
public void _toJavaExpression(XTypeLiteral expr, ITreeAppendable b) {
    b.append(expr.getType()).append(Joiner.on("").join(expr.getArrayDimensions())).append(".class");
}
项目:xtext-extras    文件:LiteralsCompiler.java   
public void _toJavaStatement(XTypeLiteral expr, ITreeAppendable b, boolean isReferenced) {
    generateComment(expr, b, isReferenced);
}
项目:xtext-extras    文件:XbaseInterpreter.java   
/**
 * don't call this directly. Always call evaluate() internalEvaluate()
 */
protected Object doEvaluate(XExpression expression, IEvaluationContext context, CancelIndicator indicator) {
    if (expression instanceof XAssignment) {
      return _doEvaluate((XAssignment)expression, context, indicator);
    } else if (expression instanceof XDoWhileExpression) {
      return _doEvaluate((XDoWhileExpression)expression, context, indicator);
    } else if (expression instanceof XMemberFeatureCall) {
      return _doEvaluate((XMemberFeatureCall)expression, context, indicator);
    } else if (expression instanceof XWhileExpression) {
      return _doEvaluate((XWhileExpression)expression, context, indicator);
    } else if (expression instanceof XFeatureCall) {
        return _doEvaluate((XFeatureCall)expression, context, indicator);
    } else if (expression instanceof XAbstractFeatureCall) {
        return _doEvaluate((XAbstractFeatureCall)expression, context, indicator);
    } else if (expression instanceof XBlockExpression) {
      return _doEvaluate((XBlockExpression)expression, context, indicator);
    } else if (expression instanceof XSynchronizedExpression) {
      return _doEvaluate((XSynchronizedExpression)expression, context, indicator);
    } else if (expression instanceof XBooleanLiteral) {
      return _doEvaluate((XBooleanLiteral)expression, context, indicator);
    } else if (expression instanceof XCastedExpression) {
      return _doEvaluate((XCastedExpression)expression, context, indicator);
    } else if (expression instanceof XClosure) {
      return _doEvaluate((XClosure)expression, context, indicator);
    } else if (expression instanceof XConstructorCall) {
      return _doEvaluate((XConstructorCall)expression, context, indicator);
    } else if (expression instanceof XForLoopExpression) {
      return _doEvaluate((XForLoopExpression)expression, context, indicator);
    } else if (expression instanceof XBasicForLoopExpression) {
      return _doEvaluate((XBasicForLoopExpression)expression, context, indicator);
    } else if (expression instanceof XIfExpression) {
      return _doEvaluate((XIfExpression)expression, context, indicator);
    } else if (expression instanceof XInstanceOfExpression) {
      return _doEvaluate((XInstanceOfExpression)expression, context, indicator);
    } else if (expression instanceof XNullLiteral) {
      return _doEvaluate((XNullLiteral)expression, context, indicator);
    } else if (expression instanceof XNumberLiteral) {
      return _doEvaluate((XNumberLiteral)expression, context, indicator);
    } else if (expression instanceof XReturnExpression) {
      return _doEvaluate((XReturnExpression)expression, context, indicator);
    } else if (expression instanceof XStringLiteral) {
      return _doEvaluate((XStringLiteral)expression, context, indicator);
    } else if (expression instanceof XSwitchExpression) {
      return _doEvaluate((XSwitchExpression)expression, context, indicator);
    } else if (expression instanceof XThrowExpression) {
      return _doEvaluate((XThrowExpression)expression, context, indicator);
    } else if (expression instanceof XTryCatchFinallyExpression) {
      return _doEvaluate((XTryCatchFinallyExpression)expression, context, indicator);
    } else if (expression instanceof XTypeLiteral) {
      return _doEvaluate((XTypeLiteral)expression, context, indicator);
    } else if (expression instanceof XVariableDeclaration) {
          return _doEvaluate((XVariableDeclaration)expression, context, indicator);
    } else if (expression instanceof XListLiteral) {
          return _doEvaluate((XListLiteral)expression, context, indicator);
    } else if (expression instanceof XSetLiteral) {
          return _doEvaluate((XSetLiteral)expression, context, indicator);
    } else {
      throw new IllegalArgumentException("Unhandled parameter types: " +
        Arrays.<Object>asList(expression, context, indicator).toString());
    }
}
项目:xtext-extras    文件:ConstantExpressionValidator.java   
protected boolean _isConstant(final XTypeLiteral expression) {
  return true;
}
项目:xtext-extras    文件:XbaseImplicitReturnFinder.java   
protected void _findImplicitReturns(final XTypeLiteral expression, final ImplicitReturnFinder.Acceptor acceptor) {
  acceptor.accept(expression);
}
项目:xtext-extras    文件:XbaseImplicitReturnFinder.java   
public void findImplicitReturns(final XExpression expression, final ImplicitReturnFinder.Acceptor acceptor) {
  if (expression instanceof XAbstractFeatureCall) {
    _findImplicitReturns((XAbstractFeatureCall)expression, acceptor);
    return;
  } else if (expression instanceof XBlockExpression) {
    _findImplicitReturns((XBlockExpression)expression, acceptor);
    return;
  } else if (expression instanceof XBooleanLiteral) {
    _findImplicitReturns((XBooleanLiteral)expression, acceptor);
    return;
  } else if (expression instanceof XCastedExpression) {
    _findImplicitReturns((XCastedExpression)expression, acceptor);
    return;
  } else if (expression instanceof XClosure) {
    _findImplicitReturns((XClosure)expression, acceptor);
    return;
  } else if (expression instanceof XCollectionLiteral) {
    _findImplicitReturns((XCollectionLiteral)expression, acceptor);
    return;
  } else if (expression instanceof XConstructorCall) {
    _findImplicitReturns((XConstructorCall)expression, acceptor);
    return;
  } else if (expression instanceof XIfExpression) {
    _findImplicitReturns((XIfExpression)expression, acceptor);
    return;
  } else if (expression instanceof XInstanceOfExpression) {
    _findImplicitReturns((XInstanceOfExpression)expression, acceptor);
    return;
  } else if (expression instanceof XNullLiteral) {
    _findImplicitReturns((XNullLiteral)expression, acceptor);
    return;
  } else if (expression instanceof XNumberLiteral) {
    _findImplicitReturns((XNumberLiteral)expression, acceptor);
    return;
  } else if (expression instanceof XStringLiteral) {
    _findImplicitReturns((XStringLiteral)expression, acceptor);
    return;
  } else if (expression instanceof XSwitchExpression) {
    _findImplicitReturns((XSwitchExpression)expression, acceptor);
    return;
  } else if (expression instanceof XSynchronizedExpression) {
    _findImplicitReturns((XSynchronizedExpression)expression, acceptor);
    return;
  } else if (expression instanceof XTryCatchFinallyExpression) {
    _findImplicitReturns((XTryCatchFinallyExpression)expression, acceptor);
    return;
  } else if (expression instanceof XTypeLiteral) {
    _findImplicitReturns((XTypeLiteral)expression, acceptor);
    return;
  } else if (expression != null) {
    _findImplicitReturns(expression, acceptor);
    return;
  } else if (expression == null) {
    _findImplicitReturns((Void)null, acceptor);
    return;
  } else {
    throw new IllegalArgumentException("Unhandled parameter types: " +
      Arrays.<Object>asList(expression, acceptor).toString());
  }
}
项目:xtext-extras    文件:EvaluationResult.java   
private Object _equalValue(final XTypeLiteral myValue, final XTypeLiteral otherTypeLiteral) {
  return Boolean.valueOf((Objects.equal(myValue.getType(), otherTypeLiteral.getType()) && Objects.equal(myValue.getArrayDimensions(), otherTypeLiteral.getArrayDimensions())));
}
项目:xtext-extras    文件:EvaluationResult.java   
private Object _equalValue(final JvmType myValue, final XTypeLiteral otherTypeLiteral) {
  return Boolean.valueOf((Objects.equal(myValue, otherTypeLiteral.getType()) && otherTypeLiteral.getArrayDimensions().isEmpty()));
}
项目:xtext-extras    文件:EvaluationResult.java   
private Object _equalValue(final XTypeLiteral myValue, final JvmType otherType) {
  return Boolean.valueOf((Objects.equal(myValue.getType(), otherType) && myValue.getArrayDimensions().isEmpty()));
}
项目:xtext-extras    文件:EvaluationResult.java   
private Object _equalValue(final XTypeLiteral myValue, final ThisReference otherType) {
  return Boolean.valueOf(false);
}
项目:xtext-extras    文件:EvaluationResult.java   
private Object _equalValue(final ThisReference myValue, final XTypeLiteral otherType) {
  return Boolean.valueOf(false);
}
项目:xtext-extras    文件:ConstantConditionsInterpreter.java   
protected EvaluationResult _internalEvaluate(final XTypeLiteral it, final EvaluationContext context) {
  return new EvaluationResult(it, false);
}
项目:xtext-extras    文件:AbstractConstantExpressionsInterpreter.java   
protected Object _internalEvaluate(final XTypeLiteral it, final Context ctx) {
  return this.toTypeReference(it.getType(), it.getArrayDimensions().size());
}
项目:xtext-extras    文件:ImportsCollector.java   
protected void _visit(final XTypeLiteral semanticElement, final INode originNode, final ImportsAcceptor acceptor) {
  final List<INode> elementNode = NodeModelUtils.findNodesForFeature(semanticElement, XbasePackage.Literals.XTYPE_LITERAL__TYPE);
  this.visit(semanticElement.getType(), IterableExtensions.<INode>head(elementNode), acceptor);
}
项目:xtext-extras    文件:XbaseParserTest.java   
@Test public void testTypeLiteral() throws Exception {
    XTypeLiteral expression = (XTypeLiteral) expression("typeof(String)");
    doTestTypeLiteral(expression);
}
项目:xtext-extras    文件:XbaseParserTest.java   
protected void doTestTypeLiteral(XTypeLiteral expression) {
    assertEquals("java.lang.String",expression.getType().getIdentifier());
}
项目:xtext-extras    文件:AbstractXbaseSemanticSequencer.java   
/**
 * Contexts:
 *     XExpression returns XTypeLiteral
 *     XAssignment returns XTypeLiteral
 *     XAssignment.XBinaryOperation_1_1_0_0_0 returns XTypeLiteral
 *     XOrExpression returns XTypeLiteral
 *     XOrExpression.XBinaryOperation_1_0_0_0 returns XTypeLiteral
 *     XAndExpression returns XTypeLiteral
 *     XAndExpression.XBinaryOperation_1_0_0_0 returns XTypeLiteral
 *     XEqualityExpression returns XTypeLiteral
 *     XEqualityExpression.XBinaryOperation_1_0_0_0 returns XTypeLiteral
 *     XRelationalExpression returns XTypeLiteral
 *     XRelationalExpression.XInstanceOfExpression_1_0_0_0_0 returns XTypeLiteral
 *     XRelationalExpression.XBinaryOperation_1_1_0_0_0 returns XTypeLiteral
 *     XOtherOperatorExpression returns XTypeLiteral
 *     XOtherOperatorExpression.XBinaryOperation_1_0_0_0 returns XTypeLiteral
 *     XAdditiveExpression returns XTypeLiteral
 *     XAdditiveExpression.XBinaryOperation_1_0_0_0 returns XTypeLiteral
 *     XMultiplicativeExpression returns XTypeLiteral
 *     XMultiplicativeExpression.XBinaryOperation_1_0_0_0 returns XTypeLiteral
 *     XUnaryOperation returns XTypeLiteral
 *     XCastedExpression returns XTypeLiteral
 *     XCastedExpression.XCastedExpression_1_0_0_0 returns XTypeLiteral
 *     XPostfixOperation returns XTypeLiteral
 *     XPostfixOperation.XPostfixOperation_1_0_0 returns XTypeLiteral
 *     XMemberFeatureCall returns XTypeLiteral
 *     XMemberFeatureCall.XAssignment_1_0_0_0_0 returns XTypeLiteral
 *     XMemberFeatureCall.XMemberFeatureCall_1_1_0_0_0 returns XTypeLiteral
 *     XPrimaryExpression returns XTypeLiteral
 *     XLiteral returns XTypeLiteral
 *     XParenthesizedExpression returns XTypeLiteral
 *     XExpressionOrVarDeclaration returns XTypeLiteral
 *     XTypeLiteral returns XTypeLiteral
 *
 * Constraint:
 *     (type=[JvmType|QualifiedName] arrayDimensions+=ArrayBrackets*)
 */
protected void sequence_XTypeLiteral(ISerializationContext context, XTypeLiteral semanticObject) {
    genericSequencer.createSequence(context, semanticObject);
}
项目:dsl-devkit    文件:AbstractCheckSemanticSequencer.java   
/**
 * Constraint:
 *     (type=[JvmType|QualifiedName] arrayDimensions+=ArrayBrackets*)
 */
protected void sequence_XTypeLiteral(EObject context, XTypeLiteral semanticObject) {
    genericSequencer.createSequence(context, semanticObject);
}
项目:dsl-devkit    文件:AbstractCheckCfgSemanticSequencer.java   
/**
 * Constraint:
 *     (type=[JvmType|QualifiedName] arrayDimensions+=ArrayBrackets*)
 */
protected void sequence_XTypeLiteral(EObject context, XTypeLiteral semanticObject) {
    genericSequencer.createSequence(context, semanticObject);
}