Java Code Examples for org.eclipse.xtext.xbase.XExpression#eClass()
The following examples show how to use
org.eclipse.xtext.xbase.XExpression#eClass() .
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: ClosureWithExpectationHelper.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
protected boolean isImplicitReturn(ITypeComputationResult expressionResult) { int flags = expressionResult.getConformanceFlags(); if ((ConformanceFlags.NO_IMPLICIT_RETURN & flags) != 0) { return false; } XExpression expression = expressionResult.getExpression(); if (expression == null) { return true; } if (expression.eClass() == XbasePackage.Literals.XRETURN_EXPRESSION) { return false; } TreeIterator<EObject> contents = expression.eAllContents(); while (contents.hasNext()) { EObject next = contents.next(); if (next.eClass() == XbasePackage.Literals.XRETURN_EXPRESSION) { return false; } if (next.eClass() == XbasePackage.Literals.XCLOSURE) { contents.prune(); } } return true; }
Example 2
Source File: EarlyExitValidator.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
protected void markConstantBooleanCondition(XExpression predicate, BooleanResult booleanResult, boolean ignoreBooleanLiteral) { if (!ignoreBooleanLiteral || predicate.eClass() != XbasePackage.Literals.XBOOLEAN_LITERAL) { Optional<Boolean> value = booleanResult.getValue(); if (value.isPresent()) { addIssue("Constant condition is always " + value.get() + ".", predicate, null, IssueCodes.CONSTANT_BOOLEAN_CONDITION); } else { addIssue("Constant condition.", predicate, null, IssueCodes.CONSTANT_BOOLEAN_CONDITION); } } }
Example 3
Source File: ResolvedTypes.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
protected JvmIdentifiableElement doGetLinkedFeature(/* @Nullable */ XExpression featureOrConstructorCall) { if (linkingMap == null || featureOrConstructorCall == null || featureOrConstructorCall.eClass() == XbasePackage.Literals.XCLOSURE) return null; IApplicableCandidate candidate = linkingMap.get(featureOrConstructorCall); if (candidate == null) return null; return ((ILinkingCandidate) candidate).getFeature(); }
Example 4
Source File: ResolvedTypes.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
protected List<LightweightTypeReference> doGetActualTypeArguments(XExpression expression) { if (expression == null || expression.eClass() == XbasePackage.Literals.XCLOSURE) { return Collections.emptyList(); } ILinkingCandidate result = (ILinkingCandidate) basicGetLinkingMap().get(expression); if (result != null) { return result.getTypeArguments(); } return Collections.emptyList(); }